summaryrefslogtreecommitdiffstats
path: root/views/controls/button
diff options
context:
space:
mode:
Diffstat (limited to 'views/controls/button')
-rw-r--r--views/controls/button/menu_button.cc7
-rw-r--r--views/controls/button/menu_button.h1
2 files changed, 8 insertions, 0 deletions
diff --git a/views/controls/button/menu_button.cc b/views/controls/button/menu_button.cc
index 3af0326..2a63124 100644
--- a/views/controls/button/menu_button.cc
+++ b/views/controls/button/menu_button.cc
@@ -226,6 +226,13 @@ bool MenuButton::OnKeyPressed(const KeyEvent& e) {
return false;
}
+bool MenuButton::OnKeyReleased(const KeyEvent& e) {
+ // Override CustomButton's implementation, which presses the button when
+ // you press space and clicks it when you release space. For a MenuButton
+ // we always activate the menu on key press.
+ return false;
+}
+
// The reason we override View::OnMouseExited is because we get this event when
// we display the menu. If we don't override this method then
// BaseButton::OnMouseExited will get the event and will set the button's state
diff --git a/views/controls/button/menu_button.h b/views/controls/button/menu_button.h
index 1e20250..2876078 100644
--- a/views/controls/button/menu_button.h
+++ b/views/controls/button/menu_button.h
@@ -59,6 +59,7 @@ class MenuButton : public TextButton {
virtual void OnMouseReleased(const MouseEvent& e, bool canceled);
virtual void OnMouseExited(const MouseEvent& event);
virtual bool OnKeyPressed(const KeyEvent& e);
+ virtual bool OnKeyReleased(const KeyEvent& e);
// Accessibility accessors, overridden from View.
virtual bool GetAccessibleDefaultAction(std::wstring* action);