| 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 // 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 // strip, and (maybe) the min, max, close buttons. |container| is the gtk | 43 // strip, and (maybe) the min, max, close buttons. |container| is the gtk |
| 44 // continer that we put the widget into. | 44 // continer that we put the widget into. |
| 45 void Init(); | 45 void Init(); |
| 46 | 46 |
| 47 // Constructs a CustomDraw button given 3 image ids (IDR_), the box to place | 47 // Constructs a CustomDraw button given 3 image ids (IDR_), the box to place |
| 48 // the button into, and a tooltip id (IDS_). | 48 // the button into, and a tooltip id (IDS_). |
| 49 CustomDrawButton* BuildTitlebarButton(int image, int image_pressed, | 49 CustomDrawButton* BuildTitlebarButton(int image, int image_pressed, |
| 50 int image_hot, GtkWidget* box, | 50 int image_hot, GtkWidget* box, |
| 51 int tooltip); | 51 int tooltip); |
| 52 | 52 |
| 53 // Update the titlebar spacing based on the custom frame and maximized state. |
| 54 void UpdateTitlebarAlignment(); |
| 55 |
| 53 // Callback for changes to window state. This includes | 56 // Callback for changes to window state. This includes |
| 54 // maximizing/restoring/minimizing the window. | 57 // maximizing/restoring/minimizing the window. |
| 55 static gboolean OnWindowStateChanged(GtkWindow* window, | 58 static gboolean OnWindowStateChanged(GtkWindow* window, |
| 56 GdkEventWindowState* event, | 59 GdkEventWindowState* event, |
| 57 BrowserTitlebar* titlebar); | 60 BrowserTitlebar* titlebar); |
| 58 | 61 |
| 59 // Callback for min/max/close buttons. | 62 // Callback for min/max/close buttons. |
| 60 static void OnButtonClicked(GtkWidget* button, BrowserTitlebar* window); | 63 static void OnButtonClicked(GtkWidget* button, BrowserTitlebar* window); |
| 61 | 64 |
| 62 // -- Context Menu ----------------------------------------------------------- | 65 // -- Context Menu ----------------------------------------------------------- |
| 63 | 66 |
| 64 // MenuGtk::Delegate implementation: | 67 // MenuGtk::Delegate implementation: |
| 65 virtual bool IsCommandEnabled(int command_id) const; | 68 virtual bool IsCommandEnabled(int command_id) const; |
| 66 virtual bool IsItemChecked(int command_id) const; | 69 virtual bool IsItemChecked(int command_id) const; |
| 67 virtual void ExecuteCommand(int command_id); | 70 virtual void ExecuteCommand(int command_id); |
| 68 | 71 |
| 69 // Pointers to the browser window that owns us and it's GtkWindow. | 72 // Pointers to the browser window that owns us and it's GtkWindow. |
| 70 BrowserWindowGtk* browser_window_; | 73 BrowserWindowGtk* browser_window_; |
| 71 GtkWindow* window_; | 74 GtkWindow* window_; |
| 72 | 75 |
| 73 // The container widget the holds the whole titlebar. | 76 // The container widget the holds the whole titlebar. |
| 74 GtkWidget* container_; | 77 GtkWidget* container_; |
| 75 // Box that holds the min/max/close buttons if the user turns off window | 78 // Box that holds the min/max/close buttons if the user turns off window |
| 76 // manager decorations. | 79 // manager decorations. |
| 77 GtkWidget* titlebar_buttons_box_; | 80 GtkWidget* titlebar_buttons_box_; |
| 78 // Gtk alignment that contains the tab strip. If the user turns off window | 81 // Gtk alignment that contains the tab strip. If the user turns off window |
| 79 // manager decorations, we draw this taller. | 82 // manager decorations, we draw this taller. |
| 80 GtkWidget* titlebar_alignment_; | 83 GtkWidget* titlebar_alignment_; |
| 81 | 84 |
| 85 // Whether we are using a custom frame. |
| 86 bool using_custom_frame_; |
| 87 |
| 82 // Maximize and restore widgets in the titlebar. | 88 // Maximize and restore widgets in the titlebar. |
| 83 scoped_ptr<CustomDrawButton> minimize_button_; | 89 scoped_ptr<CustomDrawButton> minimize_button_; |
| 84 scoped_ptr<CustomDrawButton> maximize_button_; | 90 scoped_ptr<CustomDrawButton> maximize_button_; |
| 85 scoped_ptr<CustomDrawButton> restore_button_; | 91 scoped_ptr<CustomDrawButton> restore_button_; |
| 86 scoped_ptr<CustomDrawButton> close_button_; | 92 scoped_ptr<CustomDrawButton> close_button_; |
| 87 | 93 |
| 88 // The context menu. | 94 // The context menu. |
| 89 scoped_ptr<MenuGtk> context_menu_; | 95 scoped_ptr<MenuGtk> context_menu_; |
| 90 }; | 96 }; |
| 91 | 97 |
| 92 #endif // CHROME_BROWSER_GTK_BROWSER_TITLEBAR_H_ | 98 #endif // CHROME_BROWSER_GTK_BROWSER_TITLEBAR_H_ |
| OLD | NEW |