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 } // namespace gfx | 14 } // namespace gfx |
15 | 15 |
16 namespace ui { | 16 namespace ui { |
17 class Range; | 17 class Range; |
18 } // namespace ui | 18 } // namespace ui |
19 | 19 |
20 namespace views { | 20 namespace views { |
21 | 21 |
22 class KeyEvent; | 22 class KeyEvent; |
23 class Textfield; | 23 class Textfield; |
| 24 class TextInputClient; |
24 class View; | 25 class View; |
25 | 26 |
26 // An interface implemented by an object that provides a platform-native | 27 // An interface implemented by an object that provides a platform-native |
27 // text field. | 28 // text field. |
28 class NativeTextfieldWrapper { | 29 class NativeTextfieldWrapper { |
29 public: | 30 public: |
30 // The Textfield calls this when it is destroyed to clean up the wrapper | 31 // The Textfield calls this when it is destroyed to clean up the wrapper |
31 // object. | 32 // object. |
32 virtual ~NativeTextfieldWrapper() {} | 33 virtual ~NativeTextfieldWrapper() {} |
33 | 34 |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 // otherwise. | 114 // otherwise. |
114 // See also View::OnKeyPressed/OnKeyReleased. | 115 // See also View::OnKeyPressed/OnKeyReleased. |
115 virtual bool HandleKeyPressed(const views::KeyEvent& e) = 0; | 116 virtual bool HandleKeyPressed(const views::KeyEvent& e) = 0; |
116 virtual bool HandleKeyReleased(const views::KeyEvent& e) = 0; | 117 virtual bool HandleKeyReleased(const views::KeyEvent& e) = 0; |
117 | 118 |
118 // Invoked when focus is being moved from or to the Textfield. | 119 // Invoked when focus is being moved from or to the Textfield. |
119 // See also View::OnFocus/OnBlur. | 120 // See also View::OnFocus/OnBlur. |
120 virtual void HandleFocus() = 0; | 121 virtual void HandleFocus() = 0; |
121 virtual void HandleBlur() = 0; | 122 virtual void HandleBlur() = 0; |
122 | 123 |
| 124 // Returns the View's TextInputClient instance or NULL if the View doesn't |
| 125 // support text input. |
| 126 virtual TextInputClient* GetTextInputClient() = 0; |
| 127 |
123 // Creates an appropriate NativeTextfieldWrapper for the platform. | 128 // Creates an appropriate NativeTextfieldWrapper for the platform. |
124 static NativeTextfieldWrapper* CreateWrapper(Textfield* field); | 129 static NativeTextfieldWrapper* CreateWrapper(Textfield* field); |
125 }; | 130 }; |
126 | 131 |
127 } // namespace views | 132 } // namespace views |
128 | 133 |
129 #endif // VIEWS_CONTROLS_TEXTFIELD_NATIVE_TEXTFIELD_WRAPPER_H_ | 134 #endif // VIEWS_CONTROLS_TEXTFIELD_NATIVE_TEXTFIELD_WRAPPER_H_ |
OLD | NEW |