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* AsLocatedEventIfLocatedEvent( |
| 324 const ui::Event* event) { |
| 325 return event && event->IsLocatedEvent() ? event->AsLocatedEvent() : nullptr; |
| 326 } |
| 327 |
321 ~LocatedEvent() override; | 328 ~LocatedEvent() override; |
322 | 329 |
323 float x() const { return location_.x(); } | 330 float x() const { return location_.x(); } |
324 float y() const { return location_.y(); } | 331 float y() const { return location_.y(); } |
325 void set_location(const gfx::Point& location) { | 332 void set_location(const gfx::Point& location) { |
326 location_ = gfx::PointF(location); | 333 location_ = gfx::PointF(location); |
327 } | 334 } |
328 void set_location_f(const gfx::PointF& location) { location_ = location; } | 335 void set_location_f(const gfx::PointF& location) { location_ = location; } |
329 gfx::Point location() const { return gfx::ToFlooredPoint(location_); } | 336 gfx::Point location() const { return gfx::ToFlooredPoint(location_); } |
330 const gfx::PointF& location_f() const { return location_; } | 337 const gfx::PointF& location_f() const { return location_; } |
(...skipping 676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1007 | 1014 |
1008 const GestureEventDetails& details() const { return details_; } | 1015 const GestureEventDetails& details() const { return details_; } |
1009 | 1016 |
1010 private: | 1017 private: |
1011 GestureEventDetails details_; | 1018 GestureEventDetails details_; |
1012 }; | 1019 }; |
1013 | 1020 |
1014 } // namespace ui | 1021 } // namespace ui |
1015 | 1022 |
1016 #endif // UI_EVENTS_EVENT_H_ | 1023 #endif // UI_EVENTS_EVENT_H_ |
OLD | NEW |