OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 VIEWS_CONTROLS_MENU_MENU_DELEGATE_H_ | 5 #ifndef VIEWS_CONTROLS_MENU_MENU_DELEGATE_H_ |
6 #define VIEWS_CONTROLS_MENU_MENU_DELEGATE_H_ | 6 #define VIEWS_CONTROLS_MENU_MENU_DELEGATE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "app/drag_drop_types.h" | |
13 #include "base/logging.h" | 12 #include "base/logging.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 "views/controls/menu/controller.h" | 15 #include "views/controls/menu/controller.h" |
16 #include "views/controls/menu/menu_item_view.h" | 16 #include "views/controls/menu/menu_item_view.h" |
17 #include "views/event.h" | 17 #include "views/event.h" |
18 | 18 |
19 using ui::OSExchangeData; | 19 using ui::OSExchangeData; |
20 | 20 |
21 namespace views { | 21 namespace views { |
22 | 22 |
23 class DropTargetEvent; | 23 class DropTargetEvent; |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 // See view for a description of this method. | 144 // See view for a description of this method. |
145 virtual bool AreDropTypesRequired(MenuItemView* menu) { | 145 virtual bool AreDropTypesRequired(MenuItemView* menu) { |
146 return false; | 146 return false; |
147 } | 147 } |
148 | 148 |
149 // Returns the drop operation for the specified target menu item. This is | 149 // Returns the drop operation for the specified target menu item. This is |
150 // only invoked if CanDrop returned true for the parent menu. position | 150 // only invoked if CanDrop returned true for the parent menu. position |
151 // is set based on the location of the mouse, reset to specify a different | 151 // is set based on the location of the mouse, reset to specify a different |
152 // position. | 152 // position. |
153 // | 153 // |
154 // If a drop should not be allowed, returned DragDropTypes::DRAG_NONE. | 154 // If a drop should not be allowed, returned ui::DragDropTypes::DRAG_NONE. |
155 virtual int GetDropOperation(MenuItemView* item, | 155 virtual int GetDropOperation(MenuItemView* item, |
156 const DropTargetEvent& event, | 156 const DropTargetEvent& event, |
157 DropPosition* position) { | 157 DropPosition* position) { |
158 NOTREACHED() << "If you override CanDrop, you need to override this too"; | 158 NOTREACHED() << "If you override CanDrop, you need to override this too"; |
159 return DragDropTypes::DRAG_NONE; | 159 return ui::DragDropTypes::DRAG_NONE; |
160 } | 160 } |
161 | 161 |
162 // Invoked to perform the drop operation. This is ONLY invoked if | 162 // Invoked to perform the drop operation. This is ONLY invoked if |
163 // canDrop returned true for the parent menu item, and GetDropOperation | 163 // canDrop returned true for the parent menu item, and GetDropOperation |
164 // returned an operation other than DragDropTypes::DRAG_NONE. | 164 // returned an operation other than ui::DragDropTypes::DRAG_NONE. |
165 // | 165 // |
166 // menu indicates the menu the drop occurred on. | 166 // menu indicates the menu the drop occurred on. |
167 virtual int OnPerformDrop(MenuItemView* menu, | 167 virtual int OnPerformDrop(MenuItemView* menu, |
168 DropPosition position, | 168 DropPosition position, |
169 const DropTargetEvent& event) { | 169 const DropTargetEvent& event) { |
170 NOTREACHED() << "If you override CanDrop, you need to override this too"; | 170 NOTREACHED() << "If you override CanDrop, you need to override this too"; |
171 return DragDropTypes::DRAG_NONE; | 171 return ui::DragDropTypes::DRAG_NONE; |
172 } | 172 } |
173 | 173 |
174 // Invoked to determine if it is possible for the user to drag the specified | 174 // Invoked to determine if it is possible for the user to drag the specified |
175 // menu item. | 175 // menu item. |
176 virtual bool CanDrag(MenuItemView* menu) { | 176 virtual bool CanDrag(MenuItemView* menu) { |
177 return false; | 177 return false; |
178 } | 178 } |
179 | 179 |
180 // Invoked to write the data for a drag operation to data. sender is the | 180 // Invoked to write the data for a drag operation to data. sender is the |
181 // MenuItemView being dragged. | 181 // MenuItemView being dragged. |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 virtual int GetMaxWidthForMenu() { | 216 virtual int GetMaxWidthForMenu() { |
217 // NOTE: this needs to be large enough to accommodate the wrench menu with | 217 // NOTE: this needs to be large enough to accommodate the wrench menu with |
218 // big fonts. | 218 // big fonts. |
219 return 800; | 219 return 800; |
220 } | 220 } |
221 }; | 221 }; |
222 | 222 |
223 } // namespace views | 223 } // namespace views |
224 | 224 |
225 #endif // VIEWS_CONTROLS_MENU_MENU_DELEGATE_H_ | 225 #endif // VIEWS_CONTROLS_MENU_MENU_DELEGATE_H_ |
OLD | NEW |