Index: ui/base/touch/touch_editing_controller.h |
diff --git a/ui/views/touchui/touch_selection_controller.h b/ui/base/touch/touch_editing_controller.h |
similarity index 54% |
rename from ui/views/touchui/touch_selection_controller.h |
rename to ui/base/touch/touch_editing_controller.h |
index a9a6338025d3bb87239261f1d87537f1b6c4205f..999c2ad3b5f60eb025d6ee581047ccd8752bf8a4 100644 |
--- a/ui/views/touchui/touch_selection_controller.h |
+++ b/ui/base/touch/touch_editing_controller.h |
@@ -1,41 +1,50 @@ |
-// Copyright (c) 2011 The Chromium Authors. All rights reserved. |
+// Copyright (c) 2013 The Chromium Authors. All rights reserved. |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-#ifndef UI_VIEWS_TOUCHUI_TOUCH_SELECTION_CONTROLLER_H_ |
-#define UI_VIEWS_TOUCHUI_TOUCH_SELECTION_CONTROLLER_H_ |
+#ifndef UI_BASE_TOUCH_TOUCH_EDITING_CONTROLLER_H_ |
+#define UI_BASE_TOUCH_TOUCH_EDITING_CONTROLLER_H_ |
#include "ui/base/models/simple_menu_model.h" |
#include "ui/gfx/point.h" |
-#include "ui/views/view.h" |
+#include "ui/gfx/rect.h" |
-namespace views { |
+namespace ui { |
-// An interface implemented by a View that has text that can be selected. |
-class VIEWS_EXPORT TouchSelectionClientView |
- : public View, |
- public ui::SimpleMenuModel::Delegate { |
+// An interface implemented by widget that has text that can be selected/edited |
+// using touch. |
+class UI_EXPORT TouchEditable : public ui::SimpleMenuModel::Delegate { |
public: |
// Select everything between start and end (points are in view's local |
// coordinate system). |start| is the logical start and |end| is the logical |
// end of selection. Visually, |start| may lie after |end|. |
virtual void SelectRect(const gfx::Point& start, const gfx::Point& end) = 0; |
+ // Gets the bounds of the client view in parent's coordinates. |
+ virtual const gfx::Rect& GetBounds() = 0; |
+ |
+ // Gets the NativeView hosting the client. |
+ virtual gfx::NativeView GetNativeView() = 0; |
+ |
+ // Converts a point to/from screen coordinates from/to client view. |
+ virtual void ConvertPointToScreen(gfx::Point* point) = 0; |
+ virtual void ConvertPointFromScreen(gfx::Point* point) = 0; |
+ |
protected: |
- virtual ~TouchSelectionClientView() {} |
+ virtual ~TouchEditable() {} |
}; |
// This defines the callback interface for other code to be notified of changes |
-// in the state of a TouchSelectionClientView. |
-class VIEWS_EXPORT TouchSelectionController { |
+// in the state of a TouchEditable. |
+class UI_EXPORT TouchSelectionController { |
public: |
virtual ~TouchSelectionController() {} |
// Creates a TouchSelectionController. Caller owns the returned object. |
static TouchSelectionController* create( |
- TouchSelectionClientView* client_view); |
+ TouchEditable* client_view); |
- // Notification that the text selection in TouchSelectionClientView has |
+ // Notification that the text selection in TouchEditable has |
// changed. p1 and p2 are lower corners of the start and end of selection: |
// ____________________________________ |
// | textfield with |selected text| | |
@@ -46,10 +55,10 @@ class VIEWS_EXPORT TouchSelectionController { |
// p1 could be to the right of p2 in the figure above. |
virtual void SelectionChanged(const gfx::Point& p1, const gfx::Point& p2) = 0; |
- // Notification that the TouchSelectionClientView has lost focus. |
+ // Notification that the TouchEditable has lost focus. |
virtual void ClientViewLostFocus() = 0; |
}; |
} // namespace views |
-#endif // UI_VIEWS_TOUCHUI_TOUCH_SELECTION_CONTROLLER_H_ |
+#endif // UI_BASE_TOUCH_TOUCH_EDITING_CONTROLLER_H_ |