| 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 | 9 |
| 10 namespace gfx { | 10 namespace gfx { |
| 11 class Point; | 11 class Point; |
| 12 class Rect; | 12 class Rect; |
| 13 class SelectionBound; |
| 13 } | 14 } |
| 14 | 15 |
| 15 namespace ui { | 16 namespace ui { |
| 16 class SelectionBound; | |
| 17 | 17 |
| 18 // 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 |
| 19 // using touch. | 19 // using touch. |
| 20 class UI_BASE_EXPORT TouchEditable : public ui::SimpleMenuModel::Delegate { | 20 class UI_BASE_EXPORT TouchEditable : public ui::SimpleMenuModel::Delegate { |
| 21 public: | 21 public: |
| 22 // TODO(mohsen): Consider switching from local coordinates to screen | 22 // TODO(mohsen): Consider switching from local coordinates to screen |
| 23 // coordinates in this interface and see if it will simplify things. | 23 // coordinates in this interface and see if it will simplify things. |
| 24 | 24 |
| 25 // 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 |
| 26 // 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 |
| 27 // end of selection. Visually, |start| may lie after |end|. | 27 // end of selection. Visually, |start| may lie after |end|. |
| 28 virtual void SelectRect(const gfx::Point& start, const gfx::Point& end) = 0; | 28 virtual void SelectRect(const gfx::Point& start, const gfx::Point& end) = 0; |
| 29 | 29 |
| 30 // Move the caret to |point|. |point| is in local coordinates. | 30 // Move the caret to |point|. |point| is in local coordinates. |
| 31 virtual void MoveCaretTo(const gfx::Point& point) = 0; | 31 virtual void MoveCaretTo(const gfx::Point& point) = 0; |
| 32 | 32 |
| 33 // Gets the end points of the current selection. The end points |anchor| and | 33 // Gets the end points of the current selection. The end points |anchor| and |
| 34 // |focus| must be the cursor rect for the logical start and logical end of | 34 // |focus| must be the cursor rect for the logical start and logical end of |
| 35 // selection (in local coordinates): | 35 // selection (in local coordinates): |
| 36 // ____________________________________ | 36 // ____________________________________ |
| 37 // | textfield with |selected text| | | 37 // | textfield with |selected text| | |
| 38 // ------------------------------------ | 38 // ------------------------------------ |
| 39 // ^anchor ^focus | 39 // ^anchor ^focus |
| 40 // | 40 // |
| 41 // Visually, anchor could be to the right of focus in the figure above - it | 41 // Visually, anchor could be to the right of focus in the figure above - it |
| 42 // depends on the selection direction. | 42 // depends on the selection direction. |
| 43 virtual void GetSelectionEndPoints(ui::SelectionBound* anchor, | 43 virtual void GetSelectionEndPoints(gfx::SelectionBound* anchor, |
| 44 ui::SelectionBound* focus) = 0; | 44 gfx::SelectionBound* focus) = 0; |
| 45 | 45 |
| 46 // Gets the bounds of the client view in its local coordinates. | 46 // Gets the bounds of the client view in its local coordinates. |
| 47 virtual gfx::Rect GetBounds() = 0; | 47 virtual gfx::Rect GetBounds() = 0; |
| 48 | 48 |
| 49 // Gets the NativeView hosting the client. | 49 // Gets the NativeView hosting the client. |
| 50 virtual gfx::NativeView GetNativeView() const = 0; | 50 virtual gfx::NativeView GetNativeView() const = 0; |
| 51 | 51 |
| 52 // Converts a point to/from screen coordinates from/to client view. | 52 // Converts a point to/from screen coordinates from/to client view. |
| 53 virtual void ConvertPointToScreen(gfx::Point* point) = 0; | 53 virtual void ConvertPointToScreen(gfx::Point* point) = 0; |
| 54 virtual void ConvertPointFromScreen(gfx::Point* point) = 0; | 54 virtual void ConvertPointFromScreen(gfx::Point* point) = 0; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 virtual TouchEditingControllerDeprecated* Create(TouchEditable* client_view) | 97 virtual TouchEditingControllerDeprecated* Create(TouchEditable* client_view) |
| 98 = 0; | 98 = 0; |
| 99 | 99 |
| 100 protected: | 100 protected: |
| 101 virtual ~TouchEditingControllerFactory() {} | 101 virtual ~TouchEditingControllerFactory() {} |
| 102 }; | 102 }; |
| 103 | 103 |
| 104 } // namespace ui | 104 } // namespace ui |
| 105 | 105 |
| 106 #endif // UI_BASE_TOUCH_TOUCH_EDITING_CONTROLLER_H_ | 106 #endif // UI_BASE_TOUCH_TOUCH_EDITING_CONTROLLER_H_ |
| OLD | NEW |