OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this |
2 // source code is governed by a BSD-style license that can be found in the | 2 // source code is governed by a BSD-style license that can be found in the |
3 // LICENSE file. | 3 // LICENSE file. |
4 | 4 |
5 #ifndef CONTROLS_MENU_VIEWS_MENU_2_H_ | 5 #ifndef CONTROLS_MENU_VIEWS_MENU_2_H_ |
6 #define CONTROLS_MENU_VIEWS_MENU_2_H_ | 6 #define CONTROLS_MENU_VIEWS_MENU_2_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/gfx/native_widget_types.h" | 10 #include "base/gfx/native_widget_types.h" |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 // Returns the model for the submenu at the specified index. | 87 // Returns the model for the submenu at the specified index. |
88 virtual Menu2Model* GetSubmenuModelAt(int index) const = 0; | 88 virtual Menu2Model* GetSubmenuModelAt(int index) const = 0; |
89 | 89 |
90 // Called when the highlighted menu item changes to the item at the specified | 90 // Called when the highlighted menu item changes to the item at the specified |
91 // index. | 91 // index. |
92 virtual void HighlightChangedTo(int index) = 0; | 92 virtual void HighlightChangedTo(int index) = 0; |
93 | 93 |
94 // Called when the item at the specified index has been activated. | 94 // Called when the item at the specified index has been activated. |
95 virtual void ActivatedAt(int index) = 0; | 95 virtual void ActivatedAt(int index) = 0; |
96 | 96 |
| 97 // Called when the menu is about to be shown. |
| 98 virtual void MenuWillShow() {} |
| 99 |
97 // Retrieves the model and index that contains a specific command id. Returns | 100 // Retrieves the model and index that contains a specific command id. Returns |
98 // true if an item with the specified command id is found. |model| is inout, | 101 // true if an item with the specified command id is found. |model| is inout, |
99 // and specifies the model to start searching from. | 102 // and specifies the model to start searching from. |
100 static bool GetModelAndIndexForCommandId(int command_id, Menu2Model** model, | 103 static bool GetModelAndIndexForCommandId(int command_id, Menu2Model** model, |
101 int* index); | 104 int* index); |
102 }; | 105 }; |
103 | 106 |
104 // A menu. Populated from a model, and relies on a delegate to execute commands. | 107 // A menu. Populated from a model, and relies on a delegate to execute commands. |
105 class Menu2 { | 108 class Menu2 { |
106 public: | 109 public: |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 | 144 |
142 // The object that actually implements the menu. | 145 // The object that actually implements the menu. |
143 MenuWrapper* wrapper_; | 146 MenuWrapper* wrapper_; |
144 | 147 |
145 DISALLOW_COPY_AND_ASSIGN(Menu2); | 148 DISALLOW_COPY_AND_ASSIGN(Menu2); |
146 }; | 149 }; |
147 | 150 |
148 } // namespace views | 151 } // namespace views |
149 | 152 |
150 #endif // CONTROLS_MENU_VIEWS_MENU_2_H_ | 153 #endif // CONTROLS_MENU_VIEWS_MENU_2_H_ |
OLD | NEW |