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 "base/string16.h" | 8 #include "base/string16.h" |
9 #include "ui/views/views_export.h" | 9 #include "ui/views/views_export.h" |
10 | 10 |
11 namespace ui { | 11 namespace ui { |
| 12 class KeyEvent; |
12 class OSExchangeData; | 13 class OSExchangeData; |
13 class SimpleMenuModel; | 14 class SimpleMenuModel; |
14 } // namespace ui | 15 } // namespace ui |
15 | 16 |
16 namespace views { | 17 namespace views { |
17 | 18 |
18 class KeyEvent; | |
19 class Textfield; | 19 class Textfield; |
20 | 20 |
21 // This defines the callback interface for other code to be notified of changes | 21 // This defines the callback interface for other code to be notified of changes |
22 // in the state of a text field. | 22 // in the state of a text field. |
23 class VIEWS_EXPORT TextfieldController { | 23 class VIEWS_EXPORT TextfieldController { |
24 public: | 24 public: |
25 // This method is called whenever the text in the field is changed by the | 25 // This method is called whenever the text in the field is changed by the |
26 // user. It won't be called if the text is changed by calling | 26 // user. It won't be called if the text is changed by calling |
27 // Textfield::SetText() or Textfield::AppendText(). | 27 // Textfield::SetText() or Textfield::AppendText(). |
28 virtual void ContentsChanged(Textfield* sender, | 28 virtual void ContentsChanged(Textfield* sender, |
29 const string16& new_contents) = 0; | 29 const string16& new_contents) = 0; |
30 | 30 |
31 // This method is called to get notified about keystrokes in the edit. | 31 // This method is called to get notified about keystrokes in the edit. |
32 // Returns true if the message was handled and should not be processed | 32 // Returns true if the message was handled and should not be processed |
33 // further. If it returns false the processing continues. | 33 // further. If it returns false the processing continues. |
34 virtual bool HandleKeyEvent(Textfield* sender, | 34 virtual bool HandleKeyEvent(Textfield* sender, |
35 const KeyEvent& key_event) = 0; | 35 const ui::KeyEvent& key_event) = 0; |
36 | 36 |
37 // Called before performing a user action that may change the textfield. | 37 // Called before performing a user action that may change the textfield. |
38 // It's currently only supported by Views implementation. | 38 // It's currently only supported by Views implementation. |
39 virtual void OnBeforeUserAction(Textfield* sender) {} | 39 virtual void OnBeforeUserAction(Textfield* sender) {} |
40 | 40 |
41 // Called after performing a user action that may change the textfield. | 41 // Called after performing a user action that may change the textfield. |
42 // It's currently only supported by Views implementation. | 42 // It's currently only supported by Views implementation. |
43 virtual void OnAfterUserAction(Textfield* sender) {} | 43 virtual void OnAfterUserAction(Textfield* sender) {} |
44 | 44 |
45 // Called after performing a Cut or Copy operation. | 45 // Called after performing a Cut or Copy operation. |
(...skipping 19 matching lines...) Expand all Loading... |
65 // Execute context menu command specified by |command_id|. | 65 // Execute context menu command specified by |command_id|. |
66 virtual void ExecuteCommand(int command_id) {} | 66 virtual void ExecuteCommand(int command_id) {} |
67 | 67 |
68 protected: | 68 protected: |
69 virtual ~TextfieldController() {} | 69 virtual ~TextfieldController() {} |
70 }; | 70 }; |
71 | 71 |
72 } // namespace views | 72 } // namespace views |
73 | 73 |
74 #endif // UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_CONTROLLER_H_ | 74 #endif // UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_CONTROLLER_H_ |
OLD | NEW |