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 #include "views/views_export.h" | 11 #include "views/views_export.h" |
12 | 12 |
13 namespace gfx { | 13 namespace gfx { |
14 class Insets; | 14 class Insets; |
15 class SelectionModel; | 15 class SelectionModel; |
16 struct StyleRange; | 16 struct StyleRange; |
17 } // namespace gfx | 17 } // namespace gfx |
18 | 18 |
19 namespace ui { | 19 namespace ui { |
20 class Range; | 20 class Range; |
21 class TextInputClient; | |
22 } // namespace ui | 21 } // namespace ui |
23 | 22 |
24 namespace views { | 23 namespace views { |
25 | 24 |
26 class KeyEvent; | 25 class KeyEvent; |
27 class Textfield; | 26 class Textfield; |
| 27 class TextInputClient; |
28 class View; | 28 class View; |
29 | 29 |
30 // An interface implemented by an object that provides a platform-native | 30 // An interface implemented by an object that provides a platform-native |
31 // text field. | 31 // text field. |
32 class VIEWS_EXPORT NativeTextfieldWrapper { | 32 class VIEWS_EXPORT NativeTextfieldWrapper { |
33 public: | 33 public: |
34 // The Textfield calls this when it is destroyed to clean up the wrapper | 34 // The Textfield calls this when it is destroyed to clean up the wrapper |
35 // object. | 35 // object. |
36 virtual ~NativeTextfieldWrapper() {} | 36 virtual ~NativeTextfieldWrapper() {} |
37 | 37 |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 virtual bool HandleKeyPressed(const views::KeyEvent& e) = 0; | 125 virtual bool HandleKeyPressed(const views::KeyEvent& e) = 0; |
126 virtual bool HandleKeyReleased(const views::KeyEvent& e) = 0; | 126 virtual bool HandleKeyReleased(const views::KeyEvent& e) = 0; |
127 | 127 |
128 // Invoked when focus is being moved from or to the Textfield. | 128 // Invoked when focus is being moved from or to the Textfield. |
129 // See also View::OnFocus/OnBlur. | 129 // See also View::OnFocus/OnBlur. |
130 virtual void HandleFocus() = 0; | 130 virtual void HandleFocus() = 0; |
131 virtual void HandleBlur() = 0; | 131 virtual void HandleBlur() = 0; |
132 | 132 |
133 // Returns the View's TextInputClient instance or NULL if the View doesn't | 133 // Returns the View's TextInputClient instance or NULL if the View doesn't |
134 // support text input. | 134 // support text input. |
135 virtual ui::TextInputClient* GetTextInputClient() = 0; | 135 virtual TextInputClient* GetTextInputClient() = 0; |
136 | 136 |
137 // Applies the |style| to the text specified by its range. | 137 // Applies the |style| to the text specified by its range. |
138 // See |Textfield::ApplyStyleRange| for detail. | 138 // See |Textfield::ApplyStyleRange| for detail. |
139 virtual void ApplyStyleRange(const gfx::StyleRange& style) = 0; | 139 virtual void ApplyStyleRange(const gfx::StyleRange& style) = 0; |
140 | 140 |
141 // Applies the default style to the textfield. | 141 // Applies the default style to the textfield. |
142 virtual void ApplyDefaultStyle() = 0; | 142 virtual void ApplyDefaultStyle() = 0; |
143 | 143 |
144 // Clears Edit history. | 144 // Clears Edit history. |
145 virtual void ClearEditHistory() = 0; | 145 virtual void ClearEditHistory() = 0; |
146 | 146 |
147 // Creates an appropriate NativeTextfieldWrapper for the platform. | 147 // Creates an appropriate NativeTextfieldWrapper for the platform. |
148 static NativeTextfieldWrapper* CreateWrapper(Textfield* field); | 148 static NativeTextfieldWrapper* CreateWrapper(Textfield* field); |
149 }; | 149 }; |
150 | 150 |
151 } // namespace views | 151 } // namespace views |
152 | 152 |
153 #endif // VIEWS_CONTROLS_TEXTFIELD_NATIVE_TEXTFIELD_WRAPPER_H_ | 153 #endif // VIEWS_CONTROLS_TEXTFIELD_NATIVE_TEXTFIELD_WRAPPER_H_ |
OLD | NEW |