| 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 "ui/gfx/native_widget_types.h" | 9 #include "ui/gfx/native_widget_types.h" |
| 10 #include "ui/views/views_export.h" | 10 #include "ui/views/views_export.h" |
| 11 | 11 |
| 12 namespace gfx { | 12 namespace gfx { |
| 13 class Insets; | 13 class Insets; |
| 14 class SelectionModel; | 14 class SelectionModel; |
| 15 struct StyleRange; | 15 struct StyleRange; |
| 16 } // namespace gfx | 16 } // namespace gfx |
| 17 | 17 |
| 18 namespace ui { | 18 namespace ui { |
| 19 class KeyEvent; |
| 19 class Range; | 20 class Range; |
| 20 class TextInputClient; | 21 class TextInputClient; |
| 21 } // namespace ui | 22 } // namespace ui |
| 22 | 23 |
| 23 namespace views { | 24 namespace views { |
| 24 | 25 |
| 25 class KeyEvent; | |
| 26 class Textfield; | 26 class Textfield; |
| 27 class View; | 27 class View; |
| 28 | 28 |
| 29 // An interface implemented by an object that provides a platform-native | 29 // An interface implemented by an object that provides a platform-native |
| 30 // text field. | 30 // text field. |
| 31 class VIEWS_EXPORT NativeTextfieldWrapper { | 31 class VIEWS_EXPORT NativeTextfieldWrapper { |
| 32 public: | 32 public: |
| 33 // The Textfield calls this when it is destroyed to clean up the wrapper | 33 // The Textfield calls this when it is destroyed to clean up the wrapper |
| 34 // object. | 34 // object. |
| 35 virtual ~NativeTextfieldWrapper() {} | 35 virtual ~NativeTextfieldWrapper() {} |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 virtual size_t GetCursorPosition() const = 0; | 118 virtual size_t GetCursorPosition() const = 0; |
| 119 | 119 |
| 120 // Following methods are to forward key/focus related events to the | 120 // Following methods are to forward key/focus related events to the |
| 121 // views wrapper so that TextfieldViews can handle key inputs without | 121 // views wrapper so that TextfieldViews can handle key inputs without |
| 122 // having focus. | 122 // having focus. |
| 123 | 123 |
| 124 // Invoked when a key is pressed/release on Textfield. Subclasser | 124 // Invoked when a key is pressed/release on Textfield. Subclasser |
| 125 // should return true if the event has been processed and false | 125 // should return true if the event has been processed and false |
| 126 // otherwise. | 126 // otherwise. |
| 127 // See also View::OnKeyPressed/OnKeyReleased. | 127 // See also View::OnKeyPressed/OnKeyReleased. |
| 128 virtual bool HandleKeyPressed(const views::KeyEvent& e) = 0; | 128 virtual bool HandleKeyPressed(const ui::KeyEvent& e) = 0; |
| 129 virtual bool HandleKeyReleased(const views::KeyEvent& e) = 0; | 129 virtual bool HandleKeyReleased(const ui::KeyEvent& e) = 0; |
| 130 | 130 |
| 131 // Invoked when focus is being moved from or to the Textfield. | 131 // Invoked when focus is being moved from or to the Textfield. |
| 132 // See also View::OnFocus/OnBlur. | 132 // See also View::OnFocus/OnBlur. |
| 133 virtual void HandleFocus() = 0; | 133 virtual void HandleFocus() = 0; |
| 134 virtual void HandleBlur() = 0; | 134 virtual void HandleBlur() = 0; |
| 135 | 135 |
| 136 // Returns the View's TextInputClient instance or NULL if the View doesn't | 136 // Returns the View's TextInputClient instance or NULL if the View doesn't |
| 137 // support text input. | 137 // support text input. |
| 138 virtual ui::TextInputClient* GetTextInputClient() = 0; | 138 virtual ui::TextInputClient* GetTextInputClient() = 0; |
| 139 | 139 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 150 // Get the height in pixels of the first font used in this textfield. | 150 // Get the height in pixels of the first font used in this textfield. |
| 151 virtual int GetFontHeight() = 0; | 151 virtual int GetFontHeight() = 0; |
| 152 | 152 |
| 153 // Creates an appropriate NativeTextfieldWrapper for the platform. | 153 // Creates an appropriate NativeTextfieldWrapper for the platform. |
| 154 static NativeTextfieldWrapper* CreateWrapper(Textfield* field); | 154 static NativeTextfieldWrapper* CreateWrapper(Textfield* field); |
| 155 }; | 155 }; |
| 156 | 156 |
| 157 } // namespace views | 157 } // namespace views |
| 158 | 158 |
| 159 #endif // UI_VIEWS_CONTROLS_TEXTFIELD_NATIVE_TEXTFIELD_WRAPPER_H_ | 159 #endif // UI_VIEWS_CONTROLS_TEXTFIELD_NATIVE_TEXTFIELD_WRAPPER_H_ |
| OLD | NEW |