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_ITEM_VIEW_H_ | 5 #ifndef VIEWS_CONTROLS_MENU_MENU_ITEM_VIEW_H_ |
6 #define VIEWS_CONTROLS_MENU_MENU_ITEM_VIEW_H_ | 6 #define VIEWS_CONTROLS_MENU_MENU_ITEM_VIEW_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #if defined(OS_WIN) | 11 #if defined(OS_WIN) |
12 #include <windows.h> | 12 #include <windows.h> |
13 #endif | 13 #endif |
14 | 14 |
15 #include "third_party/skia/include/core/SkBitmap.h" | 15 #include "third_party/skia/include/core/SkBitmap.h" |
16 #include "views/view.h" | 16 #include "views/view.h" |
17 | 17 |
18 #if defined(OS_WIN) | 18 #if defined(OS_WIN) |
19 #include "gfx/native_theme_win.h" | 19 #include "gfx/native_theme_win.h" |
20 #endif | 20 #endif |
21 | 21 |
22 namespace menus { | |
23 class MenuModel; | |
24 } | |
25 | |
22 namespace views { | 26 namespace views { |
23 | 27 |
24 class MenuButton; | 28 class MenuButton; |
25 class MenuController; | 29 class MenuController; |
26 class MenuDelegate; | 30 class MenuDelegate; |
27 class SubmenuView; | 31 class SubmenuView; |
28 | 32 |
29 // MenuItemView -------------------------------------------------------------- | 33 // MenuItemView -------------------------------------------------------------- |
30 | 34 |
31 // MenuItemView represents a single menu item with a label and optional icon. | 35 // MenuItemView represents a single menu item with a label and optional icon. |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
168 | 172 |
169 // Appends a menu item with an icon. This is for the menu item which | 173 // Appends a menu item with an icon. This is for the menu item which |
170 // needs an icon. Calling this function forces the Menu class to draw | 174 // needs an icon. Calling this function forces the Menu class to draw |
171 // the menu, instead of relying on Windows. | 175 // the menu, instead of relying on Windows. |
172 void AppendMenuItemWithIcon(int item_id, | 176 void AppendMenuItemWithIcon(int item_id, |
173 const std::wstring& label, | 177 const std::wstring& label, |
174 const SkBitmap& icon) { | 178 const SkBitmap& icon) { |
175 AppendMenuItemImpl(item_id, label, icon, NORMAL); | 179 AppendMenuItemImpl(item_id, label, icon, NORMAL); |
176 } | 180 } |
177 | 181 |
182 // Creates a menu item for the specified entry in the model and appends it as | |
183 // a child. | |
184 MenuItemView* AppendMenuItemFromModel(menus::MenuModel* model, | |
185 int index, | |
sky
2010/11/22 19:23:01
index->model_index. Document that the index has al
sadrul
2010/11/22 19:42:38
Done.
| |
186 int id); | |
187 | |
178 // All the AppendXXX methods funnel into this. | 188 // All the AppendXXX methods funnel into this. |
179 MenuItemView* AppendMenuItemImpl(int item_id, | 189 MenuItemView* AppendMenuItemImpl(int item_id, |
180 const std::wstring& label, | 190 const std::wstring& label, |
181 const SkBitmap& icon, | 191 const SkBitmap& icon, |
182 Type type); | 192 Type type); |
183 | 193 |
184 // Returns the view that contains child menu items. If the submenu has | 194 // Returns the view that contains child menu items. If the submenu has |
185 // not been creates, this creates it. | 195 // not been creates, this creates it. |
186 virtual SubmenuView* CreateSubmenu(); | 196 virtual SubmenuView* CreateSubmenu(); |
187 | 197 |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
397 | 407 |
398 // Preferred height of menu items. Reset every time a menu is run. | 408 // Preferred height of menu items. Reset every time a menu is run. |
399 static int pref_menu_height_; | 409 static int pref_menu_height_; |
400 | 410 |
401 DISALLOW_COPY_AND_ASSIGN(MenuItemView); | 411 DISALLOW_COPY_AND_ASSIGN(MenuItemView); |
402 }; | 412 }; |
403 | 413 |
404 } // namespace views | 414 } // namespace views |
405 | 415 |
406 #endif // VIEWS_CONTROLS_MENU_MENU_ITEM_VIEW_H_ | 416 #endif // VIEWS_CONTROLS_MENU_MENU_ITEM_VIEW_H_ |
OLD | NEW |