| 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/string16.h" | 9 #include "base/string16.h" |
| 10 #include "ui/views/views_export.h" | 10 #include "ui/views/views_export.h" |
| 11 | 11 |
| 12 namespace ui { | 12 namespace ui { |
| 13 class OSExchangeData; | 13 class OSExchangeData; |
| 14 class SimpleMenuModel; |
| 14 } // namespace ui | 15 } // namespace ui |
| 15 | 16 |
| 16 namespace views { | 17 namespace views { |
| 17 | 18 |
| 18 class KeyEvent; | 19 class KeyEvent; |
| 19 class Textfield; | 20 class Textfield; |
| 20 | 21 |
| 21 // This defines the callback interface for other code to be notified of changes | 22 // This defines the callback interface for other code to be notified of changes |
| 22 // in the state of a text field. | 23 // in the state of a text field. |
| 23 class VIEWS_EXPORT TextfieldController { | 24 class VIEWS_EXPORT TextfieldController { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 42 // It's currently only supported by Views implementation. | 43 // It's currently only supported by Views implementation. |
| 43 virtual void OnAfterUserAction(Textfield* sender) {} | 44 virtual void OnAfterUserAction(Textfield* sender) {} |
| 44 | 45 |
| 45 // Called after performing a Cut or Copy operation. | 46 // Called after performing a Cut or Copy operation. |
| 46 virtual void OnAfterCutOrCopy() {} | 47 virtual void OnAfterCutOrCopy() {} |
| 47 | 48 |
| 48 // Called after the textfield has written drag data to give the controller a | 49 // Called after the textfield has written drag data to give the controller a |
| 49 // chance to modify the drag data. | 50 // chance to modify the drag data. |
| 50 virtual void OnWriteDragData(ui::OSExchangeData* data) {} | 51 virtual void OnWriteDragData(ui::OSExchangeData* data) {} |
| 51 | 52 |
| 53 // Gives the controller a chance to modify the context menu contents. |
| 54 virtual void UpdateContextMenu(ui::SimpleMenuModel* menu_contents) {} |
| 55 |
| 56 // Returns true if the |command_id| should be enabled in the context menu. |
| 57 virtual bool IsCommandIdEnabled(int command_id) const { return false; } |
| 58 |
| 59 // Execute context menu command specified by |command_id|. |
| 60 virtual void ExecuteCommand(int command_id) {} |
| 61 |
| 52 protected: | 62 protected: |
| 53 virtual ~TextfieldController() {} | 63 virtual ~TextfieldController() {} |
| 54 }; | 64 }; |
| 55 | 65 |
| 56 } // namespace views | 66 } // namespace views |
| 57 | 67 |
| 58 #endif // UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_CONTROLLER_H_ | 68 #endif // UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_CONTROLLER_H_ |
| OLD | NEW |