Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(228)

Unified Diff: ui/views/controls/button/menu_button.h

Issue 1904753002: MenuButton: support Mac look & feel (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: only cache one arrow image Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..ece355f0559b06a4c6b770777f36209bf0e8c49a 100644
--- a/ui/views/controls/button/menu_button.h
+++ b/ui/views/controls/button/menu_button.h
@@ -53,12 +53,6 @@ class VIEWS_EXPORT MenuButton : public LabelButton {
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 +79,7 @@ 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;
protected:
// Paint the menu marker image.
@@ -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
tapted 2016/04/27 03:25:11 nit: menubutton -> MenuButton
Elly Fong-Jones 2016/04/28 17:03:12 Done.
+ // 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
@@ -127,11 +126,11 @@ class VIEWS_EXPORT MenuButton : public LabelButton {
// Our listener. Not owned.
MenuButtonListener* listener_;
- // Whether or not we're showing a drop marker.
- bool show_menu_marker_;
+ // The images to draw for the menu marker, if |show_menu_marker_| is true.
tapted 2016/04/27 03:25:11 I think we can keep the old comment, and variable
Elly Fong-Jones 2016/04/28 17:03:12 Done.
+ gfx::ImageSkia marker_image_;
- // The down arrow used to differentiate the menu button from normal buttons.
- const gfx::ImageSkia* menu_marker_;
+ // Whether or not we're showing a drop marker.
+ const bool show_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.

Powered by Google App Engine
This is Rietveld 408576698