Chromium Code Reviews| Index: ui/views/controls/menu/menu_item_view.h |
| diff --git a/ui/views/controls/menu/menu_item_view.h b/ui/views/controls/menu/menu_item_view.h |
| index 6f4b89ad6f60bfacfb1bd74faf8b2c899aa769f0..759a8fb0847bbd1dd196db472d35cbf58a40c8b9 100644 |
| --- a/ui/views/controls/menu/menu_item_view.h |
| +++ b/ui/views/controls/menu/menu_item_view.h |
| @@ -240,7 +240,12 @@ class VIEWS_EXPORT MenuItemView : public View { |
| void SetIcon(const gfx::ImageSkia& icon); |
| // Returns the icon. |
| - const gfx::ImageSkia& GetIcon() const { return icon_; } |
| + const gfx::ImageSkia& GetIcon(); |
| + |
| + // Set/Get a View to be used instead of icon. |
| + // It always be inserted as a first child view. |
| + void SetIconView(View* icon_view); |
| + View* GetIconView(); |
| // Sets the command id of this menu item. |
| void SetCommand(int command) { command_ = command; } |
| @@ -310,6 +315,9 @@ class VIEWS_EXPORT MenuItemView : public View { |
| use_right_margin_ = use_right_margin; |
| } |
| + virtual Border* GetMenuBorder(); |
| + virtual Background* GetMenuBackground(); |
| + |
| protected: |
| // Creates a MenuItemView. This is used by the various AddXXX methods. |
| MenuItemView(MenuItemView* parent, int command, Type type); |
| @@ -327,7 +335,7 @@ class VIEWS_EXPORT MenuItemView : public View { |
| // Calculates all sizes that we can from the OS. |
| // |
| // This is invoked prior to Running a menu. |
| - static void UpdateMenuPartSizes(bool has_icons); |
| + void UpdateMenuPartSizes(); |
| // Called by the two constructors to initialize this menu item. |
| void Init(MenuItemView* parent, |
| @@ -405,6 +413,9 @@ class VIEWS_EXPORT MenuItemView : public View { |
| // that is responsible for rendering the content. |
| bool IsContainer() const; |
| + // Returns true if menu item has non icon view child. |
| + bool HasNonIconChildViews(); |
| + |
| // The delegate. This is only valid for the root menu item. You shouldn't |
| // use this directly, instead use GetDelegate() which walks the tree as |
| // as necessary. |
| @@ -435,8 +446,8 @@ class VIEWS_EXPORT MenuItemView : public View { |
| // Title. |
| string16 title_; |
| - // Icon. |
| - gfx::ImageSkia icon_; |
| + // Empty icon. |
| + static gfx::ImageSkia empty_icon_; |
| // Does the title have a mnemonic? Only useful on the root menu item. |
| bool has_mnemonics_; |
| @@ -445,11 +456,23 @@ class VIEWS_EXPORT MenuItemView : public View { |
| // MenuConfig says mnemonics should be shown. Only used on the root menu item. |
| bool show_mnemonics_; |
| + // Set if menu has icons or icon_views |
| + // (applies to root menu item only). |
| bool has_icons_; |
| + enum IconViewType { |
| + NONE, |
| + IMAGE_VIEW, |
| + SOME_VIEW |
|
Aaron Boodman
2012/06/21 08:15:30
Agree with sky that it would be nicer to have an e
yefimt
2012/06/22 22:14:40
Done.
|
| + }; |
| + // Type of an icon view. |
| + IconViewType icon_view_type_; |
| + |
| // The tooltip to show on hover for this menu item. |
| string16 tooltip_; |
| + static int icon_width_; |
| + |
| // X-coordinate of where the label starts. |
| static int label_start_; |