Chromium Code Reviews| Index: ui/views/controls/button/menu_button.h |
| diff --git a/ui/views/controls/button/menu_button.h b/ui/views/controls/button/menu_button.h |
| index 696a94146f3f9868e01e2eca55a00dfab53f5e8e..19e0e13d977409e7f4d36d699e7a532f9305bf66 100644 |
| --- a/ui/views/controls/button/menu_button.h |
| +++ b/ui/views/controls/button/menu_button.h |
| @@ -43,22 +43,12 @@ class VIEWS_EXPORT MenuButton : public LabelButton { |
| static const char kViewClassName[]; |
| - // How much padding to put on the left and right of the menu marker. |
| - static const int kMenuMarkerPaddingLeft; |
| - static const int kMenuMarkerPaddingRight; |
| - |
| // Create a Button. |
| MenuButton(const base::string16& text, |
| MenuButtonListener* menu_button_listener, |
| bool show_menu_marker); |
| ~MenuButton() override; |
| - bool show_menu_marker() const { return show_menu_marker_; } |
| - void set_menu_marker(const gfx::ImageSkia* menu_marker) { |
| - menu_marker_ = menu_marker; |
| - } |
| - const gfx::ImageSkia* menu_marker() const { return menu_marker_; } |
| - |
| const gfx::Point& menu_offset() const { return menu_offset_; } |
| void set_menu_offset(int x, int y) { menu_offset_.SetPoint(x, y); } |
| @@ -85,6 +75,8 @@ class VIEWS_EXPORT MenuButton : public LabelButton { |
| bool OnKeyPressed(const ui::KeyEvent& event) override; |
| bool OnKeyReleased(const ui::KeyEvent& event) override; |
| void GetAccessibleState(ui::AXViewState* state) override; |
| + void OnEnabledChanged() override; |
| + void OnNativeThemeChanged(const ui::NativeTheme* theme) override; |
| protected: |
| // Paint the menu marker image. |
| @@ -99,6 +91,9 @@ class VIEWS_EXPORT MenuButton : public LabelButton { |
| void StateChanged() override; |
| void NotifyClick(const ui::Event& event) override; |
| + // Subclasses that want to use a border can override this method. |
| + virtual bool ShouldUsePlatformStyleBorder() const; |
|
tapted
2016/04/29 06:53:18
nit: usually newly introduced methods come before
Elly Fong-Jones
2016/05/06 21:30:45
Done.
|
| + |
| // Offset of the associated menu position. |
| gfx::Point menu_offset_; |
| @@ -116,6 +111,10 @@ class VIEWS_EXPORT MenuButton : public LabelButton { |
| // use this to make sure a menu is never shown off screen. |
| int GetMaximumScreenXCoordinate(); |
| + // Returns the width of the "shoulder" of the MenuButton, which is the area |
| + // containing the menu marker, and any padding surrounding it. |
| + int GetShoulderWidth() const; |
| + |
| // We use a time object in order to keep track of when the menu was closed. |
| // The time is used for simulating menu behavior for the menu button; that |
| // is, if the menu is shown and the button is pressed, we need to close the |
| @@ -128,10 +127,10 @@ class VIEWS_EXPORT MenuButton : public LabelButton { |
| MenuButtonListener* listener_; |
| // Whether or not we're showing a drop marker. |
| - bool show_menu_marker_; |
| + const bool show_menu_marker_; |
| // The down arrow used to differentiate the menu button from normal buttons. |
| - const gfx::ImageSkia* menu_marker_; |
| + gfx::ImageSkia menu_marker_; |
| // If non-null the destructor sets this to true. This is set while the menu is |
| // showing and used to detect if the menu was deleted while running. |