OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef UI_TOUCH_SELECTION_DRAG_DRAGGABLE_H_ |
| 6 #define UI_TOUCH_SELECTION_DRAG_DRAGGABLE_H_ |
| 7 |
| 8 #include "ui/gfx/geometry/point_f.h" |
| 9 #include "ui/touch_selection/ui_touch_selection_export.h" |
| 10 |
| 11 namespace ui { |
| 12 |
| 13 class MotionEvent; |
| 14 class TouchSelectionDraggable; |
| 15 |
| 16 // Interface through which TouchSelectionDraggable manipulates the selection. |
| 17 class UI_TOUCH_SELECTION_EXPORT TouchSelectionDraggableClient { |
| 18 public: |
| 19 virtual ~TouchSelectionDraggableClient() {} |
| 20 virtual void OnDragBegin(const TouchSelectionDraggable& draggable, |
| 21 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; |
| 26 }; |
| 27 |
| 28 // Generic interface for entities that manipulate the selection via dragging. |
| 29 class UI_TOUCH_SELECTION_EXPORT TouchSelectionDraggable { |
| 30 protected: |
| 31 virtual ~TouchSelectionDraggable() {} |
| 32 |
| 33 // 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. |
| 35 virtual bool WillHandleTouchEvent(const ui::MotionEvent& event) = 0; |
| 36 |
| 37 // Whether a drag is active OR being detected for the current touch sequence. |
| 38 virtual bool IsActive() const = 0; |
| 39 }; |
| 40 |
| 41 } // namespace ui |
| 42 |
| 43 #endif // UI_TOUCH_SELECTION_DRAG_DRAGGABLE_H_ |
OLD | NEW |