OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_UI_VIEWS_TOUCHUI_TOUCH_SELECTION_CONTROLLER_IMPL_H_ | 5 #ifndef UI_UI_VIEWS_TOUCHUI_TOUCH_SELECTION_CONTROLLER_IMPL_H_ |
6 #define UI_UI_VIEWS_TOUCHUI_TOUCH_SELECTION_CONTROLLER_IMPL_H_ | 6 #define UI_UI_VIEWS_TOUCHUI_TOUCH_SELECTION_CONTROLLER_IMPL_H_ |
7 | 7 |
8 #include "base/timer.h" | 8 #include "base/timer.h" |
| 9 #include "ui/base/touch/touch_editing_controller.h" |
9 #include "ui/gfx/point.h" | 10 #include "ui/gfx/point.h" |
10 #include "ui/views/touchui/touch_selection_controller.h" | |
11 #include "ui/views/view.h" | 11 #include "ui/views/view.h" |
12 #include "ui/views/views_export.h" | 12 #include "ui/views/views_export.h" |
13 | 13 |
14 namespace views { | 14 namespace views { |
15 | 15 |
16 // Touch specific implementation of TouchSelectionController. Responsible for | 16 // Touch specific implementation of TouchSelectionController. Responsible for |
17 // displaying selection handles and menu elements relevant in a touch interface. | 17 // displaying selection handles and menu elements relevant in a touch interface. |
18 class VIEWS_EXPORT TouchSelectionControllerImpl | 18 class VIEWS_EXPORT TouchSelectionControllerImpl |
19 : public TouchSelectionController { | 19 : public ui::TouchSelectionController { |
20 public: | 20 public: |
21 // Use TextSelectionController::create(). | 21 // Use TextSelectionController::create(). |
22 explicit TouchSelectionControllerImpl(TouchSelectionClientView* client_view); | 22 explicit TouchSelectionControllerImpl( |
| 23 ui::TouchEditable* client_view); |
23 | 24 |
24 virtual ~TouchSelectionControllerImpl(); | 25 virtual ~TouchSelectionControllerImpl(); |
25 | 26 |
26 // TextSelectionController. | 27 // TextSelectionController. |
27 virtual void SelectionChanged(const gfx::Point& p1, | 28 virtual void SelectionChanged(const gfx::Point& p1, |
28 const gfx::Point& p2) OVERRIDE; | 29 const gfx::Point& p2) OVERRIDE; |
29 | 30 |
30 virtual void ClientViewLostFocus() OVERRIDE; | 31 virtual void ClientViewLostFocus() OVERRIDE; |
31 | 32 |
32 private: | 33 private: |
(...skipping 23 matching lines...) Expand all Loading... |
56 | 57 |
57 // Convenience method for hiding context menu. | 58 // Convenience method for hiding context menu. |
58 void HideContextMenu(); | 59 void HideContextMenu(); |
59 | 60 |
60 // Convenience methods for testing. | 61 // Convenience methods for testing. |
61 gfx::Point GetSelectionHandle1Position(); | 62 gfx::Point GetSelectionHandle1Position(); |
62 gfx::Point GetSelectionHandle2Position(); | 63 gfx::Point GetSelectionHandle2Position(); |
63 bool IsSelectionHandle1Visible(); | 64 bool IsSelectionHandle1Visible(); |
64 bool IsSelectionHandle2Visible(); | 65 bool IsSelectionHandle2Visible(); |
65 | 66 |
66 TouchSelectionClientView* client_view_; | 67 ui::TouchEditable* client_view_; |
67 scoped_ptr<SelectionHandleView> selection_handle_1_; | 68 scoped_ptr<SelectionHandleView> selection_handle_1_; |
68 scoped_ptr<SelectionHandleView> selection_handle_2_; | 69 scoped_ptr<SelectionHandleView> selection_handle_2_; |
69 scoped_ptr<TouchContextMenuView> context_menu_; | 70 scoped_ptr<TouchContextMenuView> context_menu_; |
70 | 71 |
71 // Timer to trigger |context_menu| (|context_menu| is not shown if the | 72 // Timer to trigger |context_menu| (|context_menu| is not shown if the |
72 // selection handles are being updated. It appears only when the handles are | 73 // selection handles are being updated. It appears only when the handles are |
73 // stationary for a certain amount of time). | 74 // stationary for a certain amount of time). |
74 base::OneShotTimer<TouchSelectionControllerImpl> context_menu_timer_; | 75 base::OneShotTimer<TouchSelectionControllerImpl> context_menu_timer_; |
75 | 76 |
76 // Pointer to the SelectionHandleView being dragged during a drag session. | 77 // Pointer to the SelectionHandleView being dragged during a drag session. |
77 SelectionHandleView* dragging_handle_; | 78 SelectionHandleView* dragging_handle_; |
78 | 79 |
79 DISALLOW_COPY_AND_ASSIGN(TouchSelectionControllerImpl); | 80 DISALLOW_COPY_AND_ASSIGN(TouchSelectionControllerImpl); |
80 }; | 81 }; |
81 | 82 |
82 } // namespace views | 83 } // namespace views |
83 | 84 |
84 #endif // UI_UI_VIEWS_TOUCHUI_TOUCH_SELECTION_CONTROLLER_IMPL_H_ | 85 #endif // UI_UI_VIEWS_TOUCHUI_TOUCH_SELECTION_CONTROLLER_IMPL_H_ |
OLD | NEW |