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_TEXTFIELD_CONTROLLER_H_ | 5 #ifndef UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_CONTROLLER_H_ |
6 #define UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_CONTROLLER_H_ | 6 #define UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_CONTROLLER_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/string16.h" | 10 #include "base/string16.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 class Textfield; | 22 class Textfield; |
23 | 23 |
24 // This defines the callback interface for other code to be notified of changes | 24 // This defines the callback interface for other code to be notified of changes |
25 // in the state of a text field. | 25 // in the state of a text field. |
26 class VIEWS_EXPORT TextfieldController { | 26 class VIEWS_EXPORT TextfieldController { |
27 public: | 27 public: |
28 // This method is called whenever the text in the field is changed by the | 28 // This method is called whenever the text in the field is changed by the |
29 // user. It won't be called if the text is changed by calling | 29 // user. It won't be called if the text is changed by calling |
30 // Textfield::SetText() or Textfield::AppendText(). | 30 // Textfield::SetText() or Textfield::AppendText(). |
31 virtual void ContentsChanged(Textfield* sender, | 31 virtual void ContentsChanged(Textfield* sender, |
32 const string16& new_contents) = 0; | 32 const string16& new_contents) {} |
33 | 33 |
34 // This method is called to get notified about keystrokes in the edit. | 34 // This method is called to get notified about keystrokes in the edit. |
35 // Returns true if the message was handled and should not be processed | 35 // Returns true if the message was handled and should not be processed |
36 // further. If it returns false the processing continues. | 36 // further. If it returns false the processing continues. |
37 virtual bool HandleKeyEvent(Textfield* sender, | 37 virtual bool HandleKeyEvent(Textfield* sender, |
38 const ui::KeyEvent& key_event) = 0; | 38 const ui::KeyEvent& key_event); |
39 | 39 |
40 // This method is called to get notified about mouse events in the edit. | 40 // This method is called to get notified about mouse events in the edit. |
41 // Returns true if the message was handled and should not be processed | 41 // Returns true if the message was handled and should not be processed |
42 // further. Currently, only mouse down events are sent here. | 42 // further. Currently, only mouse down events are sent here. |
43 virtual bool HandleMouseEvent(Textfield* sender, | 43 virtual bool HandleMouseEvent(Textfield* sender, |
44 const ui::MouseEvent& mouse_event); | 44 const ui::MouseEvent& mouse_event); |
45 | 45 |
46 // Called before performing a user action that may change the textfield. | 46 // Called before performing a user action that may change the textfield. |
47 // It's currently only supported by Views implementation. | 47 // It's currently only supported by Views implementation. |
48 virtual void OnBeforeUserAction(Textfield* sender) {} | 48 virtual void OnBeforeUserAction(Textfield* sender) {} |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 // Execute context menu command specified by |command_id|. | 96 // Execute context menu command specified by |command_id|. |
97 virtual void ExecuteCommand(int command_id, int event_flag) {} | 97 virtual void ExecuteCommand(int command_id, int event_flag) {} |
98 | 98 |
99 protected: | 99 protected: |
100 virtual ~TextfieldController() {} | 100 virtual ~TextfieldController() {} |
101 }; | 101 }; |
102 | 102 |
103 } // namespace views | 103 } // namespace views |
104 | 104 |
105 #endif // UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_CONTROLLER_H_ | 105 #endif // UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_CONTROLLER_H_ |
OLD | NEW |