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_MENU_MENU_DELEGATE_H_ | 5 #ifndef UI_VIEWS_CONTROLS_MENU_MENU_DELEGATE_H_ |
6 #define UI_VIEWS_CONTROLS_MENU_MENU_DELEGATE_H_ | 6 #define UI_VIEWS_CONTROLS_MENU_MENU_DELEGATE_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/string16.h" | 12 #include "base/string16.h" |
13 #include "ui/base/dragdrop/drag_drop_types.h" | 13 #include "ui/base/dragdrop/drag_drop_types.h" |
14 #include "ui/base/dragdrop/os_exchange_data.h" | 14 #include "ui/base/dragdrop/os_exchange_data.h" |
15 #include "ui/views/controls/menu/menu_item_view.h" | 15 #include "ui/views/controls/menu/menu_item_view.h" |
16 #include "ui/views/events/event.h" | |
17 | 16 |
18 using ui::OSExchangeData; | 17 using ui::OSExchangeData; |
19 | 18 |
20 namespace gfx { | 19 namespace gfx { |
21 | 20 |
22 class Font; | 21 class Font; |
23 | 22 |
24 } // namespace gfx | 23 } // namespace gfx |
25 | 24 |
26 namespace ui { | 25 namespace ui { |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 // See view for a description of this method. | 141 // See view for a description of this method. |
143 virtual bool AreDropTypesRequired(MenuItemView* menu); | 142 virtual bool AreDropTypesRequired(MenuItemView* menu); |
144 | 143 |
145 // Returns the drop operation for the specified target menu item. This is | 144 // Returns the drop operation for the specified target menu item. This is |
146 // only invoked if CanDrop returned true for the parent menu. position | 145 // only invoked if CanDrop returned true for the parent menu. position |
147 // is set based on the location of the mouse, reset to specify a different | 146 // is set based on the location of the mouse, reset to specify a different |
148 // position. | 147 // position. |
149 // | 148 // |
150 // If a drop should not be allowed, returned ui::DragDropTypes::DRAG_NONE. | 149 // If a drop should not be allowed, returned ui::DragDropTypes::DRAG_NONE. |
151 virtual int GetDropOperation(MenuItemView* item, | 150 virtual int GetDropOperation(MenuItemView* item, |
152 const DropTargetEvent& event, | 151 const ui::DropTargetEvent& event, |
153 DropPosition* position); | 152 DropPosition* position); |
154 | 153 |
155 // Invoked to perform the drop operation. This is ONLY invoked if | 154 // Invoked to perform the drop operation. This is ONLY invoked if |
156 // canDrop returned true for the parent menu item, and GetDropOperation | 155 // canDrop returned true for the parent menu item, and GetDropOperation |
157 // returned an operation other than ui::DragDropTypes::DRAG_NONE. | 156 // returned an operation other than ui::DragDropTypes::DRAG_NONE. |
158 // | 157 // |
159 // menu indicates the menu the drop occurred on. | 158 // menu indicates the menu the drop occurred on. |
160 virtual int OnPerformDrop(MenuItemView* menu, | 159 virtual int OnPerformDrop(MenuItemView* menu, |
161 DropPosition position, | 160 DropPosition position, |
162 const DropTargetEvent& event); | 161 const ui::DropTargetEvent& event); |
163 | 162 |
164 // Invoked to determine if it is possible for the user to drag the specified | 163 // Invoked to determine if it is possible for the user to drag the specified |
165 // menu item. | 164 // menu item. |
166 virtual bool CanDrag(MenuItemView* menu); | 165 virtual bool CanDrag(MenuItemView* menu); |
167 | 166 |
168 // Invoked to write the data for a drag operation to data. sender is the | 167 // Invoked to write the data for a drag operation to data. sender is the |
169 // MenuItemView being dragged. | 168 // MenuItemView being dragged. |
170 virtual void WriteDragData(MenuItemView* sender, OSExchangeData* data); | 169 virtual void WriteDragData(MenuItemView* sender, OSExchangeData* data); |
171 | 170 |
172 // Invoked to determine the drag operations for a drag session of sender. | 171 // Invoked to determine the drag operations for a drag session of sender. |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 virtual Border* CreateMenuBorder(); | 206 virtual Border* CreateMenuBorder(); |
208 | 207 |
209 // Creates and returns a new background for the menu, or NULL if no | 208 // Creates and returns a new background for the menu, or NULL if no |
210 // background is needed. Caller owns the returned object. | 209 // background is needed. Caller owns the returned object. |
211 virtual Background* CreateMenuBackground(); | 210 virtual Background* CreateMenuBackground(); |
212 }; | 211 }; |
213 | 212 |
214 } // namespace views | 213 } // namespace views |
215 | 214 |
216 #endif // UI_VIEWS_CONTROLS_MENU_MENU_DELEGATE_H_ | 215 #endif // UI_VIEWS_CONTROLS_MENU_MENU_DELEGATE_H_ |
OLD | NEW |