| 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. |index| should be offset by GetFirstItemIndex() before calling |
| 184 // this function. |
| 185 MenuItemView* AppendMenuItemFromModel(menus::MenuModel* model, |
| 186 int index, |
| 187 int id); |
| 188 |
| 178 // All the AppendXXX methods funnel into this. | 189 // All the AppendXXX methods funnel into this. |
| 179 MenuItemView* AppendMenuItemImpl(int item_id, | 190 MenuItemView* AppendMenuItemImpl(int item_id, |
| 180 const std::wstring& label, | 191 const std::wstring& label, |
| 181 const SkBitmap& icon, | 192 const SkBitmap& icon, |
| 182 Type type); | 193 Type type); |
| 183 | 194 |
| 184 // Returns the view that contains child menu items. If the submenu has | 195 // Returns the view that contains child menu items. If the submenu has |
| 185 // not been creates, this creates it. | 196 // not been creates, this creates it. |
| 186 virtual SubmenuView* CreateSubmenu(); | 197 virtual SubmenuView* CreateSubmenu(); |
| 187 | 198 |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 397 | 408 |
| 398 // Preferred height of menu items. Reset every time a menu is run. | 409 // Preferred height of menu items. Reset every time a menu is run. |
| 399 static int pref_menu_height_; | 410 static int pref_menu_height_; |
| 400 | 411 |
| 401 DISALLOW_COPY_AND_ASSIGN(MenuItemView); | 412 DISALLOW_COPY_AND_ASSIGN(MenuItemView); |
| 402 }; | 413 }; |
| 403 | 414 |
| 404 } // namespace views | 415 } // namespace views |
| 405 | 416 |
| 406 #endif // VIEWS_CONTROLS_MENU_MENU_ITEM_VIEW_H_ | 417 #endif // VIEWS_CONTROLS_MENU_MENU_ITEM_VIEW_H_ |
| OLD | NEW |