| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "app/drag_drop_types.h" | 11 #include "app/drag_drop_types.h" |
| 12 #include "app/os_exchange_data.h" | 12 #include "app/os_exchange_data.h" |
| 13 #include "base/logging.h" | 13 #include "base/logging.h" |
| 14 #include "views/controls/menu/controller.h" | 14 #include "views/controls/menu/controller.h" |
| 15 #include "views/controls/menu/menu_item_view.h" |
| 15 #include "views/event.h" | 16 #include "views/event.h" |
| 16 | 17 |
| 17 namespace views { | 18 namespace views { |
| 18 | 19 |
| 19 class DropTargetEvent; | 20 class DropTargetEvent; |
| 20 class MenuItemView; | 21 class MenuButton; |
| 21 | 22 |
| 22 // MenuDelegate -------------------------------------------------------------- | 23 // MenuDelegate -------------------------------------------------------------- |
| 23 | 24 |
| 24 // Delegate for a menu. This class is used as part of MenuItemView, see it | 25 // Delegate for a menu. This class is used as part of MenuItemView, see it |
| 25 // for details. | 26 // for details. |
| 26 // TODO(sky): merge this with Menu2Model. | 27 // TODO(sky): merge this with Menu2Model. |
| 27 class MenuDelegate : Controller { | 28 class MenuDelegate : Controller { |
| 28 public: | 29 public: |
| 29 // Used during drag and drop to indicate where the drop indicator should | 30 // Used during drag and drop to indicate where the drop indicator should |
| 30 // be rendered. | 31 // be rendered. |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 } | 174 } |
| 174 | 175 |
| 175 // Notification the menu has closed. This is only sent when running the | 176 // Notification the menu has closed. This is only sent when running the |
| 176 // menu for a drop. | 177 // menu for a drop. |
| 177 virtual void DropMenuClosed(MenuItemView* menu) { | 178 virtual void DropMenuClosed(MenuItemView* menu) { |
| 178 } | 179 } |
| 179 | 180 |
| 180 // Notification that the user has highlighted the specified item. | 181 // Notification that the user has highlighted the specified item. |
| 181 virtual void SelectionChanged(MenuItemView* menu) { | 182 virtual void SelectionChanged(MenuItemView* menu) { |
| 182 } | 183 } |
| 184 |
| 185 // If the user drags the mouse outside the bounds of the menu the delegate |
| 186 // is queried for a sibling menu to show. If this returns non-null the |
| 187 // current menu is hidden, and the menu returned from this method is shown. |
| 188 // |
| 189 // The delegate owns the returned menu, not the controller. |
| 190 virtual MenuItemView* GetSiblingMenu(MenuItemView* menu, |
| 191 const gfx::Point& screen_point, |
| 192 MenuItemView::AnchorPosition* anchor, |
| 193 bool* has_mnemonics, |
| 194 MenuButton** button) { |
| 195 return NULL; |
| 196 } |
| 183 }; | 197 }; |
| 184 | 198 |
| 185 } // namespace views | 199 } // namespace views |
| 186 | 200 |
| 187 #endif // VIEWS_CONTROLS_MENU_MENU_DELEGATE_H_ | 201 #endif // VIEWS_CONTROLS_MENU_MENU_DELEGATE_H_ |
| OLD | NEW |