OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_GTK_MENU_GTK_H_ | 5 #ifndef CHROME_BROWSER_GTK_MENU_GTK_H_ |
6 #define CHROME_BROWSER_GTK_MENU_GTK_H_ | 6 #define CHROME_BROWSER_GTK_MENU_GTK_H_ |
7 | 7 |
8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 20 matching lines...) Expand all Loading... |
31 // Functions needed for creation of non-static menus. | 31 // Functions needed for creation of non-static menus. |
32 virtual int GetItemCount() const { return 0; } | 32 virtual int GetItemCount() const { return 0; } |
33 virtual bool IsItemSeparator(int command_id) const { return false; } | 33 virtual bool IsItemSeparator(int command_id) const { return false; } |
34 virtual std::string GetLabel(int command_id) const { return std::string(); } | 34 virtual std::string GetLabel(int command_id) const { return std::string(); } |
35 virtual bool HasIcon(int command_id) const { return false; } | 35 virtual bool HasIcon(int command_id) const { return false; } |
36 virtual const SkBitmap* GetIcon(int command_id) const { return NULL; } | 36 virtual const SkBitmap* GetIcon(int command_id) const { return NULL; } |
37 }; | 37 }; |
38 | 38 |
39 // Builds a MenuGtk that uses |delegate| to perform actions and |menu_data| | 39 // Builds a MenuGtk that uses |delegate| to perform actions and |menu_data| |
40 // to create the menu. | 40 // to create the menu. |
41 MenuGtk(MenuGtk::Delegate* delegate, const MenuCreateMaterial* menu_data); | 41 MenuGtk(MenuGtk::Delegate* delegate, const MenuCreateMaterial* menu_data, |
| 42 GtkAccelGroup* accel_group); |
42 // Builds a MenuGtk that uses |delegate| to create the menu as well as perform | 43 // Builds a MenuGtk that uses |delegate| to create the menu as well as perform |
43 // actions. | 44 // actions. |
44 explicit MenuGtk(MenuGtk::Delegate* delegate); | 45 explicit MenuGtk(MenuGtk::Delegate* delegate); |
45 ~MenuGtk(); | 46 ~MenuGtk(); |
46 | 47 |
47 // Displays the menu. |timestamp| is the time of activation. | 48 // Displays the menu. |timestamp| is the time of activation. |
48 void Popup(GtkWidget* widget, gint button_type, guint32 timestamp); | 49 void Popup(GtkWidget* widget, gint button_type, guint32 timestamp); |
49 | 50 |
50 // Displays the menu using the button type and timestamp of |event|. | 51 // Displays the menu using the button type and timestamp of |event|. |
51 void Popup(GtkWidget* widget, GdkEvent* event); | 52 void Popup(GtkWidget* widget, GdkEvent* event); |
(...skipping 25 matching lines...) Expand all Loading... |
77 int* y, | 78 int* y, |
78 gboolean* push_in, | 79 gboolean* push_in, |
79 void* void_widget); | 80 void* void_widget); |
80 | 81 |
81 // Sets the check mark and enabled/disabled state on our menu items. | 82 // Sets the check mark and enabled/disabled state on our menu items. |
82 static void SetMenuItemInfo(GtkWidget* widget, void* raw_menu); | 83 static void SetMenuItemInfo(GtkWidget* widget, void* raw_menu); |
83 | 84 |
84 // Queries this object about the menu state. | 85 // Queries this object about the menu state. |
85 MenuGtk::Delegate* delegate_; | 86 MenuGtk::Delegate* delegate_; |
86 | 87 |
| 88 // Accelerator group to add keyboard accelerators to. |
| 89 GtkAccelGroup* accel_group_; |
| 90 |
| 91 // The window this menu is attached to. |
| 92 GtkWindow* window_; |
| 93 |
87 // gtk_menu_popup() does not appear to take ownership of popup menus, so | 94 // gtk_menu_popup() does not appear to take ownership of popup menus, so |
88 // MenuGtk explicitly manages the lifetime of the menu. | 95 // MenuGtk explicitly manages the lifetime of the menu. |
89 GtkWidget* menu_; | 96 GtkWidget* menu_; |
90 }; | 97 }; |
91 | 98 |
92 #endif // CHROME_BROWSER_GTK_MENU_GTK_H_ | 99 #endif // CHROME_BROWSER_GTK_MENU_GTK_H_ |
93 | 100 |
OLD | NEW |