| Index: views/controls/menu/menu_item_view.h
|
| diff --git a/views/controls/menu/menu_item_view.h b/views/controls/menu/menu_item_view.h
|
| index 229d84e7cb4cfdf458c65ce9ff0cd1a7712b93fb..6fc945e69d3113e60e07c115e47271c4a36360b8 100644
|
| --- a/views/controls/menu/menu_item_view.h
|
| +++ b/views/controls/menu/menu_item_view.h
|
| @@ -13,6 +13,7 @@
|
| #include <windows.h>
|
| #endif
|
|
|
| +#include "base/logging.h"
|
| // TODO(avi): remove when not needed
|
| #include "base/utf_string_conversions.h"
|
| #include "third_party/skia/include/core/SkBitmap.h"
|
| @@ -153,10 +154,10 @@ class MenuItemView : public View {
|
| // ("NULL command, no item selected")
|
| // label The text label shown.
|
| // type The type of item.
|
| - void AppendMenuItem(int item_id,
|
| + MenuItemView* AppendMenuItem(int item_id,
|
| const std::wstring& label,
|
| Type type) {
|
| - AppendMenuItemImpl(item_id, label, SkBitmap(), type);
|
| + return AppendMenuItemImpl(item_id, label, SkBitmap(), type);
|
| }
|
|
|
| // Append a submenu to this menu.
|
| @@ -176,15 +177,15 @@ class MenuItemView : public View {
|
|
|
| // This is a convenience for standard text label menu items where the label
|
| // is provided with this call.
|
| - void AppendMenuItemWithLabel(int item_id,
|
| + MenuItemView* AppendMenuItemWithLabel(int item_id,
|
| const std::wstring& label) {
|
| - AppendMenuItem(item_id, label, NORMAL);
|
| + return AppendMenuItem(item_id, label, NORMAL);
|
| }
|
|
|
| // This is a convenience for text label menu items where the label is
|
| // provided by the delegate.
|
| - void AppendDelegateMenuItem(int item_id) {
|
| - AppendMenuItem(item_id, std::wstring(), NORMAL);
|
| + MenuItemView* AppendDelegateMenuItem(int item_id) {
|
| + return AppendMenuItem(item_id, std::wstring(), NORMAL);
|
| }
|
|
|
| // Adds a separator to this menu
|
| @@ -195,10 +196,10 @@ class MenuItemView : public View {
|
| // Appends a menu item with an icon. This is for the menu item which
|
| // needs an icon. Calling this function forces the Menu class to draw
|
| // the menu, instead of relying on Windows.
|
| - void AppendMenuItemWithIcon(int item_id,
|
| + MenuItemView* AppendMenuItemWithIcon(int item_id,
|
| const std::wstring& label,
|
| const SkBitmap& icon) {
|
| - AppendMenuItemImpl(item_id, label, icon, NORMAL);
|
| + return AppendMenuItemImpl(item_id, label, icon, NORMAL);
|
| }
|
|
|
| // Creates a menu item for the specified entry in the model and appends it as
|
| @@ -305,6 +306,13 @@ class MenuItemView : public View {
|
| // item.
|
| bool has_mnemonics() const { return has_mnemonics_; }
|
|
|
| + // Set top and bottom margins in pixels. If no margin is set or a
|
| + // negative margin is specified then MenuConfig values are used.
|
| + void set_margins(int top_margin, int bottom_margin) {
|
| + top_margin_ = top_margin;
|
| + bottom_margin_ = bottom_margin;
|
| + }
|
| +
|
| protected:
|
| // Creates a MenuItemView. This is used by the various AddXXX methods.
|
| MenuItemView(MenuItemView* parent, int command, Type type);
|
| @@ -447,6 +455,10 @@ class MenuItemView : public View {
|
| // Removed items to be deleted in ChildrenChanged().
|
| std::vector<View*> removed_items_;
|
|
|
| + // Margins in pixels.
|
| + int top_margin_;
|
| + int bottom_margin_;
|
| +
|
| DISALLOW_COPY_AND_ASSIGN(MenuItemView);
|
| };
|
|
|
|
|