Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(86)

Side by Side Diff: ui/views/events/event.h

Issue 10154005: views: Some code cleanup: touch-events are not used to generate mouse-events anymore. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | ui/views/events/event.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef UI_VIEWS_EVENTS_EVENT_H_ 5 #ifndef UI_VIEWS_EVENTS_EVENT_H_
6 #define UI_VIEWS_EVENTS_EVENT_H_ 6 #define UI_VIEWS_EVENTS_EVENT_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 // from |source| coordinate system to |target| coordinate system. 135 // from |source| coordinate system to |target| coordinate system.
136 LocatedEvent(const LocatedEvent& model, View* source, View* target); 136 LocatedEvent(const LocatedEvent& model, View* source, View* target);
137 137
138 // This constructor is to allow converting the location of an event from the 138 // This constructor is to allow converting the location of an event from the
139 // widget's coordinate system to the RootView's coordinate system. 139 // widget's coordinate system to the RootView's coordinate system.
140 LocatedEvent(const LocatedEvent& model, View* root); 140 LocatedEvent(const LocatedEvent& model, View* root);
141 141
142 gfx::Point location_; 142 gfx::Point location_;
143 }; 143 };
144 144
145 class TouchEvent;
146
147 //////////////////////////////////////////////////////////////////////////////// 145 ////////////////////////////////////////////////////////////////////////////////
148 // 146 //
149 // MouseEvent class 147 // MouseEvent class
150 // 148 //
151 // A mouse event is used for any input event related to the mouse. 149 // A mouse event is used for any input event related to the mouse.
152 // 150 //
153 //////////////////////////////////////////////////////////////////////////////// 151 ////////////////////////////////////////////////////////////////////////////////
154 class VIEWS_EXPORT MouseEvent : public LocatedEvent { 152 class VIEWS_EXPORT MouseEvent : public LocatedEvent {
155 public: 153 public:
156 explicit MouseEvent(const NativeEvent& native_event); 154 explicit MouseEvent(const NativeEvent& native_event);
157 // Create a new MouseEvent which is identical to the provided model. 155 // Create a new MouseEvent which is identical to the provided model.
158 // If source / target views are provided, the model location will be converted 156 // If source / target views are provided, the model location will be converted
159 // from |source| coordinate system to |target| coordinate system. 157 // from |source| coordinate system to |target| coordinate system.
160 MouseEvent(const MouseEvent& model, View* source, View* target); 158 MouseEvent(const MouseEvent& model, View* source, View* target);
161 159
162 // Creates a new MouseEvent from a TouchEvent. The location of the TouchEvent
163 // is the same as the MouseEvent. Other attributes (e.g. type, flags) are
164 // mapped from the TouchEvent to appropriate MouseEvent attributes.
165 // GestureManager uses this to convert TouchEvents that are not handled by any
166 // view.
167 explicit MouseEvent(const TouchEvent& touch);
168
169 // TODO(msw): Kill this legacy constructor when we update uses. 160 // TODO(msw): Kill this legacy constructor when we update uses.
170 // Create a new mouse event 161 // Create a new mouse event
171 MouseEvent(ui::EventType type, int x, int y, int flags) 162 MouseEvent(ui::EventType type, int x, int y, int flags)
172 : LocatedEvent(type, gfx::Point(x, y), flags) { 163 : LocatedEvent(type, gfx::Point(x, y), flags) {
173 } 164 }
174 165
175 // Conveniences to quickly test what button is down 166 // Conveniences to quickly test what button is down
176 bool IsOnlyLeftMouseButton() const { 167 bool IsOnlyLeftMouseButton() const {
177 return (flags() & ui::EF_LEFT_MOUSE_BUTTON) && 168 return (flags() & ui::EF_LEFT_MOUSE_BUTTON) &&
178 !(flags() & (ui::EF_MIDDLE_MOUSE_BUTTON | ui::EF_RIGHT_MOUSE_BUTTON)); 169 !(flags() & (ui::EF_MIDDLE_MOUSE_BUTTON | ui::EF_RIGHT_MOUSE_BUTTON));
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 public: 439 public:
449 GestureEventForTest(ui::EventType type, int x, int y, int flags); 440 GestureEventForTest(ui::EventType type, int x, int y, int flags);
450 441
451 private: 442 private:
452 DISALLOW_COPY_AND_ASSIGN(GestureEventForTest); 443 DISALLOW_COPY_AND_ASSIGN(GestureEventForTest);
453 }; 444 };
454 445
455 } // namespace views 446 } // namespace views
456 447
457 #endif // UI_VIEWS_EVENTS_EVENT_H_ 448 #endif // UI_VIEWS_EVENTS_EVENT_H_
OLDNEW
« no previous file with comments | « no previous file | ui/views/events/event.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698