diff options
author | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-09 23:58:02 +0000 |
---|---|---|
committer | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-09 23:58:02 +0000 |
commit | 21433c86e0f0acc4faa8194c5a561c80e260024f (patch) | |
tree | 3968ee16eae150ab0ad7423032b0ae7bc720b57b /views/controls/menu/menu_2.h | |
parent | 83119ed160f4203cbb93d83ecf175dfcf0dc3219 (diff) | |
download | chromium_src-21433c86e0f0acc4faa8194c5a561c80e260024f.zip chromium_src-21433c86e0f0acc4faa8194c5a561c80e260024f.tar.gz chromium_src-21433c86e0f0acc4faa8194c5a561c80e260024f.tar.bz2 |
Remove Menu2Delegate interface and fold methods onto Menu2Model instead.
Enhance SimpleMenuModel::Delegate interface to support additional options required by the above.
Make MenuHostWindow process WM_MENUCOMMAND and WM_MENUSELECT - the first so we can determine which index was selected, the second so we can track highlight changes within a menu.
Convert Tab's context menu back to the windows native menu. This will make my life easier when I upgrade chrome_menu.cc to the new API if only the bookmarks menus/context menus are using it.
BUG=none
TEST=page, app menus again, context menu for tabs. open a bunch of tabs, open this page: http://bengoodger.dreamhosters.com/software/chrome/cxmenutest.html, close that tab then right click on the menu quickly. should not crash!
Review URL: http://codereview.chromium.org/118426
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@17996 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/controls/menu/menu_2.h')
-rw-r--r-- | views/controls/menu/menu_2.h | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/views/controls/menu/menu_2.h b/views/controls/menu/menu_2.h index b50efd7..a131ee5 100644 --- a/views/controls/menu/menu_2.h +++ b/views/controls/menu/menu_2.h @@ -87,6 +87,13 @@ class Menu2Model { // Returns the model for the submenu at the specified index. virtual Menu2Model* GetSubmenuModelAt(int index) const = 0; + // Called when the highlighted menu item changes to the item at the specified + // index. + virtual void HighlightChangedTo(int index) = 0; + + // Called when the item at the specified index has been activated. + virtual void ActivatedAt(int index) = 0; + // Retrieves the model and index that contains a specific command id. Returns // true if an item with the specified command id is found. |model| is inout, // and specifies the model to start searching from. @@ -94,18 +101,10 @@ class Menu2Model { int* index); }; -// The Menu2Delegate is an interface implemented by an object that performs -// tasks that the Menu2 cannot itself. -class Menu2Delegate { - public: - // Executes the command with the specified identifier. - virtual void ExecuteCommand(Menu2Model* model, int command_id) = 0; -}; - // A menu. Populated from a model, and relies on a delegate to execute commands. class Menu2 { public: - Menu2(Menu2Model* model, Menu2Delegate* delegate); + explicit Menu2(Menu2Model* model); virtual ~Menu2() {} // How the menu is aligned relative to the point it is shown at. @@ -118,6 +117,9 @@ class Menu2 { // on the platform and type of menu in use. void RunMenuAt(const gfx::Point& point, Alignment alignment); + // Cancels the active menu. + void CancelMenu(); + // Called when the model supplying data to this menu has changed, and the menu // must be rebuilt. void Rebuild(); @@ -131,11 +133,9 @@ class Menu2 { // Accessors. Menu2Model* model() const { return model_; } - Menu2Delegate* delegate() const { return delegate_; } private: Menu2Model* model_; - Menu2Delegate* delegate_; // The object that actually implements the menu. MenuWrapper* wrapper_; |