Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(161)

Side by Side Diff: chrome/browser/ui/gtk/gtk_menu_creator.h

Issue 6840068: GTK: Add Recently Closed tabs to the History menu in the global menu bar. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Maybe abandoning this way Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_UI_GTK_GTK_MENU_CREATOR_H_
6 #define CHROME_BROWSER_UI_GTK_GTK_MENU_CREATOR_H_
7
8 #include <string>
9
10 class SkBitmap;
11
12 namespace ui {
13 class ButtonMenuItemModel;
14 class MenuModel;
15 }
16
17 typedef struct _GtkAccelGroup GtkAccelGroup;
18 typedef struct _GtkIconSet GtkIconSet;
19 typedef struct _GtkWidget GtkWidget;
20
21 // We have multiple places in the code that actually build menus and have
Evan Stade 2011/04/25 20:08:22 can you make this comment more specific? e.g. give
22 // wildly different requirements.
23 class GtkMenuCreator {
24 public:
25 class IconSource {
26 public:
27 virtual ~IconSource() {}
28
29 // Return true if we should override the "gtk-menu-images" system setting
30 // when showing image menu items for this menu.
31 virtual bool AlwaysShowIconForCmd(int command_id) const;
32
33 // Returns an icon for the menu item, if available.
34 virtual GtkWidget* GetImageForCommandId(int command_id) const;
35
36 // Returns a tinted image used in button in a menu.
37 virtual GtkIconSet* GetIconSetForId(int idr);
38 };
39
40 static GtkWidget* GetDefaultImageForCommandId(int command_id);
41
42 protected:
43 explicit GtkMenuCreator(IconSource* icon_source);
44 virtual ~GtkMenuCreator();
45
46 // Creates the menu items specified in |model| and places them into |menu|.
47 void BuildSubmenuFromModel(ui::MenuModel* model, GtkWidget* menu);
48
49 // Builds a GtkImageMenuItem.
50 GtkWidget* BuildMenuItemWithImage(const std::string& label,
51 const SkBitmap& icon) const;
52
53 GtkWidget* BuildMenuItemWithImage(const std::string& label,
54 GtkWidget* image) const;
55
56 GtkWidget* BuildMenuItemWithLabel(const std::string& label,
57 int command_id) const;
58
59 // Called to build one of our custom menu button items. Some menus we
60 // construct can't support this type (due to tight integration with our
61 // GtkCustomMenu); in that case always return NULL.
62 virtual GtkWidget* BuildButtonMenuItem(ui::ButtonMenuItemModel* model,
63 GtkWidget* menu) = 0;
64
65 // Called after every |menu_item| created. It's this method's responsibility
66 // to add the |menu_item| to |menu|, to hook up signals, etc.
67 virtual GtkWidget* AppendMenuItemToMenu(int index,
68 ui::MenuModel* model,
69 GtkWidget* menu_item,
70 GtkWidget* menu) = 0;
71
72 private:
73 IconSource* icon_source_;
74
75 // For some menu items, we want to show the accelerator, but not actually
76 // explicitly handle it. To this end we connect those menu items' accelerators
77 // to this group, but don't attach this group to any top level window.
78 GtkAccelGroup* dummy_accel_group_;
79 };
80
81 #endif // CHROME_BROWSER_UI_GTK_GTK_MENU_CREATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698