OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_TOUCH_SELECTION_DRAG_DRAGGABLE_H_ | 5 #ifndef UI_TOUCH_SELECTION_DRAG_DRAGGABLE_H_ |
6 #define UI_TOUCH_SELECTION_DRAG_DRAGGABLE_H_ | 6 #define UI_TOUCH_SELECTION_DRAG_DRAGGABLE_H_ |
7 | 7 |
8 #include "ui/gfx/geometry/point_f.h" | 8 #include "ui/gfx/geometry/point_f.h" |
9 #include "ui/touch_selection/ui_touch_selection_export.h" | 9 #include "ui/touch_selection/ui_touch_selection_export.h" |
10 | 10 |
11 namespace ui { | 11 namespace ui { |
12 | 12 |
13 class MotionEvent; | 13 class MotionEvent; |
14 class TouchSelectionDraggable; | 14 class TouchSelectionDraggable; |
15 | 15 |
| 16 enum TouchHandleDragEvent { |
| 17 HANDLE_DRAG_BEGIN, |
| 18 HANDLE_DRAG_UPDATE, |
| 19 HANDLE_DRAG_END |
| 20 }; |
| 21 |
16 // Interface through which TouchSelectionDraggable manipulates the selection. | 22 // Interface through which TouchSelectionDraggable manipulates the selection. |
17 class UI_TOUCH_SELECTION_EXPORT TouchSelectionDraggableClient { | 23 class UI_TOUCH_SELECTION_EXPORT TouchSelectionDraggableClient { |
18 public: | 24 public: |
19 virtual ~TouchSelectionDraggableClient() {} | 25 virtual ~TouchSelectionDraggableClient() {} |
20 virtual void OnDragBegin(const TouchSelectionDraggable& draggable, | 26 virtual void OnDragEvent(const TouchHandleDragEvent event, |
| 27 const TouchSelectionDraggable& draggable, |
21 const gfx::PointF& start_position) = 0; | 28 const gfx::PointF& start_position) = 0; |
22 virtual void OnDragUpdate(const TouchSelectionDraggable& draggable, | |
23 const gfx::PointF& new_position) = 0; | |
24 virtual void OnDragEnd(const TouchSelectionDraggable& draggable) = 0; | |
25 virtual bool IsWithinTapSlop(const gfx::Vector2dF& delta) const = 0; | 29 virtual bool IsWithinTapSlop(const gfx::Vector2dF& delta) const = 0; |
26 }; | 30 }; |
27 | 31 |
28 // Generic interface for entities that manipulate the selection via dragging. | 32 // Generic interface for entities that manipulate the selection via dragging. |
29 class UI_TOUCH_SELECTION_EXPORT TouchSelectionDraggable { | 33 class UI_TOUCH_SELECTION_EXPORT TouchSelectionDraggable { |
30 protected: | 34 protected: |
31 virtual ~TouchSelectionDraggable() {} | 35 virtual ~TouchSelectionDraggable() {} |
32 | 36 |
33 // Offers a touch sequence to the draggable target. Returns true if the event | 37 // Offers a touch sequence to the draggable target. Returns true if the event |
34 // was consumed, in which case the caller should cease further handling. | 38 // was consumed, in which case the caller should cease further handling. |
35 virtual bool WillHandleTouchEvent(const ui::MotionEvent& event) = 0; | 39 virtual bool WillHandleTouchEvent(const ui::MotionEvent& event) = 0; |
36 | 40 |
37 // Whether a drag is active OR being detected for the current touch sequence. | 41 // Whether a drag is active OR being detected for the current touch sequence. |
38 virtual bool IsActive() const = 0; | 42 virtual bool IsActive() const = 0; |
39 }; | 43 }; |
40 | 44 |
41 } // namespace ui | 45 } // namespace ui |
42 | 46 |
43 #endif // UI_TOUCH_SELECTION_DRAG_DRAGGABLE_H_ | 47 #endif // UI_TOUCH_SELECTION_DRAG_DRAGGABLE_H_ |
OLD | NEW |