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 da67506ca45ec3244520b05b199ca5c6e1e08c15..bac6b798fda094b6c9d10903c1b4b447e96d1c18 100644 |
| --- a/ui/views/controls/button/menu_button.h |
| +++ b/ui/views/controls/button/menu_button.h |
| @@ -47,6 +47,19 @@ class VIEWS_EXPORT MenuButton : public LabelButton { |
| const gfx::Point& menu_offset() const { return menu_offset_; } |
| void set_menu_offset(int x, int y) { menu_offset_.SetPoint(x, y); } |
| + bool menu_visible() const { return menus_visible_ > 0; } |
| + |
| + // Increases the |menus_visible_| count by one and sets the state to be |
|
sky
2014/09/18 20:02:24
This is very fragile and not something I want in t
Devlin
2014/09/18 20:53:51
The problem with isolating all the logic in the ex
|
| + // pressed. |
| + // This is public because some menus may "attach" themselves to a menu button, |
| + // even if they aren't the main menu for that button (the one run via |
| + // Activate()). |
| + void AttachMenu(); |
| + |
| + // Decreases the |menus_visible_| count by one and sets the state to be |
| + // normal if this was the last visible menu. |
| + void DetachMenu(); |
| + |
| // Activate the button (called when the button is pressed). |
| virtual bool Activate(); |
| @@ -56,13 +69,15 @@ class VIEWS_EXPORT MenuButton : public LabelButton { |
| virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; |
| virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; |
| virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE; |
| - virtual void OnMouseExited(const ui::MouseEvent& event) OVERRIDE; |
| virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; |
| virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE; |
| virtual bool OnKeyReleased(const ui::KeyEvent& event) OVERRIDE; |
| virtual void GetAccessibleState(ui::AXViewState* state) OVERRIDE; |
| protected: |
| + // MenuButton: |
| + virtual bool ShouldRespondToMouseMovement() OVERRIDE; |
| + |
| // Paint the menu marker image. |
| void PaintMenuMarker(gfx::Canvas* canvas); |
| @@ -70,7 +85,7 @@ class VIEWS_EXPORT MenuButton : public LabelButton { |
| virtual gfx::Rect GetChildAreaBounds() OVERRIDE; |
| // True if the menu is currently visible. |
| - bool menu_visible_; |
| + int menus_visible_; |
| // Offset of the associated menu position. |
| gfx::Point menu_offset_; |