OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 VIEWS_CONTROLS_TEXTFIELD_NATIVE_TEXTFIELD_WRAPPER_H_ | 5 #ifndef VIEWS_CONTROLS_TEXTFIELD_NATIVE_TEXTFIELD_WRAPPER_H_ |
6 #define VIEWS_CONTROLS_TEXTFIELD_NATIVE_TEXTFIELD_WRAPPER_H_ | 6 #define VIEWS_CONTROLS_TEXTFIELD_NATIVE_TEXTFIELD_WRAPPER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/string16.h" | 9 #include "base/string16.h" |
10 #include "ui/gfx/native_widget_types.h" | 10 #include "ui/gfx/native_widget_types.h" |
11 | 11 |
12 namespace gfx { | 12 namespace gfx { |
13 class Insets; | 13 class Insets; |
| 14 struct StyleRange; |
14 } // namespace gfx | 15 } // namespace gfx |
15 | 16 |
16 namespace ui { | 17 namespace ui { |
17 class Range; | 18 class Range; |
18 } // namespace ui | 19 } // namespace ui |
19 | 20 |
20 namespace views { | 21 namespace views { |
21 | 22 |
22 class KeyEvent; | 23 class KeyEvent; |
23 class Textfield; | 24 class Textfield; |
24 class TextInputClient; | 25 class TextInputClient; |
25 class TextStyle; | |
26 class View; | 26 class View; |
27 | 27 |
28 // An interface implemented by an object that provides a platform-native | 28 // An interface implemented by an object that provides a platform-native |
29 // text field. | 29 // text field. |
30 class NativeTextfieldWrapper { | 30 class NativeTextfieldWrapper { |
31 public: | 31 public: |
32 // The Textfield calls this when it is destroyed to clean up the wrapper | 32 // The Textfield calls this when it is destroyed to clean up the wrapper |
33 // object. | 33 // object. |
34 virtual ~NativeTextfieldWrapper() {} | 34 virtual ~NativeTextfieldWrapper() {} |
35 | 35 |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 | 119 |
120 // Invoked when focus is being moved from or to the Textfield. | 120 // Invoked when focus is being moved from or to the Textfield. |
121 // See also View::OnFocus/OnBlur. | 121 // See also View::OnFocus/OnBlur. |
122 virtual void HandleFocus() = 0; | 122 virtual void HandleFocus() = 0; |
123 virtual void HandleBlur() = 0; | 123 virtual void HandleBlur() = 0; |
124 | 124 |
125 // Returns the View's TextInputClient instance or NULL if the View doesn't | 125 // Returns the View's TextInputClient instance or NULL if the View doesn't |
126 // support text input. | 126 // support text input. |
127 virtual TextInputClient* GetTextInputClient() = 0; | 127 virtual TextInputClient* GetTextInputClient() = 0; |
128 | 128 |
129 // Creates a new TextStyle for this textfield. | 129 // Applies the |style| to the text specified by its range. |
130 // See |Textfield::CreateTextStyle| for detail. | 130 // See |Textfield::ApplyStyleRange| for detail. |
131 virtual TextStyle* CreateTextStyle() = 0; | 131 virtual void ApplyStyleRange(const gfx::StyleRange& style) = 0; |
132 | 132 |
133 // Applies the |style| to the text specified by the |range|. | 133 // Applies the default style to the textfield. |
134 // See |Textfield::ApplyTextStyle| for detail. | 134 virtual void ApplyDefaultStyle() = 0; |
135 virtual void ApplyTextStyle(const TextStyle* style, | |
136 const ui::Range& range) = 0; | |
137 | |
138 // Clears all text styles in this textfield. | |
139 virtual void ClearAllTextStyles() = 0; | |
140 | 135 |
141 // Clears Edit history. | 136 // Clears Edit history. |
142 virtual void ClearEditHistory() = 0; | 137 virtual void ClearEditHistory() = 0; |
143 | 138 |
144 // Creates an appropriate NativeTextfieldWrapper for the platform. | 139 // Creates an appropriate NativeTextfieldWrapper for the platform. |
145 static NativeTextfieldWrapper* CreateWrapper(Textfield* field); | 140 static NativeTextfieldWrapper* CreateWrapper(Textfield* field); |
146 }; | 141 }; |
147 | 142 |
148 } // namespace views | 143 } // namespace views |
149 | 144 |
150 #endif // VIEWS_CONTROLS_TEXTFIELD_NATIVE_TEXTFIELD_WRAPPER_H_ | 145 #endif // VIEWS_CONTROLS_TEXTFIELD_NATIVE_TEXTFIELD_WRAPPER_H_ |
OLD | NEW |