diff options
author | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-12-30 20:51:36 +0000 |
---|---|---|
committer | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-12-30 20:51:36 +0000 |
commit | 295f61885be7e1104502185f3322e3bcacdc5f00 (patch) | |
tree | 89f9d58aec05c4570ff1fd6d456f516e4c401e31 /chrome/browser/gtk/menu_gtk.h | |
parent | d2dc4733d65be32140c3ed84a64d5e24538229ed (diff) | |
download | chromium_src-295f61885be7e1104502185f3322e3bcacdc5f00.zip chromium_src-295f61885be7e1104502185f3322e3bcacdc5f00.tar.gz chromium_src-295f61885be7e1104502185f3322e3bcacdc5f00.tar.bz2 |
Make back forward menu model a MenuModel.
On Linux, implement just enough MenuModel support in GtkMenu. On Linux + windows, remove wrapper classes. On Mac, just change a few function calls around.
BUG=none
TEST=unit test + manually clicking around on it in debug mode
Review URL: http://codereview.chromium.org/501168
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@35389 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/gtk/menu_gtk.h')
-rw-r--r-- | chrome/browser/gtk/menu_gtk.h | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/chrome/browser/gtk/menu_gtk.h b/chrome/browser/gtk/menu_gtk.h index 1e984e4..f25c529 100644 --- a/chrome/browser/gtk/menu_gtk.h +++ b/chrome/browser/gtk/menu_gtk.h @@ -16,6 +16,10 @@ class SkBitmap; +namespace menus { +class MenuModel; +} + struct MenuCreateMaterial; class MenuGtk { @@ -39,12 +43,6 @@ class MenuGtk { // the user clicks away from the menu. virtual void StoppedShowing() {} - // Functions needed for creation of non-static menus. - virtual int GetItemCount() const { return 0; } - virtual bool IsItemSeparator(int command_id) const { return false; } - virtual std::string GetLabel(int command_id) const { return std::string(); } - virtual bool HasIcon(int command_id) const { return false; } - virtual const SkBitmap* GetIcon(int command_id) const { return NULL; } // Return true if we should override the "gtk-menu-images" system setting // when showing image menu items for this menu. virtual bool AlwaysShowImages() const { return false; } @@ -55,8 +53,10 @@ class MenuGtk { MenuGtk(MenuGtk::Delegate* delegate, const MenuCreateMaterial* menu_data, GtkAccelGroup* accel_group); // Creates a MenuGtk that uses |delegate| to perform actions. Builds the - // menu using |delegate| if |load| is true. - MenuGtk(MenuGtk::Delegate* delegate, bool load); + // menu using |model_| if non-NULL. + // TODO(estade): MenuModel support is only partial. Only TYPE_SEPARATOR and + // TYPE_COMMAND are currently implemented. + MenuGtk(MenuGtk::Delegate* delegate, menus::MenuModel* model); ~MenuGtk(); // Initialize GTK signal handlers. @@ -124,9 +124,8 @@ class MenuGtk { GtkWidget* BuildMenuItemWithImage(const std::string& label, const SkBitmap& icon); - // A function that creates a GtkMenu from |delegate_|. This function is not - // recursive and does not support sub-menus. - void BuildMenuFromDelegate(); + // A function that creates a GtkMenu from |model_|. + void BuildMenuFromModel(); // Contains implementation for OnMenuShow. void UpdateMenu(); @@ -146,6 +145,9 @@ class MenuGtk { // Queries this object about the menu state. MenuGtk::Delegate* delegate_; + // If non-NULL, the MenuModel that we use to populate the GTK menu. + menus::MenuModel* model_; + // For some menu items, we want to show the accelerator, but not actually // explicitly handle it. To this end we connect those menu items' accelerators // to this group, but don't attach this group to any top level window. |