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 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 virtual bool IsItemChecked(int id) const { | 48 virtual bool IsItemChecked(int id) const { |
49 return false; | 49 return false; |
50 } | 50 } |
51 | 51 |
52 // The string shown for the menu item. This is only invoked when an item is | 52 // The string shown for the menu item. This is only invoked when an item is |
53 // added with an empty label. | 53 // added with an empty label. |
54 virtual std::wstring GetLabel(int id) const { | 54 virtual std::wstring GetLabel(int id) const { |
55 return std::wstring(); | 55 return std::wstring(); |
56 } | 56 } |
57 | 57 |
| 58 // If there is an accelerator for the menu item with id |id| it is set in |
| 59 // |accelerator| and true is returned. |
| 60 virtual bool GetAccelerator(int id, Accelerator* accelerator) { |
| 61 return false; |
| 62 } |
| 63 |
58 // Shows the context menu with the specified id. This is invoked when the | 64 // Shows the context menu with the specified id. This is invoked when the |
59 // user does the appropriate gesture to show a context menu. The id | 65 // user does the appropriate gesture to show a context menu. The id |
60 // identifies the id of the menu to show the context menu for. | 66 // identifies the id of the menu to show the context menu for. |
61 // is_mouse_gesture is true if this is the result of a mouse gesture. | 67 // is_mouse_gesture is true if this is the result of a mouse gesture. |
62 // If this is not the result of a mouse gesture |p| is the recommended | 68 // If this is not the result of a mouse gesture |p| is the recommended |
63 // location to display the content menu at. In either case, |p| is in | 69 // location to display the content menu at. In either case, |p| is in |
64 // screen coordinates. | 70 // screen coordinates. |
65 // Returns true if a context menu was displayed, otherwise false | 71 // Returns true if a context menu was displayed, otherwise false |
66 virtual bool ShowContextMenu(MenuItemView* source, | 72 virtual bool ShowContextMenu(MenuItemView* source, |
67 int id, | 73 int id, |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 MenuItemView::AnchorPosition* anchor, | 206 MenuItemView::AnchorPosition* anchor, |
201 bool* has_mnemonics, | 207 bool* has_mnemonics, |
202 MenuButton** button) { | 208 MenuButton** button) { |
203 return NULL; | 209 return NULL; |
204 } | 210 } |
205 }; | 211 }; |
206 | 212 |
207 } // namespace views | 213 } // namespace views |
208 | 214 |
209 #endif // VIEWS_CONTROLS_MENU_MENU_DELEGATE_H_ | 215 #endif // VIEWS_CONTROLS_MENU_MENU_DELEGATE_H_ |
OLD | NEW |