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..979b155841dd180f41e460aa3392a2bc8cb4668f 100644 |
| --- a/ui/views/controls/menu/menu_item_view.h |
| +++ b/ui/views/controls/menu/menu_item_view.h |
| @@ -242,6 +242,11 @@ class VIEWS_EXPORT MenuItemView : public View { |
| // Returns the icon. |
| const gfx::ImageSkia& GetIcon() const { return icon_; } |
| + // 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(); |
|
Aaron Boodman
2012/06/19 00:06:33
If these are just simple getters and setters, the
Aaron Boodman
2012/06/19 21:45:38
Nevermind, I forgot to remove this comment.
|
| + |
| // Sets the command id of this menu item. |
| void SetCommand(int command) { command_ = command; } |
| @@ -277,6 +282,10 @@ class VIEWS_EXPORT MenuItemView : public View { |
| has_icons_ = has_icons; |
| } |
| + void set_has_icon_views(bool has_icon_views) { |
| + has_icon_views_ = has_icon_views; |
| + } |
| + |
| // Returns the descendant with the specified command. |
| MenuItemView* GetMenuItemByID(int id); |
| @@ -310,6 +319,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); |
| @@ -321,13 +333,13 @@ class VIEWS_EXPORT MenuItemView : public View { |
| virtual std::string GetClassName() const OVERRIDE; |
| - private: |
| - friend class internal::MenuRunnerImpl; // For access to ~MenuItemView. |
| - |
| // 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(); |
| + |
| + private: |
| + friend class internal::MenuRunnerImpl; // For access to ~MenuItemView. |
| // Called by the two constructors to initialize this menu item. |
| void Init(MenuItemView* parent, |
| @@ -405,6 +417,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. |
| @@ -445,7 +460,13 @@ class VIEWS_EXPORT MenuItemView : public View { |
| // MenuConfig says mnemonics should be shown. Only used on the root menu item. |
| bool show_mnemonics_; |
| + // One of them is set if menu has icons or icon_views |
| + // (applies to root menu item only). |
| bool has_icons_; |
| + bool has_icon_views_; |
| + |
| + // Menu item has icon view |
| + bool has_icon_view_; |
| // The tooltip to show on hover for this menu item. |
| string16 tooltip_; |