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_BROWSER_TOOLBAR_GTK_H_ | 5 #ifndef CHROME_BROWSER_GTK_BROWSER_TOOLBAR_GTK_H_ |
6 #define CHROME_BROWSER_GTK_BROWSER_TOOLBAR_GTK_H_ | 6 #define CHROME_BROWSER_GTK_BROWSER_TOOLBAR_GTK_H_ |
7 | 7 |
8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 // Create a menu for the toolbar given the icon id and tooltip. Returns the | 102 // Create a menu for the toolbar given the icon id and tooltip. Returns the |
103 // widget created. | 103 // widget created. |
104 GtkWidget* BuildToolbarMenuButton( | 104 GtkWidget* BuildToolbarMenuButton( |
105 int icon_id, | 105 int icon_id, |
106 const std::string& localized_tooltip, | 106 const std::string& localized_tooltip, |
107 OwnedWidgetGtk* owner); | 107 OwnedWidgetGtk* owner); |
108 | 108 |
109 // Connect signals for dragging a url onto the home button. | 109 // Connect signals for dragging a url onto the home button. |
110 void SetUpDragForHomeButton(); | 110 void SetUpDragForHomeButton(); |
111 | 111 |
| 112 // Helper for the PageAppMenu event handlers. Pops down the currently active |
| 113 // meun and pops up the other menu. |
| 114 void ChangeActiveMenu(GtkWidget* active_menu, guint timestamp); |
| 115 |
112 // Gtk callback for the "expose-event" signal. | 116 // Gtk callback for the "expose-event" signal. |
113 static gboolean OnToolbarExpose(GtkWidget* widget, GdkEventExpose* e, | 117 static gboolean OnToolbarExpose(GtkWidget* widget, GdkEventExpose* e, |
114 BrowserToolbarGtk* toolbar); | 118 BrowserToolbarGtk* toolbar); |
115 | 119 |
116 // Gtk callback for the "clicked" signal. | 120 // Gtk callback for the "clicked" signal. |
117 static void OnButtonClick(GtkWidget* button, BrowserToolbarGtk* toolbar); | 121 static void OnButtonClick(GtkWidget* button, BrowserToolbarGtk* toolbar); |
118 | 122 |
119 // Gtk callback for the "button-release-event" signal. | 123 // Gtk callback for the "button-release-event" signal. |
120 static gboolean OnButtonRelease(GtkWidget* button, GdkEventButton* event, | 124 static gboolean OnButtonRelease(GtkWidget* button, GdkEventButton* event, |
121 BrowserToolbarGtk* toolbar); | 125 BrowserToolbarGtk* toolbar); |
122 | 126 |
123 // Gtk callback to intercept mouse clicks to the menu buttons. | 127 // Gtk callback to intercept mouse clicks to the menu buttons. |
124 static gboolean OnMenuButtonPressEvent(GtkWidget* button, | 128 static gboolean OnMenuButtonPressEvent(GtkWidget* button, |
125 GdkEventButton* event, | 129 GdkEventButton* event, |
126 BrowserToolbarGtk* toolbar); | 130 BrowserToolbarGtk* toolbar); |
127 | 131 |
128 // Used for drags onto home button. | 132 // Used for drags onto home button. |
129 static void OnDragDataReceived(GtkWidget* widget, | 133 static void OnDragDataReceived(GtkWidget* widget, |
130 GdkDragContext* drag_context, | 134 GdkDragContext* drag_context, |
131 gint x, gint y, | 135 gint x, gint y, |
132 GtkSelectionData* data, | 136 GtkSelectionData* data, |
133 guint info, guint time, | 137 guint info, guint time, |
134 BrowserToolbarGtk* toolbar); | 138 BrowserToolbarGtk* toolbar); |
135 | 139 |
| 140 // These event handlers are used to fake menu-bar behavior in the page and |
| 141 // app menus. |
| 142 static gboolean OnPageAppMenuMouseMotion(GtkWidget* widget, |
| 143 GdkEventMotion* event, |
| 144 BrowserToolbarGtk* toolbar); |
| 145 static void OnPageAppMenuMoveCurrent(GtkWidget* widget, |
| 146 GtkMenuDirectionType dir, |
| 147 BrowserToolbarGtk* toolbar); |
| 148 |
136 // Initialize the background NineBox. | 149 // Initialize the background NineBox. |
137 void InitNineBox(); | 150 void InitNineBox(); |
138 | 151 |
139 // Ninebox for the toolbar background | 152 // Ninebox for the toolbar background |
140 scoped_ptr<NineBox> background_ninebox_; | 153 scoped_ptr<NineBox> background_ninebox_; |
141 | 154 |
142 // Gtk widgets. The toolbar is an hbox with each of the other pieces of the | 155 // Gtk widgets. The toolbar is an hbox with each of the other pieces of the |
143 // toolbar placed side by side. | 156 // toolbar placed side by side. |
144 GtkWidget* toolbar_; | 157 GtkWidget* toolbar_; |
145 | 158 |
(...skipping 24 matching lines...) Expand all Loading... |
170 // Controls whether or not a home button should be shown on the toolbar. | 183 // Controls whether or not a home button should be shown on the toolbar. |
171 BooleanPrefMember show_home_button_; | 184 BooleanPrefMember show_home_button_; |
172 | 185 |
173 // The event state the last time we observed a button release event. | 186 // The event state the last time we observed a button release event. |
174 int last_release_event_flags_; | 187 int last_release_event_flags_; |
175 | 188 |
176 DISALLOW_COPY_AND_ASSIGN(BrowserToolbarGtk); | 189 DISALLOW_COPY_AND_ASSIGN(BrowserToolbarGtk); |
177 }; | 190 }; |
178 | 191 |
179 #endif // CHROME_BROWSER_GTK_BROWSER_TOOLBAR_GTK_H_ | 192 #endif // CHROME_BROWSER_GTK_BROWSER_TOOLBAR_GTK_H_ |
OLD | NEW |