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/aura/window_observer.h" |
9 #include "ui/base/touch/touch_editing_controller.h" | 10 #include "ui/base/touch/touch_editing_controller.h" |
10 #include "ui/gfx/point.h" | 11 #include "ui/gfx/point.h" |
11 #include "ui/views/touchui/touch_editing_menu.h" | 12 #include "ui/views/touchui/touch_editing_menu.h" |
12 #include "ui/views/view.h" | 13 #include "ui/views/view.h" |
13 #include "ui/views/views_export.h" | 14 #include "ui/views/views_export.h" |
14 | 15 |
15 namespace views { | 16 namespace views { |
16 | 17 |
17 namespace test { | 18 namespace test { |
18 class WidgetTestInteractive; | 19 class WidgetTestInteractive; |
19 } | 20 } |
20 | 21 |
21 // Touch specific implementation of TouchSelectionController. Responsible for | 22 // Touch specific implementation of TouchSelectionController. Responsible for |
22 // displaying selection handles and menu elements relevant in a touch interface. | 23 // displaying selection handles and menu elements relevant in a touch interface. |
23 class VIEWS_EXPORT TouchSelectionControllerImpl | 24 class VIEWS_EXPORT TouchSelectionControllerImpl |
24 : public ui::TouchSelectionController, | 25 : public ui::TouchSelectionController, |
25 public TouchEditingMenuController, | 26 public TouchEditingMenuController, |
| 27 public aura::WindowObserver, |
26 public WidgetObserver, | 28 public WidgetObserver, |
27 public ui::EventHandler { | 29 public ui::EventHandler { |
28 public: | 30 public: |
29 class EditingHandleView; | 31 class EditingHandleView; |
30 | 32 |
31 // Use TextSelectionController::create(). | 33 // Use TextSelectionController::create(). |
32 explicit TouchSelectionControllerImpl( | 34 explicit TouchSelectionControllerImpl( |
33 ui::TouchEditable* client_view); | 35 ui::TouchEditable* client_view); |
34 | 36 |
35 virtual ~TouchSelectionControllerImpl(); | 37 virtual ~TouchSelectionControllerImpl(); |
(...skipping 25 matching lines...) Expand all Loading... |
61 // Checks if handle should be shown for a selection end-point at |rect|. | 63 // Checks if handle should be shown for a selection end-point at |rect|. |
62 // |rect| should be the clipped version of the selection end-point. | 64 // |rect| should be the clipped version of the selection end-point. |
63 bool ShouldShowHandleFor(const gfx::Rect& rect) const; | 65 bool ShouldShowHandleFor(const gfx::Rect& rect) const; |
64 | 66 |
65 // Overridden from TouchEditingMenuController. | 67 // Overridden from TouchEditingMenuController. |
66 virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE; | 68 virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE; |
67 virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE; | 69 virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE; |
68 virtual void OpenContextMenu() OVERRIDE; | 70 virtual void OpenContextMenu() OVERRIDE; |
69 virtual void OnMenuClosed(TouchEditingMenuView* menu) OVERRIDE; | 71 virtual void OnMenuClosed(TouchEditingMenuView* menu) OVERRIDE; |
70 | 72 |
| 73 // Overriden from aura::WindowObserver. |
| 74 virtual void OnAncestorWindowTransformed(aura::Window* source, |
| 75 aura::Window* window) OVERRIDE; |
| 76 |
71 // Overridden from WidgetObserver. We will observe the widget backing the | 77 // Overridden from WidgetObserver. We will observe the widget backing the |
72 // |client_view_| so that when its moved/resized, we can update the selection | 78 // |client_view_| so that when its moved/resized, we can update the selection |
73 // handles appropriately. | 79 // handles appropriately. |
74 virtual void OnWidgetClosing(Widget* widget) OVERRIDE; | 80 virtual void OnWidgetClosing(Widget* widget) OVERRIDE; |
75 virtual void OnWidgetBoundsChanged(Widget* widget, | 81 virtual void OnWidgetBoundsChanged(Widget* widget, |
76 const gfx::Rect& new_bounds) OVERRIDE; | 82 const gfx::Rect& new_bounds) OVERRIDE; |
77 | 83 |
78 // Overriden from ui::EventHandler. | 84 // Overriden from ui::EventHandler. |
79 virtual void OnKeyEvent(ui::KeyEvent* event) OVERRIDE; | 85 virtual void OnKeyEvent(ui::KeyEvent* event) OVERRIDE; |
80 virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE; | 86 virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 // Selection end points, clipped to client view's boundaries. | 131 // Selection end points, clipped to client view's boundaries. |
126 gfx::Rect selection_end_point_1_clipped_; | 132 gfx::Rect selection_end_point_1_clipped_; |
127 gfx::Rect selection_end_point_2_clipped_; | 133 gfx::Rect selection_end_point_2_clipped_; |
128 | 134 |
129 DISALLOW_COPY_AND_ASSIGN(TouchSelectionControllerImpl); | 135 DISALLOW_COPY_AND_ASSIGN(TouchSelectionControllerImpl); |
130 }; | 136 }; |
131 | 137 |
132 } // namespace views | 138 } // namespace views |
133 | 139 |
134 #endif // UI_UI_VIEWS_TOUCHUI_TOUCH_SELECTION_CONTROLLER_IMPL_H_ | 140 #endif // UI_UI_VIEWS_TOUCHUI_TOUCH_SELECTION_CONTROLLER_IMPL_H_ |
OLD | NEW |