| 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_ITEM_VIEW_H_ | 5 #ifndef UI_VIEWS_CONTROLS_MENU_MENU_ITEM_VIEW_H_ |
| 6 #define UI_VIEWS_CONTROLS_MENU_MENU_ITEM_VIEW_H_ | 6 #define UI_VIEWS_CONTROLS_MENU_MENU_ITEM_VIEW_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "base/string16.h" | 13 #include "base/string16.h" |
| 14 #include "build/build_config.h" | 14 #include "build/build_config.h" |
| 15 #include "ui/base/models/menu_separator_types.h" |
| 15 #include "ui/gfx/image/image_skia.h" | 16 #include "ui/gfx/image/image_skia.h" |
| 16 #include "ui/views/view.h" | 17 #include "ui/views/view.h" |
| 17 | 18 |
| 18 #if defined(OS_WIN) | 19 #if defined(OS_WIN) |
| 19 #include <windows.h> | 20 #include <windows.h> |
| 20 | 21 |
| 21 #include "ui/base/native_theme/native_theme.h" | 22 #include "ui/base/native_theme/native_theme.h" |
| 22 #endif | 23 #endif |
| 23 | 24 |
| 24 namespace gfx { | 25 namespace gfx { |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 | 127 |
| 127 // Hides and cancels the menu. This does nothing if the menu is not open. | 128 // Hides and cancels the menu. This does nothing if the menu is not open. |
| 128 void Cancel(); | 129 void Cancel(); |
| 129 | 130 |
| 130 // Add an item to the menu at a specified index. ChildrenChanged() should | 131 // Add an item to the menu at a specified index. ChildrenChanged() should |
| 131 // called after adding menu items if the menu may be active. | 132 // called after adding menu items if the menu may be active. |
| 132 MenuItemView* AddMenuItemAt(int index, | 133 MenuItemView* AddMenuItemAt(int index, |
| 133 int item_id, | 134 int item_id, |
| 134 const string16& label, | 135 const string16& label, |
| 135 const gfx::ImageSkia& icon, | 136 const gfx::ImageSkia& icon, |
| 136 Type type); | 137 Type type, |
| 138 ui::MenuSeparatorType separator_style); |
| 137 | 139 |
| 138 // Remove an item from the menu at a specified index. | 140 // Remove an item from the menu at a specified index. |
| 139 // ChildrenChanged() should be called after removing menu items (whether | 141 // ChildrenChanged() should be called after removing menu items (whether |
| 140 // the menu may be active or not). | 142 // the menu may be active or not). |
| 141 void RemoveMenuItemAt(int index); | 143 void RemoveMenuItemAt(int index); |
| 142 | 144 |
| 143 // Appends an item to this menu. | 145 // Appends an item to this menu. |
| 144 // item_id The id of the item, used to identify it in delegate callbacks | 146 // item_id The id of the item, used to identify it in delegate callbacks |
| 145 // or (if delegate is NULL) to identify the command associated | 147 // or (if delegate is NULL) to identify the command associated |
| 146 // with this item with the controller specified in the ctor. Note | 148 // with this item with the controller specified in the ctor. Note |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 // a child. |index| should be offset by GetFirstItemIndex() before calling | 188 // a child. |index| should be offset by GetFirstItemIndex() before calling |
| 187 // this function. | 189 // this function. |
| 188 MenuItemView* AppendMenuItemFromModel(ui::MenuModel* model, | 190 MenuItemView* AppendMenuItemFromModel(ui::MenuModel* model, |
| 189 int index, | 191 int index, |
| 190 int id); | 192 int id); |
| 191 | 193 |
| 192 // All the AppendXXX methods funnel into this. | 194 // All the AppendXXX methods funnel into this. |
| 193 MenuItemView* AppendMenuItemImpl(int item_id, | 195 MenuItemView* AppendMenuItemImpl(int item_id, |
| 194 const string16& label, | 196 const string16& label, |
| 195 const gfx::ImageSkia& icon, | 197 const gfx::ImageSkia& icon, |
| 196 Type type); | 198 Type type, |
| 199 ui::MenuSeparatorType separator_style); |
| 197 | 200 |
| 198 // Returns the view that contains child menu items. If the submenu has | 201 // Returns the view that contains child menu items. If the submenu has |
| 199 // not been creates, this creates it. | 202 // not been creates, this creates it. |
| 200 virtual SubmenuView* CreateSubmenu(); | 203 virtual SubmenuView* CreateSubmenu(); |
| 201 | 204 |
| 202 // Returns true if this menu item has a submenu. | 205 // Returns true if this menu item has a submenu. |
| 203 virtual bool HasSubmenu() const; | 206 virtual bool HasSubmenu() const; |
| 204 | 207 |
| 205 // Returns the view containing child menu items. | 208 // Returns the view containing child menu items. |
| 206 virtual SubmenuView* GetSubmenu() const; | 209 virtual SubmenuView* GetSubmenu() const; |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 478 // If set to false, the right margin will be removed for menu lines | 481 // If set to false, the right margin will be removed for menu lines |
| 479 // containing other elements. | 482 // containing other elements. |
| 480 bool use_right_margin_; | 483 bool use_right_margin_; |
| 481 | 484 |
| 482 DISALLOW_COPY_AND_ASSIGN(MenuItemView); | 485 DISALLOW_COPY_AND_ASSIGN(MenuItemView); |
| 483 }; | 486 }; |
| 484 | 487 |
| 485 } // namespace views | 488 } // namespace views |
| 486 | 489 |
| 487 #endif // UI_VIEWS_CONTROLS_MENU_MENU_ITEM_VIEW_H_ | 490 #endif // UI_VIEWS_CONTROLS_MENU_MENU_ITEM_VIEW_H_ |
| OLD | NEW |