gesture_event_data.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. // Copyright 2014 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef UI_EVENTS_GESTURE_DETECTION_GESTURE_EVENT_DATA_H_
  5. #define UI_EVENTS_GESTURE_DETECTION_GESTURE_EVENT_DATA_H_
  6. #include <stddef.h>
  7. #include "base/time/time.h"
  8. #include "ui/events/gesture_detection/gesture_detection_export.h"
  9. #include "ui/events/gesture_detection/motion_event.h"
  10. #include "ui/events/gesture_event_details.h"
  11. #include "ui/events/types/event_type.h"
  12. namespace ui {
  13. class GestureEventDataPacket;
  14. struct GESTURE_DETECTION_EXPORT GestureEventData {
  15. GestureEventData(const GestureEventDetails&,
  16. int motion_event_id,
  17. MotionEvent::ToolType primary_tool_type,
  18. base::TimeTicks time,
  19. float x,
  20. float y,
  21. float raw_x,
  22. float raw_y,
  23. size_t touch_point_count,
  24. const gfx::RectF& bounding_box,
  25. int flags,
  26. uint32_t unique_touch_event_id);
  27. GestureEventData(EventType type, const GestureEventData&);
  28. GestureEventData(const GestureEventData& other);
  29. GestureEventData& operator=(const GestureEventData& other);
  30. EventType type() const { return details.type(); }
  31. GestureEventDetails details;
  32. int motion_event_id;
  33. // The tool type for the first touch point in the gesture.
  34. MotionEvent::ToolType primary_tool_type;
  35. base::TimeTicks time;
  36. float x;
  37. float y;
  38. float raw_x;
  39. float raw_y;
  40. int flags;
  41. // The unique id of the touch event that released the gesture event. This
  42. // field gets a non-zero from the corresponding field in
  43. // GestureEventDataPacket at the moment the gesture is pushed into the packet.
  44. uint32_t unique_touch_event_id;
  45. private:
  46. friend class GestureEventDataPacket;
  47. // Initializes type to GESTURE_TYPE_INVALID.
  48. GestureEventData();
  49. };
  50. } // namespace ui
  51. #endif // UI_EVENTS_GESTURE_DETECTION_GESTURE_EVENT_DATA_H_