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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 if (target && target != source) | 165 if (target && target != source) |
166 T::ConvertPointToTarget(source, target, &location_); | 166 T::ConvertPointToTarget(source, target, &location_); |
167 } | 167 } |
168 | 168 |
169 // Used for synthetic events in testing. | 169 // Used for synthetic events in testing. |
170 LocatedEvent(EventType type, | 170 LocatedEvent(EventType type, |
171 const gfx::Point& location, | 171 const gfx::Point& location, |
172 const gfx::Point& root_location, | 172 const gfx::Point& root_location, |
173 int flags); | 173 int flags); |
174 | 174 |
175 // Called from MouseEvent's copy ctor. | |
176 explicit LocatedEvent(const LocatedEvent& model); | |
177 | |
178 gfx::Point location_; | 175 gfx::Point location_; |
179 | 176 |
180 // |location_| multiplied by an optional transformation matrix for | 177 // |location_| multiplied by an optional transformation matrix for |
181 // rotations, animations and skews. | 178 // rotations, animations and skews. |
182 gfx::Point root_location_; | 179 gfx::Point root_location_; |
183 | 180 |
184 // |location_| in underlying system screen coordinates. This can be invalid | 181 // |location_| in underlying system screen coordinates. This can be invalid |
185 // |during synthesized events if a location isn't explicitly set. | 182 // |during synthesized events if a location isn't explicitly set. |
186 bool valid_system_location_; | 183 bool valid_system_location_; |
187 gfx::Point system_location_; | 184 gfx::Point system_location_; |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 // Set the click count for a mousedown message. Can be 1, 2 or 3. | 256 // Set the click count for a mousedown message. Can be 1, 2 or 3. |
260 void SetClickCount(int click_count); | 257 void SetClickCount(int click_count); |
261 | 258 |
262 // Identifies the button that changed. During a press this corresponds to the | 259 // Identifies the button that changed. During a press this corresponds to the |
263 // button that was pressed and during a release this corresponds to the button | 260 // button that was pressed and during a release this corresponds to the button |
264 // that was released. | 261 // that was released. |
265 // NOTE: during a press and release flags() contains the complete set of | 262 // NOTE: during a press and release flags() contains the complete set of |
266 // flags. Use this to determine the button that was pressed or released. | 263 // flags. Use this to determine the button that was pressed or released. |
267 int changed_button_flags() const { return changed_button_flags_; } | 264 int changed_button_flags() const { return changed_button_flags_; } |
268 | 265 |
269 protected: | |
270 // Called from MouseWheelEvent's ctor. | |
271 explicit MouseEvent(const MouseEvent& model); | |
272 | |
273 private: | 266 private: |
274 // Returns the repeat count based on the previous mouse click, if it is | 267 // Returns the repeat count based on the previous mouse click, if it is |
275 // recent enough and within a small enough distance. | 268 // recent enough and within a small enough distance. |
276 static int GetRepeatCount(const MouseEvent& click_event); | 269 static int GetRepeatCount(const MouseEvent& click_event); |
277 | 270 |
278 gfx::Point root_location_; | 271 gfx::Point root_location_; |
279 | 272 |
280 // See description above getter for details. | 273 // See description above getter for details. |
281 int changed_button_flags_; | 274 int changed_button_flags_; |
282 | 275 |
283 static MouseEvent* last_click_event_; | 276 static MouseEvent* last_click_event_; |
284 }; | 277 }; |
285 | 278 |
286 class ScrollEvent; | 279 class ScrollEvent; |
287 | 280 |
288 class UI_EXPORT MouseWheelEvent : public MouseEvent { | 281 class UI_EXPORT MouseWheelEvent : public MouseEvent { |
289 public: | 282 public: |
290 // See |offset| for details. | 283 // See |offset| for details. |
291 static const int kWheelDelta; | 284 static const int kWheelDelta; |
292 | 285 |
293 explicit MouseWheelEvent(const base::NativeEvent& native_event); | 286 explicit MouseWheelEvent(const base::NativeEvent& native_event); |
294 explicit MouseWheelEvent(const MouseEvent& mouse_event); | |
295 explicit MouseWheelEvent(const ScrollEvent& scroll_event); | 287 explicit MouseWheelEvent(const ScrollEvent& scroll_event); |
296 | 288 |
297 template <class T> | 289 template <class T> |
298 MouseWheelEvent(const MouseWheelEvent& model, | 290 MouseWheelEvent(const MouseWheelEvent& model, |
299 T* source, | 291 T* source, |
300 T* target, | 292 T* target, |
301 EventType type, | 293 EventType type, |
302 int flags) | 294 int flags) |
303 : MouseEvent(model, source, target, type, flags), | 295 : MouseEvent(model, source, target, type, flags), |
304 offset_(model.offset_) { | 296 offset_(model.offset_) { |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
556 // This value is stored as a bitfield because the number of touch ids varies, | 548 // This value is stored as a bitfield because the number of touch ids varies, |
557 // but we currently don't need more than 32 touches at a time. | 549 // but we currently don't need more than 32 touches at a time. |
558 const unsigned int touch_ids_bitfield_; | 550 const unsigned int touch_ids_bitfield_; |
559 | 551 |
560 DISALLOW_COPY_AND_ASSIGN(GestureEvent); | 552 DISALLOW_COPY_AND_ASSIGN(GestureEvent); |
561 }; | 553 }; |
562 | 554 |
563 } // namespace ui | 555 } // namespace ui |
564 | 556 |
565 #endif // UI_BASE_EVENT_H_ | 557 #endif // UI_BASE_EVENT_H_ |
OLD | NEW |