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

Side by Side Diff: chrome/browser/gtk/browser_toolbar_view_gtk.h

Issue 28105: Implement accelerators in the gtk port. (Closed)
Patch Set: Fixes for evanm Created 11 years, 10 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
OLDNEW
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_BROWSER_TOOLBAR_VIEW_GTK_H_ 5 #ifndef CHROME_BROWSER_GTK_BROWSER_TOOLBAR_VIEW_GTK_H_
6 #define CHROME_BROWSER_GTK_BROWSER_TOOLBAR_VIEW_GTK_H_ 6 #define CHROME_BROWSER_GTK_BROWSER_TOOLBAR_VIEW_GTK_H_
7 7
8 #include <gtk/gtk.h> 8 #include <gtk/gtk.h>
9 #include <string> 9 #include <string>
10 10
(...skipping 17 matching lines...) Expand all
28 public MenuGtk::Delegate, 28 public MenuGtk::Delegate,
29 public NotificationObserver { 29 public NotificationObserver {
30 public: 30 public:
31 // Height of the toolbar, in pixels. 31 // Height of the toolbar, in pixels.
32 static const int kToolbarHeight; 32 static const int kToolbarHeight;
33 33
34 explicit BrowserToolbarGtk(Browser* browser); 34 explicit BrowserToolbarGtk(Browser* browser);
35 virtual ~BrowserToolbarGtk(); 35 virtual ~BrowserToolbarGtk();
36 36
37 // Create the contents of the toolbar 37 // Create the contents of the toolbar
38 void Init(Profile* profile); 38 void Init(Profile* profile, GtkAccelGroup* accel_group);
39 39
40 // Adds this GTK toolbar into a sizing box. 40 // Adds this GTK toolbar into a sizing box.
41 void AddToolbarToBox(GtkWidget* box); 41 void AddToolbarToBox(GtkWidget* box);
42 42
43 // Overridden from CommandUpdater::CommandObserver: 43 // Overridden from CommandUpdater::CommandObserver:
44 virtual void EnabledStateChangedForCommand(int id, bool enabled); 44 virtual void EnabledStateChangedForCommand(int id, bool enabled);
45 45
46 // Overridden from MenuGtk::Delegate: 46 // Overridden from MenuGtk::Delegate:
47 virtual bool IsCommandEnabled(int command_id) const; 47 virtual bool IsCommandEnabled(int command_id) const;
48 virtual bool IsItemChecked(int id) const; 48 virtual bool IsItemChecked(int id) const;
(...skipping 14 matching lines...) Expand all
63 CustomDrawButton* BuildToolbarButton(int normal_id, 63 CustomDrawButton* BuildToolbarButton(int normal_id,
64 int active_id, 64 int active_id,
65 int highlight_id, 65 int highlight_id,
66 int depressed_id, 66 int depressed_id,
67 const std::wstring& localized_tooltip); 67 const std::wstring& localized_tooltip);
68 68
69 CustomContainerButton* BuildToolbarMenuButton( 69 CustomContainerButton* BuildToolbarMenuButton(
70 int icon_id, 70 int icon_id,
71 const std::wstring& localized_tooltip); 71 const std::wstring& localized_tooltip);
72 72
73 // Adds a keyboard accelerator which trigers a button. (i.e., Ctrl+R is now
74 // equivalent to a reload click).
75 void AddAcceleratorToButton(
76 const scoped_ptr<CustomDrawButton>& button,
77 unsigned int accelerator,
78 unsigned int accelerator_mod);
79
73 // Gtk callback for the "activate" signal on the |entry_| widget. Responds to 80 // Gtk callback for the "activate" signal on the |entry_| widget. Responds to
74 // enter. 81 // enter.
75 static void OnEntryActivate(GtkEntry *entry, BrowserToolbarGtk* toolbar); 82 static void OnEntryActivate(GtkEntry *entry, BrowserToolbarGtk* toolbar);
76 83
77 // Gtk callback for the "clicked" signal. 84 // Gtk callback for the "clicked" signal.
78 static void OnButtonClick(GtkWidget* button, BrowserToolbarGtk* toolbar); 85 static void OnButtonClick(GtkWidget* button, BrowserToolbarGtk* toolbar);
79 86
80 // Gtk callback to intercept mouse clicks to the menu buttons. 87 // Gtk callback to intercept mouse clicks to the menu buttons.
81 static gboolean OnMenuButtonPressEvent(GtkWidget* button, 88 static gboolean OnMenuButtonPressEvent(GtkWidget* button,
82 GdkEvent *event, 89 GdkEvent *event,
(...skipping 11 matching lines...) Expand all
94 // Gtk widgets. The toolbar is an hbox with each of the other pieces of the 101 // Gtk widgets. The toolbar is an hbox with each of the other pieces of the
95 // toolbar placed side by side. 102 // toolbar placed side by side.
96 GtkWidget* toolbar_; 103 GtkWidget* toolbar_;
97 104
98 // Tooltip container for all GTK widgets in this class. 105 // Tooltip container for all GTK widgets in this class.
99 GtkTooltips* toolbar_tooltips_; 106 GtkTooltips* toolbar_tooltips_;
100 107
101 // Our temporary URL bar (until we get the omnibox up). 108 // Our temporary URL bar (until we get the omnibox up).
102 GtkWidget* entry_; 109 GtkWidget* entry_;
103 110
111 // A pointer to our window's accelerator list.
112 GtkAccelGroup* accel_group_;
113
104 // All the buttons in the toolbar. 114 // All the buttons in the toolbar.
105 scoped_ptr<CustomDrawButton> back_, forward_; 115 scoped_ptr<CustomDrawButton> back_, forward_;
106 scoped_ptr<CustomDrawButton> reload_; 116 scoped_ptr<CustomDrawButton> reload_;
107 scoped_ptr<CustomDrawButton> home_; // May be NULL. 117 scoped_ptr<CustomDrawButton> home_; // May be NULL.
108 scoped_ptr<CustomDrawButton> star_, go_; 118 scoped_ptr<CustomDrawButton> star_, go_;
109 scoped_ptr<CustomContainerButton> page_menu_button_, app_menu_button_; 119 scoped_ptr<CustomContainerButton> page_menu_button_, app_menu_button_;
110 120
111 // The model that contains the security level, text, icon to display... 121 // The model that contains the security level, text, icon to display...
112 ToolbarModel* model_; 122 ToolbarModel* model_;
113 123
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 // The back/forward menu gets reset every time it is shown. 156 // The back/forward menu gets reset every time it is shown.
147 scoped_ptr<MenuGtk> back_forward_menu_; 157 scoped_ptr<MenuGtk> back_forward_menu_;
148 158
149 scoped_ptr<BackForwardMenuModelGtk> back_menu_model_; 159 scoped_ptr<BackForwardMenuModelGtk> back_menu_model_;
150 scoped_ptr<BackForwardMenuModelGtk> forward_menu_model_; 160 scoped_ptr<BackForwardMenuModelGtk> forward_menu_model_;
151 161
152 ScopedRunnableMethodFactory<BrowserToolbarGtk> show_menu_factory_; 162 ScopedRunnableMethodFactory<BrowserToolbarGtk> show_menu_factory_;
153 }; 163 };
154 164
155 #endif // CHROME_BROWSER_GTK_BROWSER_TOOLBAR_VIEW_GTK_H_ 165 #endif // CHROME_BROWSER_GTK_BROWSER_TOOLBAR_VIEW_GTK_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/gtk/browser_toolbar_view_gtk.cc » ('j') | chrome/browser/tab_contents/web_contents_view_gtk.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698