OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_H_ | 5 #ifndef VIEWS_CONTROLS_MENU_MENU_H_ |
6 #define VIEWS_CONTROLS_MENU_MENU_H_ | 6 #define VIEWS_CONTROLS_MENU_MENU_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/string16.h" | 12 #include "base/string16.h" |
13 #include "ui/gfx/native_widget_types.h" | 13 #include "ui/gfx/native_widget_types.h" |
14 #include "views/views_export.h" | 14 #include "views/views_export.h" |
15 | 15 |
16 class SkBitmap; | 16 class SkBitmap; |
17 | 17 |
18 namespace gfx { | 18 namespace gfx { |
19 class Point; | 19 class Point; |
20 } | 20 } |
21 | 21 |
| 22 namespace ui { |
| 23 class Accelerator; |
| 24 } |
| 25 |
22 namespace views { | 26 namespace views { |
23 | 27 |
24 class Accelerator; | |
25 | |
26 class VIEWS_EXPORT Menu { | 28 class VIEWS_EXPORT Menu { |
27 public: | 29 public: |
28 ///////////////////////////////////////////////////////////////////////////// | 30 ///////////////////////////////////////////////////////////////////////////// |
29 // | 31 // |
30 // Delegate Interface | 32 // Delegate Interface |
31 // | 33 // |
32 // Classes implement this interface to tell the menu system more about each | 34 // Classes implement this interface to tell the menu system more about each |
33 // item as it is created. | 35 // item as it is created. |
34 // | 36 // |
35 ///////////////////////////////////////////////////////////////////////////// | 37 ///////////////////////////////////////////////////////////////////////////// |
(...skipping 13 matching lines...) Expand all Loading... |
49 } | 51 } |
50 | 52 |
51 // The string shown for the menu item. | 53 // The string shown for the menu item. |
52 virtual string16 GetLabel(int id) const { | 54 virtual string16 GetLabel(int id) const { |
53 return string16(); | 55 return string16(); |
54 } | 56 } |
55 | 57 |
56 // The delegate needs to implement this function if it wants to display | 58 // The delegate needs to implement this function if it wants to display |
57 // the shortcut text next to each menu item. If there is an accelerator | 59 // the shortcut text next to each menu item. If there is an accelerator |
58 // for a given item id, the implementor must return it. | 60 // for a given item id, the implementor must return it. |
59 virtual bool GetAcceleratorInfo(int id, views::Accelerator* accel) { | 61 virtual bool GetAcceleratorInfo(int id, ui::Accelerator* accel) { |
60 return false; | 62 return false; |
61 } | 63 } |
62 | 64 |
63 // The icon shown for the menu item. | 65 // The icon shown for the menu item. |
64 virtual const SkBitmap& GetIcon(int id) const { | 66 virtual const SkBitmap& GetIcon(int id) const { |
65 return GetEmptyIcon(); | 67 return GetEmptyIcon(); |
66 } | 68 } |
67 | 69 |
68 // The number of items to show in the menu | 70 // The number of items to show in the menu |
69 virtual int GetItemCount() const { | 71 virtual int GetItemCount() const { |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 | 268 |
267 // How this popup menu should be aligned relative to the point it is run at. | 269 // How this popup menu should be aligned relative to the point it is run at. |
268 AnchorPoint anchor_; | 270 AnchorPoint anchor_; |
269 | 271 |
270 DISALLOW_COPY_AND_ASSIGN(Menu); | 272 DISALLOW_COPY_AND_ASSIGN(Menu); |
271 }; | 273 }; |
272 | 274 |
273 } // namespace views | 275 } // namespace views |
274 | 276 |
275 #endif // VIEWS_CONTROLS_MENU_MENU_H_ | 277 #endif // VIEWS_CONTROLS_MENU_MENU_H_ |
OLD | NEW |