| 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_ |
| 11 #define CHROME_BROWSER_GTK_BROWSER_TITLEBAR_H_ | 11 #define CHROME_BROWSER_GTK_BROWSER_TITLEBAR_H_ |
| 12 | 12 |
| 13 #include <gtk/gtk.h> | 13 #include <gtk/gtk.h> |
| 14 | 14 |
| 15 #include "base/scoped_ptr.h" | 15 #include "base/scoped_ptr.h" |
| 16 #include "chrome/browser/gtk/menu_gtk.h" | 16 #include "chrome/browser/gtk/menu_gtk.h" |
| 17 #include "chrome/browser/gtk/nine_box.h" | |
| 18 | 17 |
| 19 class BrowserWindowGtk; | 18 class BrowserWindowGtk; |
| 20 class CustomDrawButton; | 19 class CustomDrawButton; |
| 21 class TabStripGtk; | 20 class TabStripGtk; |
| 22 | 21 |
| 23 class BrowserTitlebar : public MenuGtk::Delegate { | 22 class BrowserTitlebar : public MenuGtk::Delegate { |
| 24 public: | 23 public: |
| 25 BrowserTitlebar(BrowserWindowGtk* browser_window, GtkWindow* window); | 24 BrowserTitlebar(BrowserWindowGtk* browser_window, GtkWindow* window); |
| 26 virtual ~BrowserTitlebar() { } | 25 virtual ~BrowserTitlebar() { } |
| 27 | 26 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 44 // 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 |
| 45 // continer that we put the widget into. | 44 // continer that we put the widget into. |
| 46 void Init(); | 45 void Init(); |
| 47 | 46 |
| 48 // 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 |
| 49 // the button into, and a tooltip id (IDS_). | 48 // the button into, and a tooltip id (IDS_). |
| 50 CustomDrawButton* BuildTitlebarButton(int image, int image_pressed, | 49 CustomDrawButton* BuildTitlebarButton(int image, int image_pressed, |
| 51 int image_hot, GtkWidget* box, | 50 int image_hot, GtkWidget* box, |
| 52 int tooltip); | 51 int tooltip); |
| 53 | 52 |
| 54 // Callback for when the titlebar (include the background of the tab strip) | |
| 55 // needs to be redrawn. | |
| 56 static gboolean OnExpose(GtkWidget* widget, GdkEventExpose* e, | |
| 57 BrowserTitlebar* window); | |
| 58 | |
| 59 // Callback for changes to window state. This includes | 53 // Callback for changes to window state. This includes |
| 60 // maximizing/restoring/minimizing the window. | 54 // maximizing/restoring/minimizing the window. |
| 61 static gboolean OnWindowStateChanged(GtkWindow* window, | 55 static gboolean OnWindowStateChanged(GtkWindow* window, |
| 62 GdkEventWindowState* event, | 56 GdkEventWindowState* event, |
| 63 BrowserTitlebar* titlebar); | 57 BrowserTitlebar* titlebar); |
| 64 | 58 |
| 65 // Callback for min/max/close buttons. | 59 // Callback for min/max/close buttons. |
| 66 static void OnButtonClicked(GtkWidget* button, BrowserTitlebar* window); | 60 static void OnButtonClicked(GtkWidget* button, BrowserTitlebar* window); |
| 67 | 61 |
| 68 // -- Context Menu ----------------------------------------------------------- | 62 // -- Context Menu ----------------------------------------------------------- |
| (...skipping 15 matching lines...) Expand all Loading... |
| 84 // Gtk alignment that contains the tab strip. If the user turns off window | 78 // Gtk alignment that contains the tab strip. If the user turns off window |
| 85 // manager decorations, we draw this taller. | 79 // manager decorations, we draw this taller. |
| 86 GtkWidget* titlebar_alignment_; | 80 GtkWidget* titlebar_alignment_; |
| 87 | 81 |
| 88 // Maximize and restore widgets in the titlebar. | 82 // Maximize and restore widgets in the titlebar. |
| 89 scoped_ptr<CustomDrawButton> minimize_button_; | 83 scoped_ptr<CustomDrawButton> minimize_button_; |
| 90 scoped_ptr<CustomDrawButton> maximize_button_; | 84 scoped_ptr<CustomDrawButton> maximize_button_; |
| 91 scoped_ptr<CustomDrawButton> restore_button_; | 85 scoped_ptr<CustomDrawButton> restore_button_; |
| 92 scoped_ptr<CustomDrawButton> close_button_; | 86 scoped_ptr<CustomDrawButton> close_button_; |
| 93 | 87 |
| 94 // The background of the title bar and tab strip. | |
| 95 scoped_ptr<NineBox> titlebar_background_; | |
| 96 scoped_ptr<NineBox> titlebar_background_otr_; | |
| 97 | |
| 98 // The context menu. | 88 // The context menu. |
| 99 scoped_ptr<MenuGtk> context_menu_; | 89 scoped_ptr<MenuGtk> context_menu_; |
| 100 }; | 90 }; |
| 101 | 91 |
| 102 #endif // CHROME_BROWSER_GTK_BROWSER_TITLEBAR_H_ | 92 #endif // CHROME_BROWSER_GTK_BROWSER_TITLEBAR_H_ |
| OLD | NEW |