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_BASE_TOUCH_TOUCH_EDITING_CONTROLLER_H_ | 5 #ifndef UI_BASE_TOUCH_TOUCH_EDITING_CONTROLLER_H_ |
6 #define UI_BASE_TOUCH_TOUCH_EDITING_CONTROLLER_H_ | 6 #define UI_BASE_TOUCH_TOUCH_EDITING_CONTROLLER_H_ |
7 | 7 |
8 #include "ui/base/models/simple_menu_model.h" | 8 #include "ui/base/models/simple_menu_model.h" |
9 #include "ui/gfx/point.h" | 9 #include "ui/gfx/point.h" |
10 #include "ui/gfx/rect.h" | 10 #include "ui/gfx/rect.h" |
11 | 11 |
12 namespace ui { | 12 namespace ui { |
13 | 13 |
14 // An interface implemented by widget that has text that can be selected/edited | 14 // An interface implemented by widget that has text that can be selected/edited |
15 // using touch. | 15 // using touch. |
16 class UI_EXPORT TouchEditable : public ui::SimpleMenuModel::Delegate { | 16 class UI_BASE_EXPORT TouchEditable : public ui::SimpleMenuModel::Delegate { |
17 public: | 17 public: |
18 // Select everything between start and end (points are in view's local | 18 // Select everything between start and end (points are in view's local |
19 // coordinate system). |start| is the logical start and |end| is the logical | 19 // coordinate system). |start| is the logical start and |end| is the logical |
20 // end of selection. Visually, |start| may lie after |end|. | 20 // end of selection. Visually, |start| may lie after |end|. |
21 virtual void SelectRect(const gfx::Point& start, const gfx::Point& end) = 0; | 21 virtual void SelectRect(const gfx::Point& start, const gfx::Point& end) = 0; |
22 | 22 |
23 // Move the caret to |point|. |point| is in local coordinates. | 23 // Move the caret to |point|. |point| is in local coordinates. |
24 virtual void MoveCaretTo(const gfx::Point& point) = 0; | 24 virtual void MoveCaretTo(const gfx::Point& point) = 0; |
25 | 25 |
26 // Gets the end points of the current selection. The end points p1 and p2 must | 26 // Gets the end points of the current selection. The end points p1 and p2 must |
(...skipping 23 matching lines...) Expand all Loading... |
50 | 50 |
51 // Tells the editable to open context menu. | 51 // Tells the editable to open context menu. |
52 virtual void OpenContextMenu(const gfx::Point& anchor) = 0; | 52 virtual void OpenContextMenu(const gfx::Point& anchor) = 0; |
53 | 53 |
54 protected: | 54 protected: |
55 virtual ~TouchEditable() {} | 55 virtual ~TouchEditable() {} |
56 }; | 56 }; |
57 | 57 |
58 // This defines the callback interface for other code to be notified of changes | 58 // This defines the callback interface for other code to be notified of changes |
59 // in the state of a TouchEditable. | 59 // in the state of a TouchEditable. |
60 class UI_EXPORT TouchSelectionController { | 60 class UI_BASE_EXPORT TouchSelectionController { |
61 public: | 61 public: |
62 virtual ~TouchSelectionController() {} | 62 virtual ~TouchSelectionController() {} |
63 | 63 |
64 // Creates a TouchSelectionController. Caller owns the returned object. | 64 // Creates a TouchSelectionController. Caller owns the returned object. |
65 static TouchSelectionController* create( | 65 static TouchSelectionController* create( |
66 TouchEditable* client_view); | 66 TouchEditable* client_view); |
67 | 67 |
68 // Notifies the controller that the selection has changed. | 68 // Notifies the controller that the selection has changed. |
69 virtual void SelectionChanged() = 0; | 69 virtual void SelectionChanged() = 0; |
70 | 70 |
71 // Returns true if the user is currently dragging one of the handles. | 71 // Returns true if the user is currently dragging one of the handles. |
72 virtual bool IsHandleDragInProgress() = 0; | 72 virtual bool IsHandleDragInProgress() = 0; |
73 }; | 73 }; |
74 | 74 |
75 class UI_EXPORT TouchSelectionControllerFactory { | 75 class UI_BASE_EXPORT TouchSelectionControllerFactory { |
76 public: | 76 public: |
77 static void SetInstance(TouchSelectionControllerFactory* instance); | 77 static void SetInstance(TouchSelectionControllerFactory* instance); |
78 | 78 |
79 virtual TouchSelectionController* create(TouchEditable* client_view) = 0; | 79 virtual TouchSelectionController* create(TouchEditable* client_view) = 0; |
80 | 80 |
81 protected: | 81 protected: |
82 virtual ~TouchSelectionControllerFactory() {} | 82 virtual ~TouchSelectionControllerFactory() {} |
83 }; | 83 }; |
84 | 84 |
85 } // namespace views | 85 } // namespace views |
86 | 86 |
87 #endif // UI_BASE_TOUCH_TOUCH_EDITING_CONTROLLER_H_ | 87 #endif // UI_BASE_TOUCH_TOUCH_EDITING_CONTROLLER_H_ |
OLD | NEW |