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/base/touch/selection_bound.h" | |
mfomitchev
2014/12/01 21:36:24
Declare class here and move include to cc?
mohsen
2014/12/02 05:17:02
Done.
| |
9 #include "ui/gfx/point.h" | 10 #include "ui/gfx/point.h" |
10 #include "ui/gfx/rect.h" | 11 #include "ui/gfx/rect.h" |
11 | 12 |
12 namespace ui { | 13 namespace ui { |
13 | 14 |
14 // Bound of a selected region. | |
15 struct UI_BASE_EXPORT SelectionBound { | |
16 public: | |
17 enum Type { | |
18 LEFT, | |
19 RIGHT, | |
20 CENTER, | |
21 EMPTY, | |
22 LAST = EMPTY | |
23 }; | |
24 | |
25 SelectionBound(); | |
26 ~SelectionBound(); | |
27 | |
28 int GetHeight() const; | |
29 | |
30 Type type; | |
31 | |
32 gfx::Point edge_top; | |
33 gfx::Point edge_bottom; | |
34 }; | |
35 | |
36 UI_BASE_EXPORT bool operator==(const SelectionBound& lhs, | |
37 const SelectionBound& rhs); | |
38 UI_BASE_EXPORT bool operator!=(const SelectionBound& lhs, | |
39 const SelectionBound& rhs); | |
40 | |
41 UI_BASE_EXPORT gfx::Rect RectBetweenSelectionBounds(const SelectionBound& b1, | |
42 const SelectionBound& b2); | |
43 | |
44 // An interface implemented by widget that has text that can be selected/edited | 15 // An interface implemented by widget that has text that can be selected/edited |
45 // using touch. | 16 // using touch. |
46 class UI_BASE_EXPORT TouchEditable : public ui::SimpleMenuModel::Delegate { | 17 class UI_BASE_EXPORT TouchEditable : public ui::SimpleMenuModel::Delegate { |
47 public: | 18 public: |
48 // TODO(mohsen): Consider switching from local coordinates to screen | 19 // TODO(mohsen): Consider switching from local coordinates to screen |
49 // coordinates in this interface and see if it will simplify things. | 20 // coordinates in this interface and see if it will simplify things. |
50 | 21 |
51 // Select everything between start and end (points are in view's local | 22 // Select everything between start and end (points are in view's local |
52 // coordinate system). |start| is the logical start and |end| is the logical | 23 // coordinate system). |start| is the logical start and |end| is the logical |
53 // end of selection. Visually, |start| may lie after |end|. | 24 // end of selection. Visually, |start| may lie after |end|. |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
121 | 92 |
122 virtual TouchSelectionController* create(TouchEditable* client_view) = 0; | 93 virtual TouchSelectionController* create(TouchEditable* client_view) = 0; |
123 | 94 |
124 protected: | 95 protected: |
125 virtual ~TouchSelectionControllerFactory() {} | 96 virtual ~TouchSelectionControllerFactory() {} |
126 }; | 97 }; |
127 | 98 |
128 } // namespace ui | 99 } // namespace ui |
129 | 100 |
130 #endif // UI_BASE_TOUCH_TOUCH_EDITING_CONTROLLER_H_ | 101 #endif // UI_BASE_TOUCH_TOUCH_EDITING_CONTROLLER_H_ |
OLD | NEW |