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_MODEL_ADAPTER_H_ | 5 #ifndef UI_VIEWS_CONTROLS_MENU_MENU_MODEL_ADAPTER_H_ |
6 #define UI_VIEWS_CONTROLS_MENU_MENU_MODEL_ADAPTER_H_ | 6 #define UI_VIEWS_CONTROLS_MENU_MENU_MODEL_ADAPTER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "ui/views/controls/menu/menu_delegate.h" | 10 #include "ui/views/controls/menu/menu_delegate.h" |
(...skipping 21 matching lines...) Expand all Loading... | |
32 // Convenience for creating and populating a menu. The caller owns the | 32 // Convenience for creating and populating a menu. The caller owns the |
33 // returned MenuItemView. | 33 // returned MenuItemView. |
34 MenuItemView* CreateMenu(); | 34 MenuItemView* CreateMenu(); |
35 | 35 |
36 void set_triggerable_event_flags(int triggerable_event_flags) { | 36 void set_triggerable_event_flags(int triggerable_event_flags) { |
37 triggerable_event_flags_ = triggerable_event_flags; | 37 triggerable_event_flags_ = triggerable_event_flags; |
38 } | 38 } |
39 int triggerable_event_flags() const { return triggerable_event_flags_; } | 39 int triggerable_event_flags() const { return triggerable_event_flags_; } |
40 | 40 |
41 protected: | 41 protected: |
42 // Subclasses override this to allow custom items to be added to the menu. | |
tapted
2013/03/20 08:24:34
Does this need a comment about ownership, since it
benwells
2013/03/20 08:43:34
Done.
| |
43 virtual MenuItemView* CreateCustomItem(MenuItemView* parent, int id); | |
44 | |
42 // views::MenuDelegate implementation. | 45 // views::MenuDelegate implementation. |
43 virtual void ExecuteCommand(int id) OVERRIDE; | 46 virtual void ExecuteCommand(int id) OVERRIDE; |
44 virtual void ExecuteCommand(int id, int mouse_event_flags) OVERRIDE; | 47 virtual void ExecuteCommand(int id, int mouse_event_flags) OVERRIDE; |
45 virtual bool IsTriggerableEvent(MenuItemView* source, | 48 virtual bool IsTriggerableEvent(MenuItemView* source, |
46 const ui::Event& e) OVERRIDE; | 49 const ui::Event& e) OVERRIDE; |
47 virtual bool GetAccelerator(int id, | 50 virtual bool GetAccelerator(int id, |
48 ui::Accelerator* accelerator) OVERRIDE; | 51 ui::Accelerator* accelerator) OVERRIDE; |
49 virtual string16 GetLabel(int id) const OVERRIDE; | 52 virtual string16 GetLabel(int id) const OVERRIDE; |
50 virtual const gfx::Font* GetLabelFont(int id) const OVERRIDE; | 53 virtual const gfx::Font* GetLabelFont(int id) const OVERRIDE; |
51 virtual bool IsCommandEnabled(int id) const OVERRIDE; | 54 virtual bool IsCommandEnabled(int id) const OVERRIDE; |
(...skipping 16 matching lines...) Expand all Loading... | |
68 | 71 |
69 // Map MenuItems to MenuModels. Used to implement WillShowMenu(). | 72 // Map MenuItems to MenuModels. Used to implement WillShowMenu(). |
70 std::map<MenuItemView*, ui::MenuModel*> menu_map_; | 73 std::map<MenuItemView*, ui::MenuModel*> menu_map_; |
71 | 74 |
72 DISALLOW_COPY_AND_ASSIGN(MenuModelAdapter); | 75 DISALLOW_COPY_AND_ASSIGN(MenuModelAdapter); |
73 }; | 76 }; |
74 | 77 |
75 } // namespace views | 78 } // namespace views |
76 | 79 |
77 #endif // UI_VIEWS_CONTROLS_MENU_MENU_MODEL_ADAPTER_H_ | 80 #endif // UI_VIEWS_CONTROLS_MENU_MENU_MODEL_ADAPTER_H_ |
OLD | NEW |