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_EVENTS_EVENT_H_ | 5 #ifndef UI_EVENTS_EVENT_H_ |
6 #define UI_EVENTS_EVENT_H_ | 6 #define UI_EVENTS_EVENT_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 }; | 311 }; |
312 | 312 |
313 class EVENTS_EXPORT CancelModeEvent : public Event { | 313 class EVENTS_EXPORT CancelModeEvent : public Event { |
314 public: | 314 public: |
315 CancelModeEvent(); | 315 CancelModeEvent(); |
316 ~CancelModeEvent() override; | 316 ~CancelModeEvent() override; |
317 }; | 317 }; |
318 | 318 |
319 class EVENTS_EXPORT LocatedEvent : public Event { | 319 class EVENTS_EXPORT LocatedEvent : public Event { |
320 public: | 320 public: |
| 321 // Convenience function that casts |event| to a LocatedEvent if it is one, |
| 322 // otherwise returns null. |
| 323 static const ui::LocatedEvent* FromIfValid(const ui::Event* event) { |
| 324 return event && event->IsLocatedEvent() ? event->AsLocatedEvent() : nullptr; |
| 325 } |
| 326 |
321 ~LocatedEvent() override; | 327 ~LocatedEvent() override; |
322 | 328 |
323 float x() const { return location_.x(); } | 329 float x() const { return location_.x(); } |
324 float y() const { return location_.y(); } | 330 float y() const { return location_.y(); } |
325 void set_location(const gfx::Point& location) { | 331 void set_location(const gfx::Point& location) { |
326 location_ = gfx::PointF(location); | 332 location_ = gfx::PointF(location); |
327 } | 333 } |
328 void set_location_f(const gfx::PointF& location) { location_ = location; } | 334 void set_location_f(const gfx::PointF& location) { location_ = location; } |
329 gfx::Point location() const { return gfx::ToFlooredPoint(location_); } | 335 gfx::Point location() const { return gfx::ToFlooredPoint(location_); } |
330 const gfx::PointF& location_f() const { return location_; } | 336 const gfx::PointF& location_f() const { return location_; } |
(...skipping 690 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1021 // dispatched. This field gets a non-zero value only for gestures that are | 1027 // dispatched. This field gets a non-zero value only for gestures that are |
1022 // released through TouchDispositionGestureFilter::SendGesture. The gesture | 1028 // released through TouchDispositionGestureFilter::SendGesture. The gesture |
1023 // events that aren't fired directly in response to processing a touch-event | 1029 // events that aren't fired directly in response to processing a touch-event |
1024 // (e.g. timer fired ones), this id is zero. See crbug.com/618738. | 1030 // (e.g. timer fired ones), this id is zero. See crbug.com/618738. |
1025 uint32_t unique_touch_event_id_; | 1031 uint32_t unique_touch_event_id_; |
1026 }; | 1032 }; |
1027 | 1033 |
1028 } // namespace ui | 1034 } // namespace ui |
1029 | 1035 |
1030 #endif // UI_EVENTS_EVENT_H_ | 1036 #endif // UI_EVENTS_EVENT_H_ |
OLD | NEW |