OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_CONTROLS_TEXTFIELD_NATIVE_TEXTFIELD_WRAPPER_H_ | 5 #ifndef UI_VIEWS_CONTROLS_TEXTFIELD_NATIVE_TEXTFIELD_WRAPPER_H_ |
6 #define UI_VIEWS_CONTROLS_TEXTFIELD_NATIVE_TEXTFIELD_WRAPPER_H_ | 6 #define UI_VIEWS_CONTROLS_TEXTFIELD_NATIVE_TEXTFIELD_WRAPPER_H_ |
7 | 7 |
8 #include "base/i18n/rtl.h" | 8 #include "base/i18n/rtl.h" |
9 #include "base/strings/string16.h" | 9 #include "base/strings/string16.h" |
10 #include "ui/base/range/range.h" | |
11 #include "ui/gfx/native_widget_types.h" | 10 #include "ui/gfx/native_widget_types.h" |
| 11 #include "ui/gfx/range/range.h" |
12 #include "ui/gfx/selection_model.h" | 12 #include "ui/gfx/selection_model.h" |
13 #include "ui/gfx/text_constants.h" | 13 #include "ui/gfx/text_constants.h" |
14 #include "ui/views/views_export.h" | 14 #include "ui/views/views_export.h" |
15 | 15 |
16 namespace gfx { | 16 namespace gfx { |
17 class Insets; | 17 class Insets; |
18 } // namespace gfx | 18 } // namespace gfx |
19 | 19 |
20 namespace ui { | 20 namespace ui { |
21 class KeyEvent; | 21 class KeyEvent; |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 // Retrieves the views::View that hosts the native control. | 102 // Retrieves the views::View that hosts the native control. |
103 virtual View* GetView() = 0; | 103 virtual View* GetView() = 0; |
104 | 104 |
105 // Returns a handle to the underlying native view for testing. | 105 // Returns a handle to the underlying native view for testing. |
106 virtual gfx::NativeView GetTestingHandle() const = 0; | 106 virtual gfx::NativeView GetTestingHandle() const = 0; |
107 | 107 |
108 // Returns whether or not an IME is composing text. | 108 // Returns whether or not an IME is composing text. |
109 virtual bool IsIMEComposing() const = 0; | 109 virtual bool IsIMEComposing() const = 0; |
110 | 110 |
111 // Gets the selected range. | 111 // Gets the selected range. |
112 virtual ui::Range GetSelectedRange() const = 0; | 112 virtual gfx::Range GetSelectedRange() const = 0; |
113 | 113 |
114 // Selects the text given by |range|. | 114 // Selects the text given by |range|. |
115 virtual void SelectRange(const ui::Range& range) = 0; | 115 virtual void SelectRange(const gfx::Range& range) = 0; |
116 | 116 |
117 // Gets the selection model. | 117 // Gets the selection model. |
118 virtual gfx::SelectionModel GetSelectionModel() const = 0; | 118 virtual gfx::SelectionModel GetSelectionModel() const = 0; |
119 | 119 |
120 // Selects the text given by |sel|. | 120 // Selects the text given by |sel|. |
121 virtual void SelectSelectionModel(const gfx::SelectionModel& sel) = 0; | 121 virtual void SelectSelectionModel(const gfx::SelectionModel& sel) = 0; |
122 | 122 |
123 // Returns the currnet cursor position. | 123 // Returns the currnet cursor position. |
124 virtual size_t GetCursorPosition() const = 0; | 124 virtual size_t GetCursorPosition() const = 0; |
125 | 125 |
(...skipping 16 matching lines...) Expand all Loading... |
142 // See also View::OnFocus/OnBlur. | 142 // See also View::OnFocus/OnBlur. |
143 virtual void HandleFocus() = 0; | 143 virtual void HandleFocus() = 0; |
144 virtual void HandleBlur() = 0; | 144 virtual void HandleBlur() = 0; |
145 | 145 |
146 // Returns the View's TextInputClient instance or NULL if the View doesn't | 146 // Returns the View's TextInputClient instance or NULL if the View doesn't |
147 // support text input. | 147 // support text input. |
148 virtual ui::TextInputClient* GetTextInputClient() = 0; | 148 virtual ui::TextInputClient* GetTextInputClient() = 0; |
149 | 149 |
150 // Set the text colors; see the corresponding Textfield functions for details. | 150 // Set the text colors; see the corresponding Textfield functions for details. |
151 virtual void SetColor(SkColor value) = 0; | 151 virtual void SetColor(SkColor value) = 0; |
152 virtual void ApplyColor(SkColor value, const ui::Range& range) = 0; | 152 virtual void ApplyColor(SkColor value, const gfx::Range& range) = 0; |
153 | 153 |
154 // Set the text styles; see the corresponding Textfield functions for details. | 154 // Set the text styles; see the corresponding Textfield functions for details. |
155 virtual void SetStyle(gfx::TextStyle style, bool value) = 0; | 155 virtual void SetStyle(gfx::TextStyle style, bool value) = 0; |
156 virtual void ApplyStyle(gfx::TextStyle style, | 156 virtual void ApplyStyle(gfx::TextStyle style, |
157 bool value, | 157 bool value, |
158 const ui::Range& range) = 0; | 158 const gfx::Range& range) = 0; |
159 | 159 |
160 // Clears Edit history. | 160 // Clears Edit history. |
161 virtual void ClearEditHistory() = 0; | 161 virtual void ClearEditHistory() = 0; |
162 | 162 |
163 // Get the height in pixels of the first font used in this textfield. | 163 // Get the height in pixels of the first font used in this textfield. |
164 virtual int GetFontHeight() = 0; | 164 virtual int GetFontHeight() = 0; |
165 | 165 |
166 // Returns the baseline of the textfield. This should not take into account | 166 // Returns the baseline of the textfield. This should not take into account |
167 // any insets. | 167 // any insets. |
168 virtual int GetTextfieldBaseline() const = 0; | 168 virtual int GetTextfieldBaseline() const = 0; |
169 | 169 |
170 // Returns the width necessary to display the current text, including any | 170 // Returns the width necessary to display the current text, including any |
171 // necessary space for the cursor or border/margin. | 171 // necessary space for the cursor or border/margin. |
172 virtual int GetWidthNeededForText() const = 0; | 172 virtual int GetWidthNeededForText() const = 0; |
173 | 173 |
174 // Performs the action associated with the specified command id. Not called | 174 // Performs the action associated with the specified command id. Not called |
175 // ExecuteCommand to avoid name clash. | 175 // ExecuteCommand to avoid name clash. |
176 virtual void ExecuteTextCommand(int command_id) = 0; | 176 virtual void ExecuteTextCommand(int command_id) = 0; |
177 | 177 |
178 // Returns whether there is a drag operation originating from the textfield. | 178 // Returns whether there is a drag operation originating from the textfield. |
179 virtual bool HasTextBeingDragged() = 0; | 179 virtual bool HasTextBeingDragged() = 0; |
180 | 180 |
181 // Creates an appropriate NativeTextfieldWrapper for the platform. | 181 // Creates an appropriate NativeTextfieldWrapper for the platform. |
182 static NativeTextfieldWrapper* CreateWrapper(Textfield* field); | 182 static NativeTextfieldWrapper* CreateWrapper(Textfield* field); |
183 }; | 183 }; |
184 | 184 |
185 } // namespace views | 185 } // namespace views |
186 | 186 |
187 #endif // UI_VIEWS_CONTROLS_TEXTFIELD_NATIVE_TEXTFIELD_WRAPPER_H_ | 187 #endif // UI_VIEWS_CONTROLS_TEXTFIELD_NATIVE_TEXTFIELD_WRAPPER_H_ |
OLD | NEW |