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

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

Issue 2095001: GTK: Support Ambiance/Radiance and Dust button ordering. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: Move the new class into its own file Created 10 years, 7 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 // 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_GTK_BROWSER_TITLEBAR_H_ 10 #ifndef CHROME_BROWSER_GTK_BROWSER_TITLEBAR_H_
(...skipping 21 matching lines...) Expand all
32 public: 32 public:
33 BrowserTitlebar(BrowserWindowGtk* browser_window, GtkWindow* window); 33 BrowserTitlebar(BrowserWindowGtk* browser_window, GtkWindow* window);
34 virtual ~BrowserTitlebar(); 34 virtual ~BrowserTitlebar();
35 35
36 GtkWidget* widget() { 36 GtkWidget* widget() {
37 return container_; 37 return container_;
38 } 38 }
39 39
40 void set_window(GtkWindow* window) { window_ = window; } 40 void set_window(GtkWindow* window) { window_ = window; }
41 41
42 // Builds the buttons based on the metacity |button_string|.
43 void BuildButtons(const std::string& button_string);
44
42 // Update the appearance of the title bar based on whether we're showing a 45 // Update the appearance of the title bar based on whether we're showing a
43 // custom frame or not. If |use_custom_frame| is true, we show an extra 46 // custom frame or not. If |use_custom_frame| is true, we show an extra
44 // tall titlebar and the min/max/close buttons. 47 // tall titlebar and the min/max/close buttons.
45 void UpdateCustomFrame(bool use_custom_frame); 48 void UpdateCustomFrame(bool use_custom_frame);
46 49
47 // Updates the title and icon when in app or popup mode (no tabstrip). 50 // Updates the title and icon when in app or popup mode (no tabstrip).
48 void UpdateTitleAndIcon(); 51 void UpdateTitleAndIcon();
49 52
50 // Called by the browser asking us to update the loading throbber. 53 // Called by the browser asking us to update the loading throbber.
51 // |tab_contents| is the tab that is associated with the window throbber. 54 // |tab_contents| is the tab that is associated with the window throbber.
(...skipping 30 matching lines...) Expand all
82 class ContextMenuModel : public menus::SimpleMenuModel { 85 class ContextMenuModel : public menus::SimpleMenuModel {
83 public: 86 public:
84 explicit ContextMenuModel(menus::SimpleMenuModel::Delegate* delegate); 87 explicit ContextMenuModel(menus::SimpleMenuModel::Delegate* delegate);
85 }; 88 };
86 89
87 // Build the titlebar, the space above the tab 90 // Build the titlebar, the space above the tab
88 // strip, and (maybe) the min, max, close buttons. |container| is the gtk 91 // strip, and (maybe) the min, max, close buttons. |container| is the gtk
89 // continer that we put the widget into. 92 // continer that we put the widget into.
90 void Init(); 93 void Init();
91 94
95 // Lazily builds and returns |titlebar_{left,right}_buttons_vbox_| and their
96 // subtrees. We do this lazily because in most situations, only one of them
97 // is allocated (though the user can (and do) manually mess with their gconf
98 // settings to get absolutely horrid combinations of buttons on both sides.
99 GtkWidget* GetButtonHBox(bool left_side);
100
92 // Constructs a CustomDraw button given 3 image ids (IDR_), the box to place 101 // Constructs a CustomDraw button given 3 image ids (IDR_), the box to place
93 // the button into, and a tooltip id (IDS_). 102 // the button into, and a tooltip id (IDS_).
94 CustomDrawButton* BuildTitlebarButton(int image, int image_pressed, 103 CustomDrawButton* BuildTitlebarButton(int image, int image_pressed,
95 int image_hot, GtkWidget* box, 104 int image_hot, GtkWidget* box,
96 int tooltip); 105 int tooltip);
97 106
98 // Update the titlebar spacing based on the custom frame and maximized state. 107 // Update the titlebar spacing based on the custom frame and maximized state.
99 void UpdateTitlebarAlignment(); 108 void UpdateTitlebarAlignment();
100 109
101 // Updates the color of the title bar. Called whenever we have a state 110 // Updates the color of the title bar. Called whenever we have a state
102 // change in the window. 111 // change in the window.
103 void UpdateTextColor(); 112 void UpdateTextColor();
104 113
105 // Show the menu that the user gets from left-clicking the favicon. 114 // Show the menu that the user gets from left-clicking the favicon.
106 void ShowFaviconMenu(GdkEventButton* event); 115 void ShowFaviconMenu(GdkEventButton* event);
107 116
108 // The maximize button was clicked, take an action depending on which mouse 117 // The maximize button was clicked, take an action depending on which mouse
109 // button the user pressed. 118 // button the user pressed.
110 void MaximizeButtonClicked(); 119 void MaximizeButtonClicked();
111 120
121 // Updates the visibility of the maximize and restore buttons; only one can
122 // be visible at a time.
123 void UpdateMaximizeRestoreVisibility();
124
112 // Callback for changes to window state. This includes 125 // Callback for changes to window state. This includes
113 // maximizing/restoring/minimizing the window. 126 // maximizing/restoring/minimizing the window.
114 static gboolean OnWindowStateChanged(GtkWindow* window, 127 static gboolean OnWindowStateChanged(GtkWindow* window,
115 GdkEventWindowState* event, 128 GdkEventWindowState* event,
116 BrowserTitlebar* titlebar); 129 BrowserTitlebar* titlebar);
117 130
118 // Callback for mousewheel events. 131 // Callback for mousewheel events.
119 static gboolean OnScroll(GtkWidget* widget, GdkEventScroll* event, 132 static gboolean OnScroll(GtkWidget* widget, GdkEventScroll* event,
120 BrowserTitlebar* titlebar); 133 BrowserTitlebar* titlebar);
121 134
(...skipping 18 matching lines...) Expand all
140 const NotificationSource& source, 153 const NotificationSource& source,
141 const NotificationDetails& details); 154 const NotificationDetails& details);
142 155
143 // Overriden from ActiveWindowWatcher::Observer. 156 // Overriden from ActiveWindowWatcher::Observer.
144 virtual void ActiveWindowChanged(GdkWindow* active_window); 157 virtual void ActiveWindowChanged(GdkWindow* active_window);
145 158
146 // Pointers to the browser window that owns us and it's GtkWindow. 159 // Pointers to the browser window that owns us and it's GtkWindow.
147 BrowserWindowGtk* browser_window_; 160 BrowserWindowGtk* browser_window_;
148 GtkWindow* window_; 161 GtkWindow* window_;
149 162
150 // The container widget the holds the whole titlebar. 163 // The container widget the holds the hbox which contains the whole titlebar.
151 GtkWidget* container_; 164 GtkWidget* container_;
152 // Box that holds the min/max/close buttons if the user turns off window 165
153 // manager decorations. 166 // The hbox that contains the whole titlebar.
154 GtkWidget* titlebar_buttons_box_; 167 GtkWidget* container_hbox_;
168
169 // VBoxes that holds the min/max/close buttons box and an optional padding
170 // that defines the skyline if the user turns off window manager decorations.
171 // There is a left and right version of this box since we try to integrate
172 // with the recent Ubuntu theme changes which put the buttons on the left.
173 GtkWidget* titlebar_left_buttons_vbox_;
174 GtkWidget* titlebar_right_buttons_vbox_;
175
176 // HBoxes that contains the actual min/max/close buttons.
177 GtkWidget* titlebar_left_buttons_hbox_;
178 GtkWidget* titlebar_right_buttons_hbox_;
179
180 // Padding between the titlebar buttons and the top of the screen. Only show
181 // when not maximized.
182 GtkWidget* top_padding_left_;
183 GtkWidget* top_padding_right_;
184
155 // Gtk alignment that contains the tab strip. If the user turns off window 185 // Gtk alignment that contains the tab strip. If the user turns off window
156 // manager decorations, we draw this taller. 186 // manager decorations, we draw this taller.
157 GtkWidget* titlebar_alignment_; 187 GtkWidget* titlebar_alignment_;
158 188
159 // Padding between the titlebar buttons and the top of the screen. Only show
160 // when not maximized.
161 GtkWidget* top_padding_;
162
163 // The favicon and page title used when in app mode or popup mode. 189 // The favicon and page title used when in app mode or popup mode.
164 GtkWidget* app_mode_favicon_; 190 GtkWidget* app_mode_favicon_;
165 GtkWidget* app_mode_title_; 191 GtkWidget* app_mode_title_;
166 192
167 // Whether we are using a custom frame. 193 // Whether we are using a custom frame.
168 bool using_custom_frame_; 194 bool using_custom_frame_;
169 195
170 // Whether we have focus (gtk_window_is_active() sometimes returns the wrong 196 // Whether we have focus (gtk_window_is_active() sometimes returns the wrong
171 // value, so manually track the focus-in and focus-out events.) 197 // value, so manually track the focus-in and focus-out events.)
172 bool window_has_focus_; 198 bool window_has_focus_;
(...skipping 21 matching lines...) Expand all
194 // The throbber used when the window is in app mode or popup window mode. 220 // The throbber used when the window is in app mode or popup window mode.
195 Throbber throbber_; 221 Throbber throbber_;
196 222
197 // Theme provider for building buttons. 223 // Theme provider for building buttons.
198 GtkThemeProvider* theme_provider_; 224 GtkThemeProvider* theme_provider_;
199 225
200 NotificationRegistrar registrar_; 226 NotificationRegistrar registrar_;
201 }; 227 };
202 228
203 #endif // CHROME_BROWSER_GTK_BROWSER_TITLEBAR_H_ 229 #endif // CHROME_BROWSER_GTK_BROWSER_TITLEBAR_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/gtk/browser_titlebar.cc » ('j') | chrome/browser/gtk/gconf_titlebar_listener.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698