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_TEXTFIELD_H_ | 5 #ifndef UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_H_ |
6 #define UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_H_ | 6 #define UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "base/string16.h" | 12 #include "base/string16.h" |
13 #include "build/build_config.h" | 13 #include "build/build_config.h" |
14 #include "third_party/skia/include/core/SkColor.h" | 14 #include "third_party/skia/include/core/SkColor.h" |
15 #include "ui/base/ime/text_input_type.h" | 15 #include "ui/base/ime/text_input_type.h" |
16 #include "ui/base/keycodes/keyboard_codes.h" | 16 #include "ui/base/keycodes/keyboard_codes.h" |
17 #include "ui/gfx/font.h" | 17 #include "ui/gfx/font.h" |
18 #include "ui/gfx/native_widget_types.h" | 18 #include "ui/gfx/native_widget_types.h" |
| 19 #include "ui/gfx/text_constants.h" |
19 #include "ui/views/controls/textfield/native_textfield_wrapper.h" | 20 #include "ui/views/controls/textfield/native_textfield_wrapper.h" |
20 #include "ui/views/view.h" | 21 #include "ui/views/view.h" |
21 | 22 |
22 #if !defined(OS_LINUX) | 23 #if !defined(OS_LINUX) |
23 #include "base/logging.h" | 24 #include "base/logging.h" |
24 #endif | 25 #endif |
25 | 26 |
26 namespace gfx { | |
27 struct StyleRange; | |
28 } // namespace gfx | |
29 | |
30 namespace ui { | 27 namespace ui { |
31 class Range; | 28 class Range; |
32 class TextInputClient; | 29 class TextInputClient; |
33 } // namespace ui | 30 } // namespace ui |
34 | 31 |
35 namespace views { | 32 namespace views { |
36 | 33 |
37 class TextfieldController; | 34 class TextfieldController; |
38 | 35 |
39 // This class implements a View that wraps a native text (edit) field. | 36 // This class implements a View that wraps a native text (edit) field. |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 void GetSelectionModel(gfx::SelectionModel* sel) const; | 199 void GetSelectionModel(gfx::SelectionModel* sel) const; |
203 | 200 |
204 // Selects the text given by |sel|. This is views-implementation only and | 201 // Selects the text given by |sel|. This is views-implementation only and |
205 // has to be called after the wrapper is created. | 202 // has to be called after the wrapper is created. |
206 void SelectSelectionModel(const gfx::SelectionModel& sel); | 203 void SelectSelectionModel(const gfx::SelectionModel& sel); |
207 | 204 |
208 // Returns the current cursor position. This is views-implementation | 205 // Returns the current cursor position. This is views-implementation |
209 // only and has to be called after the wrapper is created. | 206 // only and has to be called after the wrapper is created. |
210 size_t GetCursorPosition() const; | 207 size_t GetCursorPosition() const; |
211 | 208 |
212 // Applies |style| to the text specified by its range. The style will be | 209 // Set the text color over the entire text or a logical character range. |
213 // ignored if range is empty or invalid. This is views-implementation only and | 210 // Empty and invalid ranges are ignored. This is views-implementation only and |
214 // has to be called after the wrapper is created. | 211 // has to be called after the wrapper is created. |
215 void ApplyStyleRange(const gfx::StyleRange& style); | 212 void SetColor(SkColor value); |
| 213 void ApplyColor(SkColor value, const ui::Range& range); |
216 | 214 |
217 // Applies the default style to the textfield. This is views-implementation | 215 // Set various text styles over the entire text or a logical character range. |
218 // only and has to be called after the wrapper is created. | 216 // The respective |style| is applied if |value| is true, or removed if false. |
219 void ApplyDefaultStyle(); | 217 // Empty and invalid ranges are ignored. This is views-implementation only and |
| 218 // has to be called after the wrapper is created. |
| 219 void SetStyle(gfx::TextStyle style, bool value); |
| 220 void ApplyStyle(gfx::TextStyle style, bool value, const ui::Range& range); |
220 | 221 |
221 // Clears Edit history. | 222 // Clears Edit history. |
222 void ClearEditHistory(); | 223 void ClearEditHistory(); |
223 | 224 |
224 // Set the accessible name of the text field. | 225 // Set the accessible name of the text field. |
225 void SetAccessibleName(const string16& name); | 226 void SetAccessibleName(const string16& name); |
226 | 227 |
227 // Performs the action associated with the specified command id. | 228 // Performs the action associated with the specified command id. |
228 void ExecuteCommand(int command_id); | 229 void ExecuteCommand(int command_id); |
229 | 230 |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 | 323 |
323 // The input type of this text field. | 324 // The input type of this text field. |
324 ui::TextInputType text_input_type_; | 325 ui::TextInputType text_input_type_; |
325 | 326 |
326 DISALLOW_COPY_AND_ASSIGN(Textfield); | 327 DISALLOW_COPY_AND_ASSIGN(Textfield); |
327 }; | 328 }; |
328 | 329 |
329 } // namespace views | 330 } // namespace views |
330 | 331 |
331 #endif // UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_H_ | 332 #endif // UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_H_ |
OLD | NEW |