Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Unified Diff: views/controls/textfield/native_textfield_wrapper.h

Issue 5988010: focus reverse traversal was not working for TextfieldViews. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync Created 9 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « views/controls/textfield/native_textfield_win.cc ('k') | views/controls/textfield/textfield.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: views/controls/textfield/native_textfield_wrapper.h
diff --git a/views/controls/textfield/native_textfield_wrapper.h b/views/controls/textfield/native_textfield_wrapper.h
index eb5245fd7baf4f17f5d1d4ad412374a4d2aae9f9..c45243e029ed891cc600dccea6cec3f212ec5833 100644
--- a/views/controls/textfield/native_textfield_wrapper.h
+++ b/views/controls/textfield/native_textfield_wrapper.h
@@ -15,6 +15,7 @@ class Insets;
namespace views {
+class KeyEvent;
class Textfield;
class View;
@@ -77,8 +78,9 @@ class NativeTextfieldWrapper {
// Updates the vertical margins for the native text field.
virtual void UpdateVerticalMargins() = 0;
- // Sets the focus to the text field.
- virtual void SetFocus() = 0;
+ // Sets the focus to the text field. Returns false if the wrapper
+ // didn't take focus.
+ virtual bool SetFocus() = 0;
// Retrieves the views::View that hosts the native control.
virtual View* GetView() = 0;
@@ -89,6 +91,23 @@ class NativeTextfieldWrapper {
// Returns whether or not an IME is composing text.
virtual bool IsIMEComposing() const = 0;
+ // Following methods are to forward key/focus related events to the
+ // views wrapper so that TextfieldViews can handle key inputs without
+ // having focus.
+
+ // Invoked when a key is pressed/release on Textfield. Subclasser
+ // should return true if the event has been processed and false
+ // otherwise.
+ // See also View::OnKeyPressed/OnKeyReleased.
+ virtual bool HandleKeyPressed(const views::KeyEvent& e) = 0;
+ virtual bool HandleKeyReleased(const views::KeyEvent& e) = 0;
+
+ // Invoked when focus is being moved from or to the Textfield.
+ // See also View::WillGainFocus/DidGainFocus/WillLoseFocus.
+ virtual void HandleWillGainFocus() = 0;
+ virtual void HandleDidGainFocus() = 0;
+ virtual void HandleWillLoseFocus() = 0;
+
// Creates an appropriate NativeTextfieldWrapper for the platform.
static NativeTextfieldWrapper* CreateWrapper(Textfield* field);
};
« no previous file with comments | « views/controls/textfield/native_textfield_win.cc ('k') | views/controls/textfield/textfield.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698