OLD | NEW |
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_BASE_EVENT_H_ | 5 #ifndef UI_BASE_EVENT_H_ |
6 #define UI_BASE_EVENT_H_ | 6 #define UI_BASE_EVENT_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/event_types.h" | 10 #include "base/event_types.h" |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 if (target && target != source) | 125 if (target && target != source) |
126 T::ConvertPointToTarget(source, target, &location_); | 126 T::ConvertPointToTarget(source, target, &location_); |
127 } | 127 } |
128 | 128 |
129 // Used for synthetic events in testing. | 129 // Used for synthetic events in testing. |
130 LocatedEvent(EventType type, | 130 LocatedEvent(EventType type, |
131 const gfx::Point& location, | 131 const gfx::Point& location, |
132 const gfx::Point& root_location, | 132 const gfx::Point& root_location, |
133 int flags); | 133 int flags); |
134 | 134 |
| 135 LocatedEvent(const LocatedEvent& model); |
| 136 |
135 gfx::Point location_; | 137 gfx::Point location_; |
136 | 138 |
137 gfx::Point root_location_; | 139 gfx::Point root_location_; |
138 | |
139 private: | |
140 DISALLOW_COPY_AND_ASSIGN(LocatedEvent); | |
141 }; | 140 }; |
142 | 141 |
143 class UI_EXPORT MouseEvent : public LocatedEvent { | 142 class UI_EXPORT MouseEvent : public LocatedEvent { |
144 public: | 143 public: |
145 explicit MouseEvent(const base::NativeEvent& native_event); | 144 explicit MouseEvent(const base::NativeEvent& native_event); |
146 | 145 |
147 // Create a new MouseEvent based on the provided model. | 146 // Create a new MouseEvent based on the provided model. |
148 // Uses the provided |type| and |flags| for the new event. | 147 // Uses the provided |type| and |flags| for the new event. |
149 // If source / target windows are provided, the model location will be | 148 // If source / target windows are provided, the model location will be |
150 // converted from |source| coordinate system to |target| coordinate system. | 149 // converted from |source| coordinate system to |target| coordinate system. |
(...skipping 25 matching lines...) Expand all Loading... |
176 const MouseEvent& event1, | 175 const MouseEvent& event1, |
177 const MouseEvent& event2); | 176 const MouseEvent& event2); |
178 | 177 |
179 // Get the click count. Can be 1, 2 or 3 for mousedown messages, 0 otherwise. | 178 // Get the click count. Can be 1, 2 or 3 for mousedown messages, 0 otherwise. |
180 int GetClickCount() const; | 179 int GetClickCount() const; |
181 | 180 |
182 // Set the click count for a mousedown message. Can be 1, 2 or 3. | 181 // Set the click count for a mousedown message. Can be 1, 2 or 3. |
183 void SetClickCount(int click_count); | 182 void SetClickCount(int click_count); |
184 | 183 |
185 private: | 184 private: |
| 185 explicit MouseEvent(const MouseEvent& model); |
| 186 |
186 gfx::Point root_location_; | 187 gfx::Point root_location_; |
187 | 188 |
188 static MouseEvent* last_click_event_; | 189 static MouseEvent* last_click_event_; |
189 // Returns the repeat count based on the previous mouse click, if it is | 190 // Returns the repeat count based on the previous mouse click, if it is |
190 // recent enough and within a small enough distance. | 191 // recent enough and within a small enough distance. |
191 static int GetRepeatCount(const MouseEvent& click_event); | 192 static int GetRepeatCount(const MouseEvent& click_event); |
192 | |
193 DISALLOW_COPY_AND_ASSIGN(MouseEvent); | |
194 }; | 193 }; |
195 | 194 |
196 // TODO(beng): rename to TouchEvent after conversion is complete. | 195 // TODO(beng): rename to TouchEvent after conversion is complete. |
197 class UI_EXPORT TouchEventImpl : public LocatedEvent, | 196 class UI_EXPORT TouchEventImpl : public LocatedEvent, |
198 public TouchEvent { | 197 public TouchEvent { |
199 public: | 198 public: |
200 explicit TouchEventImpl(const base::NativeEvent& native_event); | 199 explicit TouchEventImpl(const base::NativeEvent& native_event); |
201 | 200 |
202 // Create a new TouchEventImpl which is identical to the provided model. | 201 // Create a new TouchEventImpl which is identical to the provided model. |
203 // If source / target windows are provided, the model location will be | 202 // If source / target windows are provided, the model location will be |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 // This value is stored as a bitfield because the number of touch ids varies, | 412 // This value is stored as a bitfield because the number of touch ids varies, |
414 // but we currently don't need more than 32 touches at a time. | 413 // but we currently don't need more than 32 touches at a time. |
415 const unsigned int touch_ids_bitfield_; | 414 const unsigned int touch_ids_bitfield_; |
416 | 415 |
417 DISALLOW_COPY_AND_ASSIGN(GestureEventImpl); | 416 DISALLOW_COPY_AND_ASSIGN(GestureEventImpl); |
418 }; | 417 }; |
419 | 418 |
420 } // namespace ui | 419 } // namespace ui |
421 | 420 |
422 #endif // UI_BASE_EVENT_H_ | 421 #endif // UI_BASE_EVENT_H_ |
OLD | NEW |