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> |
| 9 |
8 #include "base/string16.h" | 10 #include "base/string16.h" |
| 11 #include "ui/base/dragdrop/os_exchange_data.h" |
9 #include "ui/views/views_export.h" | 12 #include "ui/views/views_export.h" |
10 | 13 |
11 namespace ui { | 14 namespace ui { |
12 class KeyEvent; | 15 class KeyEvent; |
13 class OSExchangeData; | |
14 class SimpleMenuModel; | 16 class SimpleMenuModel; |
15 } // namespace ui | 17 } // namespace ui |
16 | 18 |
17 namespace views { | 19 namespace views { |
18 | 20 |
19 class Textfield; | 21 class Textfield; |
20 | 22 |
21 // This defines the callback interface for other code to be notified of changes | 23 // This defines the callback interface for other code to be notified of changes |
22 // in the state of a text field. | 24 // in the state of a text field. |
23 class VIEWS_EXPORT TextfieldController { | 25 class VIEWS_EXPORT TextfieldController { |
(...skipping 18 matching lines...) Expand all Loading... |
42 // It's currently only supported by Views implementation. | 44 // It's currently only supported by Views implementation. |
43 virtual void OnAfterUserAction(Textfield* sender) {} | 45 virtual void OnAfterUserAction(Textfield* sender) {} |
44 | 46 |
45 // Called after performing a Cut or Copy operation. | 47 // Called after performing a Cut or Copy operation. |
46 virtual void OnAfterCutOrCopy() {} | 48 virtual void OnAfterCutOrCopy() {} |
47 | 49 |
48 // Called after the textfield has written drag data to give the controller a | 50 // Called after the textfield has written drag data to give the controller a |
49 // chance to modify the drag data. | 51 // chance to modify the drag data. |
50 virtual void OnWriteDragData(ui::OSExchangeData* data) {} | 52 virtual void OnWriteDragData(ui::OSExchangeData* data) {} |
51 | 53 |
| 54 // Enables the controller to append to the accepted drop formats. |
| 55 virtual void AppendDropFormats( |
| 56 int* formats, |
| 57 std::set<ui::OSExchangeData::CustomFormat>* custom_formats) {} |
| 58 |
| 59 // Called when a drop of dragged data happens on the textfield. This method is |
| 60 // called before regular handling of the drop. If this returns a drag |
| 61 // operation other than |ui::DragDropTypes::DRAG_NONE|, regular handling is |
| 62 // skipped. |
| 63 virtual int OnDrop(const ui::OSExchangeData& data); |
| 64 |
52 // Gives the controller a chance to modify the context menu contents. | 65 // Gives the controller a chance to modify the context menu contents. |
53 virtual void UpdateContextMenu(ui::SimpleMenuModel* menu_contents) {} | 66 virtual void UpdateContextMenu(ui::SimpleMenuModel* menu_contents) {} |
54 | 67 |
55 // Returns true if the |command_id| should be enabled in the context menu. | 68 // Returns true if the |command_id| should be enabled in the context menu. |
56 virtual bool IsCommandIdEnabled(int command_id) const; | 69 virtual bool IsCommandIdEnabled(int command_id) const; |
57 | 70 |
58 // Returns true if the item label for the |command_id| is dynamic in the | 71 // Returns true if the item label for the |command_id| is dynamic in the |
59 // context menu. | 72 // context menu. |
60 virtual bool IsItemForCommandIdDynamic(int command_id) const; | 73 virtual bool IsItemForCommandIdDynamic(int command_id) const; |
61 | 74 |
(...skipping 10 matching lines...) Expand all Loading... |
72 // Execute context menu command specified by |command_id|. | 85 // Execute context menu command specified by |command_id|. |
73 virtual void ExecuteCommand(int command_id) {} | 86 virtual void ExecuteCommand(int command_id) {} |
74 | 87 |
75 protected: | 88 protected: |
76 virtual ~TextfieldController() {} | 89 virtual ~TextfieldController() {} |
77 }; | 90 }; |
78 | 91 |
79 } // namespace views | 92 } // namespace views |
80 | 93 |
81 #endif // UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_CONTROLLER_H_ | 94 #endif // UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_CONTROLLER_H_ |
OLD | NEW |