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) {} |
49 | 49 |
50 // Called after performing a user action that may change the textfield. | 50 // Called after performing a user action that may change the textfield. |
51 // It's currently only supported by Views implementation. | 51 // It's currently only supported by Views implementation. |
52 virtual void OnAfterUserAction(Textfield* sender) {} | 52 virtual void OnAfterUserAction(Textfield* sender) {} |
53 | 53 |
54 // Called after performing a Cut or Copy operation. | 54 // Called after performing a Cut or Copy operation. |
55 virtual void OnAfterCutOrCopy() {} | 55 virtual void OnAfterCutOrCopy() {} |
56 | 56 |
| 57 // Called after performing a Paste operation. |
| 58 virtual void OnAfterPaste() {} |
| 59 |
57 // Called after the textfield has written drag data to give the controller a | 60 // Called after the textfield has written drag data to give the controller a |
58 // chance to modify the drag data. | 61 // chance to modify the drag data. |
59 virtual void OnWriteDragData(ui::OSExchangeData* data) {} | 62 virtual void OnWriteDragData(ui::OSExchangeData* data) {} |
60 | 63 |
61 // Called after the textfield has set default drag operations to give the | 64 // Called after the textfield has set default drag operations to give the |
62 // controller a chance to update them. | 65 // controller a chance to update them. |
63 virtual void OnGetDragOperationsForTextfield(int* drag_operations) {} | 66 virtual void OnGetDragOperationsForTextfield(int* drag_operations) {} |
64 | 67 |
65 // Enables the controller to append to the accepted drop formats. | 68 // Enables the controller to append to the accepted drop formats. |
66 virtual void AppendDropFormats( | 69 virtual void AppendDropFormats( |
(...skipping 29 matching lines...) Expand all Loading... |
96 // Execute context menu command specified by |command_id|. | 99 // Execute context menu command specified by |command_id|. |
97 virtual void ExecuteCommand(int command_id, int event_flag) {} | 100 virtual void ExecuteCommand(int command_id, int event_flag) {} |
98 | 101 |
99 protected: | 102 protected: |
100 virtual ~TextfieldController() {} | 103 virtual ~TextfieldController() {} |
101 }; | 104 }; |
102 | 105 |
103 } // namespace views | 106 } // namespace views |
104 | 107 |
105 #endif // UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_CONTROLLER_H_ | 108 #endif // UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_CONTROLLER_H_ |
OLD | NEW |