| 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 |
| 10 #include "ui/gfx/rect.h" | 10 namespace gfx { |
| 11 class Point; |
| 12 class Rect; |
| 13 } |
| 11 | 14 |
| 12 namespace ui { | 15 namespace ui { |
| 13 | 16 class SelectionBound; |
| 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 | 17 |
| 44 // An interface implemented by widget that has text that can be selected/edited | 18 // An interface implemented by widget that has text that can be selected/edited |
| 45 // using touch. | 19 // using touch. |
| 46 class UI_BASE_EXPORT TouchEditable : public ui::SimpleMenuModel::Delegate { | 20 class UI_BASE_EXPORT TouchEditable : public ui::SimpleMenuModel::Delegate { |
| 47 public: | 21 public: |
| 48 // TODO(mohsen): Consider switching from local coordinates to screen | 22 // TODO(mohsen): Consider switching from local coordinates to screen |
| 49 // coordinates in this interface and see if it will simplify things. | 23 // coordinates in this interface and see if it will simplify things. |
| 50 | 24 |
| 51 // Select everything between start and end (points are in view's local | 25 // 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 | 26 // coordinate system). |start| is the logical start and |end| is the logical |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 | 95 |
| 122 virtual TouchSelectionController* create(TouchEditable* client_view) = 0; | 96 virtual TouchSelectionController* create(TouchEditable* client_view) = 0; |
| 123 | 97 |
| 124 protected: | 98 protected: |
| 125 virtual ~TouchSelectionControllerFactory() {} | 99 virtual ~TouchSelectionControllerFactory() {} |
| 126 }; | 100 }; |
| 127 | 101 |
| 128 } // namespace ui | 102 } // namespace ui |
| 129 | 103 |
| 130 #endif // UI_BASE_TOUCH_TOUCH_EDITING_CONTROLLER_H_ | 104 #endif // UI_BASE_TOUCH_TOUCH_EDITING_CONTROLLER_H_ |
| OLD | NEW |