diff options
author | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-06 22:03:00 +0000 |
---|---|---|
committer | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-06 22:03:00 +0000 |
commit | 29cc841ee15bbb8b31baf7ece0b2a3e2d3b55b5c (patch) | |
tree | 6cc5dd709d48346ba0c6669f67263cbc714fbc9d /chrome/browser/gtk/menu_gtk.h | |
parent | 901065b013787109038f232c0707b245af796599 (diff) | |
download | chromium_src-29cc841ee15bbb8b31baf7ece0b2a3e2d3b55b5c.zip chromium_src-29cc841ee15bbb8b31baf7ece0b2a3e2d3b55b5c.tar.gz chromium_src-29cc841ee15bbb8b31baf7ece0b2a3e2d3b55b5c.tar.bz2 |
Clicking on a folder in the bookmark bar now shows its contents as a menu.
http://crbug.com/11250
Review URL: http://codereview.chromium.org/114005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@15463 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/gtk/menu_gtk.h')
-rw-r--r-- | chrome/browser/gtk/menu_gtk.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/chrome/browser/gtk/menu_gtk.h b/chrome/browser/gtk/menu_gtk.h index 371ed58..b7afd67 100644 --- a/chrome/browser/gtk/menu_gtk.h +++ b/chrome/browser/gtk/menu_gtk.h @@ -7,6 +7,7 @@ #include <gtk/gtk.h> #include <string> +#include <vector> #include "chrome/browser/gtk/standard_menus.h" #include "chrome/common/owned_widget_gtk.h" @@ -48,6 +49,10 @@ class MenuGtk { // These methods are used to build the menu dynamically. void AppendMenuItemWithLabel(int command_id, const std::string& label); + void AppendMenuItemWithIcon(int command_id, const std::string& label, + const SkBitmap& icon); + MenuGtk* AppendSubMenuWithIcon(int command_id, const std::string& label, + const SkBitmap& icon); void AppendSeparator(); // Displays the menu. |timestamp| is the time of activation. The popup is @@ -67,6 +72,11 @@ class MenuGtk { // Closes the menu. void Cancel(); + // Sets an icon for an item with a given item_id. This method searches both + // this MenuGtk object and all child submenus. Returns false if the item with + // |item_id| is not found. + bool SetIcon(const SkBitmap& icon, int item_id); + // Change windows accelerator style to GTK style. (GTK uses _ for // accelerators. Windows uses & with && as an escape for &.) static std::string ConvertAcceleratorsFromWindowsStyle( @@ -79,10 +89,18 @@ class MenuGtk { const MenuCreateMaterial* menu_data, GtkAccelGroup* accel_group); + // Builds a GtkImageMenuItem. + 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(); + // Helper method that sets properties on a GtkMenuItem and then adds it to + // our internal |menu_|. + void AddMenuItemWithId(GtkWidget* menu_item, int id); + // Callback for when a menu item is clicked. Used when the menu is created // via a MenuCreateMaterial. static void OnMenuItemActivated(GtkMenuItem* menuitem, MenuGtk* menu); @@ -116,6 +134,10 @@ class MenuGtk { // gtk_menu_popup() does not appear to take ownership of popup menus, so // MenuGtk explicitly manages the lifetime of the menu. OwnedWidgetGtk menu_; + + // MenuGtk instances of submenus; we keep references to these objects just to + // clean up during our destructor. + std::vector<MenuGtk*> children_; }; #endif // CHROME_BROWSER_GTK_MENU_GTK_H_ |