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..3c5482fb109ae81347dcf098f49b3ea3f4c29946 100644 |
| --- a/ui/views/controls/menu/menu_item_view.h |
| +++ b/ui/views/controls/menu/menu_item_view.h |
| @@ -239,8 +239,10 @@ class VIEWS_EXPORT MenuItemView : public View { |
| // Sets the icon of this menu item. |
| void SetIcon(const gfx::ImageSkia& icon); |
| - // Returns the icon. |
| - const gfx::ImageSkia& GetIcon() const { return icon_; } |
| + // Sets the view used to render the icon. This clobbers any icon set via |
| + // SetIcon(). MenuItemView takes ownership of |icon_view|. |
| + void SetIconView(View* icon_view); |
| + View* GetIconView(); |
|
sky
2012/06/26 21:42:13
GetIconView() -> icon_view() and inline it.
yefimt
2012/06/26 22:50:19
Done.
|
| // Sets the command id of this menu item. |
| void SetCommand(int command) { command_ = command; } |
| @@ -287,7 +289,7 @@ class VIEWS_EXPORT MenuItemView : public View { |
| // Sizes any child views. |
| virtual void Layout() OVERRIDE; |
| - // Returns the amount of space needed to accomodate the accelerator. The |
| + // Returns the amount of space needed to accommodate the accelerator. The |
| // space needed for the accelerator is NOT included in the preferred width. |
| int GetAcceleratorTextWidth(); |
| @@ -327,7 +329,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 +407,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,9 +440,6 @@ class VIEWS_EXPORT MenuItemView : public View { |
| // Title. |
| string16 title_; |
| - // Icon. |
| - gfx::ImageSkia icon_; |
| - |
| // Does the title have a mnemonic? Only useful on the root menu item. |
| bool has_mnemonics_; |
| @@ -445,11 +447,19 @@ 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_; |
| + // Pointer to a view with a menu icon. |
| + View* icon_view_; |
| + |
| // The tooltip to show on hover for this menu item. |
| string16 tooltip_; |
| + // Width of a menu icon area. |
| + static int icon_area_width_; |
| + |
| // X-coordinate of where the label starts. |
| static int label_start_; |