OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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_TOUCH_HANDLE_H_ | 5 #ifndef UI_TOUCH_SELECTION_TOUCH_HANDLE_H_ |
6 #define UI_TOUCH_SELECTION_TOUCH_HANDLE_H_ | 6 #define UI_TOUCH_SELECTION_TOUCH_HANDLE_H_ |
7 | 7 |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 void SetOrientation(TouchHandleOrientation orientation); | 77 void SetOrientation(TouchHandleOrientation orientation); |
78 | 78 |
79 // Allows touch-dragging of the handle. Returns true if the event was | 79 // Allows touch-dragging of the handle. Returns true if the event was |
80 // consumed, in which case the caller should cease further handling. | 80 // consumed, in which case the caller should cease further handling. |
81 bool WillHandleTouchEvent(const MotionEvent& event); | 81 bool WillHandleTouchEvent(const MotionEvent& event); |
82 | 82 |
83 // Ticks an active animation, as requested to the client by |SetNeedsAnimate|. | 83 // Ticks an active animation, as requested to the client by |SetNeedsAnimate|. |
84 // Returns true if an animation is active and requires further ticking. | 84 // Returns true if an animation is active and requires further ticking. |
85 bool Animate(base::TimeTicks frame_time); | 85 bool Animate(base::TimeTicks frame_time); |
86 | 86 |
| 87 // Returns the visible bounds of the handle |
| 88 gfx::RectF GetHandleBounds(); |
| 89 |
87 bool is_dragging() const { return is_dragging_; } | 90 bool is_dragging() const { return is_dragging_; } |
88 const gfx::PointF& position() const { return position_; } | 91 const gfx::PointF& position() const { return position_; } |
89 TouchHandleOrientation orientation() const { return orientation_; } | 92 TouchHandleOrientation orientation() const { return orientation_; } |
90 | 93 |
91 private: | 94 private: |
92 void BeginDrag(); | 95 void BeginDrag(); |
93 void EndDrag(); | 96 void EndDrag(); |
94 void BeginFade(); | 97 void BeginFade(); |
95 void EndFade(); | 98 void EndFade(); |
96 void SetAlpha(float alpha); | 99 void SetAlpha(float alpha); |
(...skipping 22 matching lines...) Expand all Loading... |
119 bool is_visible_; | 122 bool is_visible_; |
120 bool is_dragging_; | 123 bool is_dragging_; |
121 bool is_drag_within_tap_region_; | 124 bool is_drag_within_tap_region_; |
122 | 125 |
123 DISALLOW_COPY_AND_ASSIGN(TouchHandle); | 126 DISALLOW_COPY_AND_ASSIGN(TouchHandle); |
124 }; | 127 }; |
125 | 128 |
126 } // namespace ui | 129 } // namespace ui |
127 | 130 |
128 #endif // UI_TOUCH_SELECTION_TOUCH_HANDLE_H_ | 131 #endif // UI_TOUCH_SELECTION_TOUCH_HANDLE_H_ |
OLD | NEW |