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/string16.h" | 8 #include "base/string16.h" |
9 #include "base/i18n/rtl.h" | 9 #include "base/i18n/rtl.h" |
10 #include "ui/gfx/native_widget_types.h" | 10 #include "ui/gfx/native_widget_types.h" |
| 11 #include "ui/gfx/text_constants.h" |
11 #include "ui/views/views_export.h" | 12 #include "ui/views/views_export.h" |
12 | 13 |
13 namespace gfx { | 14 namespace gfx { |
14 class Insets; | 15 class Insets; |
15 class SelectionModel; | 16 class SelectionModel; |
16 struct StyleRange; | |
17 } // namespace gfx | 17 } // namespace gfx |
18 | 18 |
19 namespace ui { | 19 namespace ui { |
20 class KeyEvent; | 20 class KeyEvent; |
21 class Range; | 21 class Range; |
22 class TextInputClient; | 22 class TextInputClient; |
23 } // namespace ui | 23 } // namespace ui |
24 | 24 |
25 namespace views { | 25 namespace views { |
26 | 26 |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 | 141 |
142 // Invoked when focus is being moved from or to the Textfield. | 142 // Invoked when focus is being moved from or to the Textfield. |
143 // See also View::OnFocus/OnBlur. | 143 // See also View::OnFocus/OnBlur. |
144 virtual void HandleFocus() = 0; | 144 virtual void HandleFocus() = 0; |
145 virtual void HandleBlur() = 0; | 145 virtual void HandleBlur() = 0; |
146 | 146 |
147 // Returns the View's TextInputClient instance or NULL if the View doesn't | 147 // Returns the View's TextInputClient instance or NULL if the View doesn't |
148 // support text input. | 148 // support text input. |
149 virtual ui::TextInputClient* GetTextInputClient() = 0; | 149 virtual ui::TextInputClient* GetTextInputClient() = 0; |
150 | 150 |
151 // Applies the |style| to the text specified by its range. | 151 // Set the text colors; see the corresponding Textfield functions for details. |
152 // See |Textfield::ApplyStyleRange| for detail. | 152 virtual void SetColor(SkColor value) = 0; |
153 virtual void ApplyStyleRange(const gfx::StyleRange& style) = 0; | 153 virtual void ApplyColor(SkColor value, const ui::Range& range) = 0; |
154 | 154 |
155 // Applies the default style to the textfield. | 155 // Set the text styles; see the corresponding Textfield functions for details. |
156 virtual void ApplyDefaultStyle() = 0; | 156 virtual void SetStyle(gfx::TextStyle style, bool value) = 0; |
| 157 virtual void ApplyStyle(gfx::TextStyle style, |
| 158 bool value, |
| 159 const ui::Range& range) = 0; |
157 | 160 |
158 // Clears Edit history. | 161 // Clears Edit history. |
159 virtual void ClearEditHistory() = 0; | 162 virtual void ClearEditHistory() = 0; |
160 | 163 |
161 // Get the height in pixels of the first font used in this textfield. | 164 // Get the height in pixels of the first font used in this textfield. |
162 virtual int GetFontHeight() = 0; | 165 virtual int GetFontHeight() = 0; |
163 | 166 |
164 // Returns the baseline of the textfield. This should not take into account | 167 // Returns the baseline of the textfield. This should not take into account |
165 // any insets. | 168 // any insets. |
166 virtual int GetTextfieldBaseline() const = 0; | 169 virtual int GetTextfieldBaseline() const = 0; |
167 | 170 |
168 // Performs the action associated with the specified command id. Not called | 171 // Performs the action associated with the specified command id. Not called |
169 // ExecuteCommand to avoid name clash. | 172 // ExecuteCommand to avoid name clash. |
170 virtual void ExecuteTextCommand(int command_id) = 0; | 173 virtual void ExecuteTextCommand(int command_id) = 0; |
171 | 174 |
172 // Creates an appropriate NativeTextfieldWrapper for the platform. | 175 // Creates an appropriate NativeTextfieldWrapper for the platform. |
173 static NativeTextfieldWrapper* CreateWrapper(Textfield* field); | 176 static NativeTextfieldWrapper* CreateWrapper(Textfield* field); |
174 }; | 177 }; |
175 | 178 |
176 } // namespace views | 179 } // namespace views |
177 | 180 |
178 #endif // UI_VIEWS_CONTROLS_TEXTFIELD_NATIVE_TEXTFIELD_WRAPPER_H_ | 181 #endif // UI_VIEWS_CONTROLS_TEXTFIELD_NATIVE_TEXTFIELD_WRAPPER_H_ |
OLD | NEW |