diff options
author | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-20 19:38:43 +0000 |
---|---|---|
committer | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-20 19:38:43 +0000 |
commit | d2c502f0a412ec8cf6da16025bef8b409919c105 (patch) | |
tree | 0bc8057fb2a4b8f4ecfca713503508d5aea35154 /app/menus | |
parent | 7767f0c92e187a611858dc021c77c1d51d50d943 (diff) | |
download | chromium_src-d2c502f0a412ec8cf6da16025bef8b409919c105.zip chromium_src-d2c502f0a412ec8cf6da16025bef8b409919c105.tar.gz chromium_src-d2c502f0a412ec8cf6da16025bef8b409919c105.tar.bz2 |
GTK: The wrench menu should remain open after clicking +/-.
This changes the model so there's a property about whether a button should
dismiss the menu, modifies the GtkCustomMenu[Item] implementation to obey it,
and modifies the BrowserToolbar to update the menu on zoom change.
BUG=48240
TEST=matches windows behaviour
Review URL: http://codereview.chromium.org/3391009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@59963 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'app/menus')
-rw-r--r-- | app/menus/button_menu_item_model.cc | 20 | ||||
-rw-r--r-- | app/menus/button_menu_item_model.h | 9 |
2 files changed, 28 insertions, 1 deletions
diff --git a/app/menus/button_menu_item_model.cc b/app/menus/button_menu_item_model.cc index 3e09253..a7fbcde 100644 --- a/app/menus/button_menu_item_model.cc +++ b/app/menus/button_menu_item_model.cc @@ -18,6 +18,15 @@ string16 ButtonMenuItemModel::Delegate::GetLabelForCommandId( return string16(); } +bool ButtonMenuItemModel::Delegate::IsCommandIdEnabled(int command_id) const { + return true; +} + +bool ButtonMenuItemModel::Delegate::DoesCommandIdDismissMenu( + int command_id) const { + return true; +} + struct ButtonMenuItemModel::Item { int command_id; ButtonType type; @@ -106,10 +115,21 @@ bool ButtonMenuItemModel::IsEnabledAt(int index) const { return IsCommandIdEnabled(items_[index].command_id); } +bool ButtonMenuItemModel::DismissesMenuAt(int index) const { + return DoesCommandIdDismissMenu(items_[index].command_id); +} + bool ButtonMenuItemModel::IsCommandIdEnabled(int command_id) const { if (delegate_) return delegate_->IsCommandIdEnabled(command_id); return true; } +bool ButtonMenuItemModel::DoesCommandIdDismissMenu(int command_id) const { + if (delegate_) + return delegate_->DoesCommandIdDismissMenu(command_id); + return true; +} + + } // namespace menus diff --git a/app/menus/button_menu_item_model.h b/app/menus/button_menu_item_model.h index 606e286..265359b 100644 --- a/app/menus/button_menu_item_model.h +++ b/app/menus/button_menu_item_model.h @@ -31,7 +31,8 @@ class ButtonMenuItemModel { // Performs the action associated with the specified command id. virtual void ExecuteCommand(int command_id) = 0; - virtual bool IsCommandIdEnabled(int command_id) const { return true; } + virtual bool IsCommandIdEnabled(int command_id) const; + virtual bool DoesCommandIdDismissMenu(int command_id) const; protected: virtual ~Delegate() {} @@ -84,9 +85,15 @@ class ButtonMenuItemModel { // Returns the enabled state of the button at |index|. bool IsEnabledAt(int index) const; + // Returns whether clicking on the button at |index| dismisses the menu. + bool DismissesMenuAt(int index) const; + // Returns the enabled state of the command specified by |command_id|. bool IsCommandIdEnabled(int command_id) const; + // Returns whether clicking on |command_id| dismisses the menu. + bool DoesCommandIdDismissMenu(int command_id) const; + const string16& label() const { return item_label_; } private: |