OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // A helper class that contains the gtk widgets that make up the titlebar. The | 5 // A helper class that contains the gtk widgets that make up the titlebar. The |
6 // titlebar consists of the tabstrip and if the custom chrome frame is turned | 6 // titlebar consists of the tabstrip and if the custom chrome frame is turned |
7 // on, it includes the taller titlebar and minimize, restore, maximize, and | 7 // on, it includes the taller titlebar and minimize, restore, maximize, and |
8 // close buttons. | 8 // close buttons. |
9 | 9 |
10 #ifndef CHROME_BROWSER_UI_GTK_BROWSER_TITLEBAR_H_ | 10 #ifndef CHROME_BROWSER_UI_GTK_BROWSER_TITLEBAR_H_ |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
68 // |web_contents| is the tab that is associated with the window throbber. | 68 // |web_contents| is the tab that is associated with the window throbber. |
69 // |web_contents| can be null. | 69 // |web_contents| can be null. |
70 void UpdateThrobber(content::WebContents* web_contents); | 70 void UpdateThrobber(content::WebContents* web_contents); |
71 | 71 |
72 // On Windows, right clicking in the titlebar background brings up the system | 72 // On Windows, right clicking in the titlebar background brings up the system |
73 // menu. There's no such thing on linux, so we just show the menu items we | 73 // menu. There's no such thing on linux, so we just show the menu items we |
74 // add to the menu. | 74 // add to the menu. |
75 void ShowContextMenu(GdkEventButton* event); | 75 void ShowContextMenu(GdkEventButton* event); |
76 | 76 |
77 // When a panel slides into a new position and the cursor is on the close | 77 // When a panel slides into a new position and the cursor is on the close |
78 // button, the close button does not become clickable. The gtk_widget_show() | 78 // button, the close button does not become clickable. Neither of |
Evan Stade
2012/04/16 19:23:48
grammar
jianli
2012/04/16 23:24:45
Done.
| |
79 // call on panel_wrench_button_ in OnEnterNotify on window_ prevents the | 79 // "enter-notify-event" or "clicked" event on the mouse does not fire. |
80 // close_button_ from getting the enter-notify-event, making it unclickable. | |
81 // This creates a bad experience when a user has multiple panels of the same | 80 // This creates a bad experience when a user has multiple panels of the same |
82 // size (which is typical) and tries closing them all by repeatedly clicking | 81 // size (which is typical) and tries closing them all by repeatedly clicking |
83 // in the same place on the screen. | 82 // in the same place on the screen. |
84 // | 83 // |
85 // Opened a gtk bug for this - | 84 // Opened a gtk bug for this - |
86 // https://bugzilla.gnome.org/show_bug.cgi?id=667841 | 85 // https://bugzilla.gnome.org/show_bug.cgi?id=667841 |
87 void SendEnterNotifyToCloseButtonIfUnderMouse(); | 86 void SendEnterNotifyToCloseButtonIfUnderMouse(); |
jennb
2012/04/16 21:17:05
Is this still needed now that there's no wrench bu
jianli
2012/04/16 23:24:45
Yes, it is still needed. Update comment to make it
| |
88 | 87 |
89 // Returns the window width to display just the icon. | 88 // Returns the window width to display just the icon. |
90 int IconOnlyWidth(); | 89 int IconOnlyWidth(); |
91 | 90 |
92 void ShowPanelWrenchButton(); | |
93 void HidePanelWrenchButton(); | |
94 | |
95 AvatarMenuButtonGtk* avatar_button() { return avatar_button_.get(); } | 91 AvatarMenuButtonGtk* avatar_button() { return avatar_button_.get(); } |
96 | 92 |
97 private: | 93 private: |
98 // A helper class to keep track of which frame of the throbber animation | 94 // A helper class to keep track of which frame of the throbber animation |
99 // we're showing. | 95 // we're showing. |
100 class Throbber { | 96 class Throbber { |
101 public: | 97 public: |
102 Throbber() : current_frame_(0), current_waiting_frame_(0) {} | 98 Throbber() : current_frame_(0), current_waiting_frame_(0) {} |
103 | 99 |
104 // Get the next frame in the animation. The image is owned by the throbber | 100 // Get the next frame in the animation. The image is owned by the throbber |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
168 // Callback for mousewheel events. | 164 // Callback for mousewheel events. |
169 CHROMEGTK_CALLBACK_1(BrowserTitlebar, gboolean, OnScroll, | 165 CHROMEGTK_CALLBACK_1(BrowserTitlebar, gboolean, OnScroll, |
170 GdkEventScroll*); | 166 GdkEventScroll*); |
171 | 167 |
172 // Callback for min/max/close buttons. | 168 // Callback for min/max/close buttons. |
173 CHROMEGTK_CALLBACK_0(BrowserTitlebar, void, OnButtonClicked); | 169 CHROMEGTK_CALLBACK_0(BrowserTitlebar, void, OnButtonClicked); |
174 | 170 |
175 // Callback for favicon/settings buttons. | 171 // Callback for favicon/settings buttons. |
176 CHROMEGTK_CALLBACK_1(BrowserTitlebar, gboolean, | 172 CHROMEGTK_CALLBACK_1(BrowserTitlebar, gboolean, |
177 OnFaviconMenuButtonPressed, GdkEventButton*); | 173 OnFaviconMenuButtonPressed, GdkEventButton*); |
178 CHROMEGTK_CALLBACK_1(BrowserTitlebar, gboolean, | |
179 OnPanelSettingsMenuButtonPressed, GdkEventButton*); | |
180 | 174 |
181 // -- Context Menu ----------------------------------------------------------- | 175 // -- Context Menu ----------------------------------------------------------- |
182 | 176 |
183 // SimpleMenuModel::Delegate implementation: | 177 // SimpleMenuModel::Delegate implementation: |
184 virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE; | 178 virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE; |
185 virtual bool IsCommandIdChecked(int command_id) const OVERRIDE; | 179 virtual bool IsCommandIdChecked(int command_id) const OVERRIDE; |
186 virtual void ExecuteCommand(int command_id) OVERRIDE; | 180 virtual void ExecuteCommand(int command_id) OVERRIDE; |
187 virtual bool GetAcceleratorForCommandId( | 181 virtual bool GetAcceleratorForCommandId( |
188 int command_id, | 182 int command_id, |
189 ui::Accelerator* accelerator) OVERRIDE; | 183 ui::Accelerator* accelerator) OVERRIDE; |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
242 GtkWidget* top_padding_right_; | 236 GtkWidget* top_padding_right_; |
243 | 237 |
244 // Gtk alignment that contains the tab strip. If the user turns off window | 238 // Gtk alignment that contains the tab strip. If the user turns off window |
245 // manager decorations, we draw this taller. | 239 // manager decorations, we draw this taller. |
246 GtkWidget* titlebar_alignment_; | 240 GtkWidget* titlebar_alignment_; |
247 | 241 |
248 // The favicon and page title used when in app mode or popup mode. | 242 // The favicon and page title used when in app mode or popup mode. |
249 GtkWidget* app_mode_favicon_; | 243 GtkWidget* app_mode_favicon_; |
250 GtkWidget* app_mode_title_; | 244 GtkWidget* app_mode_title_; |
251 | 245 |
252 // Wrench icon for panels. This'll only appear when a panel window has focus | |
253 // or mouse is in a panel window. | |
254 scoped_ptr<CustomDrawButton> panel_wrench_button_; | |
255 | |
256 // Whether we are using a custom frame. | 246 // Whether we are using a custom frame. |
257 bool using_custom_frame_; | 247 bool using_custom_frame_; |
258 | 248 |
259 // Whether we have focus (gtk_window_is_active() sometimes returns the wrong | 249 // Whether we have focus (gtk_window_is_active() sometimes returns the wrong |
260 // value, so manually track the focus-in and focus-out events.) | 250 // value, so manually track the focus-in and focus-out events.) |
261 bool window_has_focus_; | 251 bool window_has_focus_; |
262 | 252 |
263 // Whether to display the avatar image on the left or right of the titlebar. | 253 // Whether to display the avatar image on the left or right of the titlebar. |
264 bool display_avatar_on_left_; | 254 bool display_avatar_on_left_; |
265 | 255 |
(...skipping 23 matching lines...) Expand all Loading... | |
289 // The avatar button. | 279 // The avatar button. |
290 scoped_ptr<AvatarMenuButtonGtk> avatar_button_; | 280 scoped_ptr<AvatarMenuButtonGtk> avatar_button_; |
291 | 281 |
292 // Theme provider for building buttons. | 282 // Theme provider for building buttons. |
293 ThemeServiceGtk* theme_service_; | 283 ThemeServiceGtk* theme_service_; |
294 | 284 |
295 content::NotificationRegistrar registrar_; | 285 content::NotificationRegistrar registrar_; |
296 }; | 286 }; |
297 | 287 |
298 #endif // CHROME_BROWSER_UI_GTK_BROWSER_TITLEBAR_H_ | 288 #endif // CHROME_BROWSER_UI_GTK_BROWSER_TITLEBAR_H_ |
OLD | NEW |