| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/timer.h" | 8 #include "base/timer/timer.h" |
| 9 #include "ui/base/touch/touch_editing_controller.h" | 9 #include "ui/base/touch/touch_editing_controller.h" |
| 10 #include "ui/gfx/point.h" | 10 #include "ui/gfx/point.h" |
| 11 #include "ui/views/touchui/touch_editing_menu.h" | 11 #include "ui/views/touchui/touch_editing_menu.h" |
| 12 #include "ui/views/view.h" | 12 #include "ui/views/view.h" |
| 13 #include "ui/views/views_export.h" | 13 #include "ui/views/views_export.h" |
| 14 | 14 |
| 15 namespace views { | 15 namespace views { |
| 16 | 16 |
| 17 namespace test { |
| 18 class WidgetTestInteractive; |
| 19 } |
| 20 |
| 17 // Touch specific implementation of TouchSelectionController. Responsible for | 21 // Touch specific implementation of TouchSelectionController. Responsible for |
| 18 // displaying selection handles and menu elements relevant in a touch interface. | 22 // displaying selection handles and menu elements relevant in a touch interface. |
| 19 class VIEWS_EXPORT TouchSelectionControllerImpl | 23 class VIEWS_EXPORT TouchSelectionControllerImpl |
| 20 : public ui::TouchSelectionController, | 24 : public ui::TouchSelectionController, |
| 21 public TouchEditingMenuController, | 25 public TouchEditingMenuController, |
| 22 public WidgetObserver, | 26 public WidgetObserver, |
| 23 public ui::EventHandler { | 27 public ui::EventHandler { |
| 24 public: | 28 public: |
| 25 class EditingHandleView; | 29 class EditingHandleView; |
| 26 | 30 |
| 27 // Use TextSelectionController::create(). | 31 // Use TextSelectionController::create(). |
| 28 explicit TouchSelectionControllerImpl( | 32 explicit TouchSelectionControllerImpl( |
| 29 ui::TouchEditable* client_view); | 33 ui::TouchEditable* client_view); |
| 30 | 34 |
| 31 virtual ~TouchSelectionControllerImpl(); | 35 virtual ~TouchSelectionControllerImpl(); |
| 32 | 36 |
| 33 // TextSelectionController. | 37 // TextSelectionController. |
| 34 virtual void SelectionChanged() OVERRIDE; | 38 virtual void SelectionChanged() OVERRIDE; |
| 35 virtual bool IsHandleDragInProgress() OVERRIDE; | 39 virtual bool IsHandleDragInProgress() OVERRIDE; |
| 36 virtual void HideHandles(bool quick) OVERRIDE; | 40 virtual void HideHandles(bool quick) OVERRIDE; |
| 37 | 41 |
| 38 private: | 42 private: |
| 39 friend class TouchSelectionControllerImplTest; | 43 friend class TouchSelectionControllerImplTest; |
| 44 friend class test::WidgetTestInteractive; |
| 40 | 45 |
| 41 void SetDraggingHandle(EditingHandleView* handle); | 46 void SetDraggingHandle(EditingHandleView* handle); |
| 42 | 47 |
| 43 // Callback to inform the client view that the selection handle has been | 48 // Callback to inform the client view that the selection handle has been |
| 44 // dragged, hence selection may need to be updated. | 49 // dragged, hence selection may need to be updated. |
| 45 void SelectionHandleDragged(const gfx::Point& drag_pos); | 50 void SelectionHandleDragged(const gfx::Point& drag_pos); |
| 46 | 51 |
| 47 // Convenience method to convert a point from a selection handle's coordinate | 52 // Convenience method to convert a point from a selection handle's coordinate |
| 48 // system to that of the client view. | 53 // system to that of the client view. |
| 49 void ConvertPointToClientView(EditingHandleView* source, gfx::Point* point); | 54 void ConvertPointToClientView(EditingHandleView* source, gfx::Point* point); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 // Selection end points, clipped to client view's boundaries. | 125 // Selection end points, clipped to client view's boundaries. |
| 121 gfx::Rect selection_end_point_1_clipped_; | 126 gfx::Rect selection_end_point_1_clipped_; |
| 122 gfx::Rect selection_end_point_2_clipped_; | 127 gfx::Rect selection_end_point_2_clipped_; |
| 123 | 128 |
| 124 DISALLOW_COPY_AND_ASSIGN(TouchSelectionControllerImpl); | 129 DISALLOW_COPY_AND_ASSIGN(TouchSelectionControllerImpl); |
| 125 }; | 130 }; |
| 126 | 131 |
| 127 } // namespace views | 132 } // namespace views |
| 128 | 133 |
| 129 #endif // UI_UI_VIEWS_TOUCHUI_TOUCH_SELECTION_CONTROLLER_IMPL_H_ | 134 #endif // UI_UI_VIEWS_TOUCHUI_TOUCH_SELECTION_CONTROLLER_IMPL_H_ |
| OLD | NEW |