OLD | NEW |
---|---|
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "gfx/native_widget_types.h" | 10 #include "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 views { | 16 namespace views { |
17 | 17 |
18 class KeyEvent; | |
18 class Textfield; | 19 class Textfield; |
19 class View; | 20 class View; |
20 | 21 |
21 // An interface implemented by an object that provides a platform-native | 22 // An interface implemented by an object that provides a platform-native |
22 // text field. | 23 // text field. |
23 class NativeTextfieldWrapper { | 24 class NativeTextfieldWrapper { |
24 public: | 25 public: |
25 // The Textfield calls this when it is destroyed to clean up the wrapper | 26 // The Textfield calls this when it is destroyed to clean up the wrapper |
26 // object. | 27 // object. |
27 virtual ~NativeTextfieldWrapper() {} | 28 virtual ~NativeTextfieldWrapper() {} |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
70 | 71 |
71 // Returns the insets for the text field. | 72 // Returns the insets for the text field. |
72 virtual gfx::Insets CalculateInsets() = 0; | 73 virtual gfx::Insets CalculateInsets() = 0; |
73 | 74 |
74 // Updates the horizontal margins for the native text field. | 75 // Updates the horizontal margins for the native text field. |
75 virtual void UpdateHorizontalMargins() = 0; | 76 virtual void UpdateHorizontalMargins() = 0; |
76 | 77 |
77 // Updates the vertical margins for the native text field. | 78 // Updates the vertical margins for the native text field. |
78 virtual void UpdateVerticalMargins() = 0; | 79 virtual void UpdateVerticalMargins() = 0; |
79 | 80 |
80 // Sets the focus to the text field. | 81 // Sets the focus to the text field. Returns fale if the wrapper |
sky
2011/01/05 22:57:35
fale -> false
| |
81 virtual void SetFocus() = 0; | 82 // didn't take focus. |
83 virtual bool SetFocus() = 0; | |
82 | 84 |
83 // Retrieves the views::View that hosts the native control. | 85 // Retrieves the views::View that hosts the native control. |
84 virtual View* GetView() = 0; | 86 virtual View* GetView() = 0; |
85 | 87 |
86 // Returns a handle to the underlying native view for testing. | 88 // Returns a handle to the underlying native view for testing. |
87 virtual gfx::NativeView GetTestingHandle() const = 0; | 89 virtual gfx::NativeView GetTestingHandle() const = 0; |
88 | 90 |
89 // Returns whether or not an IME is composing text. | 91 // Returns whether or not an IME is composing text. |
90 virtual bool IsIMEComposing() const = 0; | 92 virtual bool IsIMEComposing() const = 0; |
91 | 93 |
94 // Following methods are to forward key/focus related events to the | |
95 // views wrapper so that TextfieldViews can handle key inputs without | |
96 // having a focus. See views::View for the description of each method. | |
97 virtual bool OnKeyPressed(const views::KeyEvent& e) = 0; | |
sky
2011/01/05 22:57:35
I'm a bit worried about naming these exactly the s
| |
98 virtual bool OnKeyReleased(const views::KeyEvent& e) = 0; | |
99 virtual void WillGainFocus() = 0; | |
100 virtual void DidGainFocus() = 0; | |
101 virtual void WillLoseFocus() = 0; | |
102 | |
92 // Creates an appropriate NativeTextfieldWrapper for the platform. | 103 // Creates an appropriate NativeTextfieldWrapper for the platform. |
93 static NativeTextfieldWrapper* CreateWrapper(Textfield* field); | 104 static NativeTextfieldWrapper* CreateWrapper(Textfield* field); |
94 }; | 105 }; |
95 | 106 |
96 } // namespace views | 107 } // namespace views |
97 | 108 |
98 #endif // VIEWS_CONTROLS_TEXTFIELD_NATIVE_TEXTFIELD_WRAPPER_H_ | 109 #endif // VIEWS_CONTROLS_TEXTFIELD_NATIVE_TEXTFIELD_WRAPPER_H_ |
OLD | NEW |