OLD | NEW |
---|---|
1 // Copyright (c) 2011 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_VIEWS_TOUCHUI_TOUCH_SELECTION_CONTROLLER_H_ | 5 #ifndef UI_BASE_TOUCH_TOUCH_EDITING_CONTROLLER_H_ |
6 #define UI_VIEWS_TOUCHUI_TOUCH_SELECTION_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/views/view.h" | 10 #include "ui/gfx/rect.h" |
11 | 11 |
12 namespace views { | 12 namespace ui { |
13 | 13 |
14 // An interface implemented by a View that has text that can be selected. | 14 // An interface implemented by a View that has text that can be selected/edited |
15 class VIEWS_EXPORT TouchSelectionClientView | 15 // using touch. |
16 : public View, | 16 class UI_EXPORT TouchSelectionClientView |
sadrul
2013/02/13 00:26:56
Is there going to be any non-views implementation
varunjain
2013/02/13 00:37:15
No non-views implementations. However, the View pr
varunjain
2013/02/13 00:52:12
Sorry.. I make mistake. RWHVA will implement this
| |
17 public ui::SimpleMenuModel::Delegate { | 17 : public ui::SimpleMenuModel::Delegate { |
18 public: | 18 public: |
19 // Select everything between start and end (points are in view's local | 19 // Select everything between start and end (points are in view's local |
20 // coordinate system). |start| is the logical start and |end| is the logical | 20 // coordinate system). |start| is the logical start and |end| is the logical |
21 // end of selection. Visually, |start| may lie after |end|. | 21 // end of selection. Visually, |start| may lie after |end|. |
22 virtual void SelectRect(const gfx::Point& start, const gfx::Point& end) = 0; | 22 virtual void SelectRect(const gfx::Point& start, const gfx::Point& end) = 0; |
23 | 23 |
24 // Gets the bounds of the client view in parent's coordinates. | |
25 virtual const gfx::Rect& GetBounds() = 0; | |
26 | |
27 // Gets the NativeView hosting the client. | |
28 virtual gfx::NativeView GetNativeView() = 0; | |
29 | |
30 // Converts a point to/from screen coordinates from/to client view. | |
31 virtual void ConvertPointToScreen(gfx::Point* point) = 0; | |
32 virtual void ConvertPointFromScreen(gfx::Point* point) = 0; | |
33 | |
24 protected: | 34 protected: |
25 virtual ~TouchSelectionClientView() {} | 35 virtual ~TouchSelectionClientView() {} |
26 }; | 36 }; |
27 | 37 |
28 // This defines the callback interface for other code to be notified of changes | 38 // This defines the callback interface for other code to be notified of changes |
29 // in the state of a TouchSelectionClientView. | 39 // in the state of a TouchSelectionClientView. |
30 class VIEWS_EXPORT TouchSelectionController { | 40 class UI_EXPORT TouchSelectionController { |
31 public: | 41 public: |
32 virtual ~TouchSelectionController() {} | 42 virtual ~TouchSelectionController() {} |
33 | 43 |
34 // Creates a TouchSelectionController. Caller owns the returned object. | 44 // Creates a TouchSelectionController. Caller owns the returned object. |
35 static TouchSelectionController* create( | 45 static TouchSelectionController* create( |
36 TouchSelectionClientView* client_view); | 46 TouchSelectionClientView* client_view); |
37 | 47 |
38 // Notification that the text selection in TouchSelectionClientView has | 48 // Notification that the text selection in TouchSelectionClientView has |
39 // changed. p1 and p2 are lower corners of the start and end of selection: | 49 // changed. p1 and p2 are lower corners of the start and end of selection: |
40 // ____________________________________ | 50 // ____________________________________ |
41 // | textfield with |selected text| | | 51 // | textfield with |selected text| | |
42 // ------------------------------------ | 52 // ------------------------------------ |
43 // ^p1 ^p2 | 53 // ^p1 ^p2 |
44 // | 54 // |
45 // p1 is always the start and p2 is always the end of selection. Hence, | 55 // p1 is always the start and p2 is always the end of selection. Hence, |
46 // p1 could be to the right of p2 in the figure above. | 56 // p1 could be to the right of p2 in the figure above. |
47 virtual void SelectionChanged(const gfx::Point& p1, const gfx::Point& p2) = 0; | 57 virtual void SelectionChanged(const gfx::Point& p1, const gfx::Point& p2) = 0; |
48 | 58 |
49 // Notification that the TouchSelectionClientView has lost focus. | 59 // Notification that the TouchSelectionClientView has lost focus. |
50 virtual void ClientViewLostFocus() = 0; | 60 virtual void ClientViewLostFocus() = 0; |
51 }; | 61 }; |
52 | 62 |
53 } // namespace views | 63 } // namespace views |
54 | 64 |
55 #endif // UI_VIEWS_TOUCHUI_TOUCH_SELECTION_CONTROLLER_H_ | 65 #endif // UI_BASE_TOUCH_TOUCH_EDITING_CONTROLLER_H_ |
OLD | NEW |