diff options
author | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-07 17:43:01 +0000 |
---|---|---|
committer | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-07 17:43:01 +0000 |
commit | f6c279fc27a38c65d590447297c9d5afcffaf2f3 (patch) | |
tree | 2c86d49544b17bb1df32cccbc23ac5f871d7b79f /chrome | |
parent | 1829837c05b277ec0efbdb6ceda25d9fa4ebfd46 (diff) | |
download | chromium_src-f6c279fc27a38c65d590447297c9d5afcffaf2f3.zip chromium_src-f6c279fc27a38c65d590447297c9d5afcffaf2f3.tar.gz chromium_src-f6c279fc27a38c65d590447297c9d5afcffaf2f3.tar.bz2 |
GTK Themes: Status bubble obeys GTK colors now.
http://crbug.com/13967
Review URL: http://codereview.chromium.org/149259
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@20043 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/gtk/browser_window_gtk.cc | 3 | ||||
-rw-r--r-- | chrome/browser/gtk/status_bubble_gtk.cc | 43 | ||||
-rw-r--r-- | chrome/browser/gtk/status_bubble_gtk.h | 11 |
3 files changed, 49 insertions, 8 deletions
diff --git a/chrome/browser/gtk/browser_window_gtk.cc b/chrome/browser/gtk/browser_window_gtk.cc index 78bc675..57d18c6 100644 --- a/chrome/browser/gtk/browser_window_gtk.cc +++ b/chrome/browser/gtk/browser_window_gtk.cc @@ -745,6 +745,7 @@ void BrowserWindowGtk::UserChangedTheme() { toolbar_->UserChangedTheme(); GtkThemeProperties properties(browser_->profile()); bookmark_bar_->UserChangedTheme(&properties); + status_bubble_->UserChangedTheme(&properties); } int BrowserWindowGtk::GetExtraRenderViewHeight() const { @@ -1053,7 +1054,7 @@ void BrowserWindowGtk::InitWidgets() { infobar_container_->widget(), FALSE, FALSE, 0); - status_bubble_.reset(new StatusBubbleGtk()); + status_bubble_.reset(new StatusBubbleGtk(browser_->profile())); contents_container_.reset(new TabContentsContainerGtk(status_bubble_.get())); contents_container_->AddContainerToBox(render_area_vbox_); diff --git a/chrome/browser/gtk/status_bubble_gtk.cc b/chrome/browser/gtk/status_bubble_gtk.cc index f747570..920803e 100644 --- a/chrome/browser/gtk/status_bubble_gtk.cc +++ b/chrome/browser/gtk/status_bubble_gtk.cc @@ -9,6 +9,7 @@ #include "base/gfx/gtk_util.h" #include "base/message_loop.h" #include "base/string_util.h" +#include "chrome/browser/gtk/gtk_theme_provider.h" #include "chrome/browser/gtk/slide_animator_gtk.h" #include "chrome/common/gtk_util.h" #include "googleurl/src/gurl.h" @@ -31,9 +32,12 @@ static const int kHideDelay = 250; } // namespace -StatusBubbleGtk::StatusBubbleGtk() +StatusBubbleGtk::StatusBubbleGtk(Profile* profile) : timer_factory_(this) { InitWidgets(); + + GtkThemeProperties properties(profile); + UserChangedTheme(&properties); } StatusBubbleGtk::~StatusBubbleGtk() { @@ -113,7 +117,6 @@ void StatusBubbleGtk::MouseMoved() { void StatusBubbleGtk::InitWidgets() { label_ = gtk_label_new(NULL); - gtk_widget_modify_fg(label_, GTK_STATE_NORMAL, &kTextColor); GtkWidget* padding = gtk_alignment_new(0, 0, 1, 1); gtk_alignment_set_padding(GTK_ALIGNMENT(padding), @@ -121,12 +124,40 @@ void StatusBubbleGtk::InitWidgets() { kInternalLeftRightPadding, kInternalLeftRightPadding); gtk_container_add(GTK_CONTAINER(padding), label_); - GtkWidget* bg_box = gtk_event_box_new(); - gtk_container_add(GTK_CONTAINER(bg_box), padding); - gtk_widget_modify_bg(bg_box, GTK_STATE_NORMAL, &kBackgroundColor); + bg_box_ = gtk_event_box_new(); + gtk_container_add(GTK_CONTAINER(bg_box_), padding); - container_.Own(gtk_util::CreateGtkBorderBin(bg_box, &kFrameBorderColor, + container_.Own(gtk_util::CreateGtkBorderBin(bg_box_, &kFrameBorderColor, kBorderPadding, kBorderPadding, kBorderPadding, kBorderPadding)); gtk_widget_set_name(container_.get(), "status-bubble"); gtk_widget_set_app_paintable(container_.get(), TRUE); } + +void StatusBubbleGtk::UserChangedTheme(GtkThemeProperties* properties) { + if (properties->use_gtk_rendering) { + gtk_widget_modify_fg(label_, GTK_STATE_NORMAL, NULL); + gtk_widget_modify_bg(bg_box_, GTK_STATE_NORMAL, NULL); + } else { + // TODO(erg): This is the closest to "text that will look good on a + // toolbar" that I can find. Maybe in later iterations of the theme system, + // there will be a better color to pick. + GdkColor bookmark_text = + properties->GetGdkColor(BrowserThemeProvider::COLOR_BOOKMARK_TEXT); + gtk_widget_modify_fg(label_, GTK_STATE_NORMAL, &bookmark_text); + + GdkColor toolbar_color = + properties->GetGdkColor(BrowserThemeProvider::COLOR_TOOLBAR); + gtk_widget_modify_bg(bg_box_, GTK_STATE_NORMAL, &toolbar_color); + } + + // TODO(erg): I don't know what to do with the status bubble border + // (|container_|). There needs to be a border in GTK mode, and I'm not sure + // which BrowserThemeProvider::COLOR I'm supposed to use here since the Views + // implementation still uses constants in the equivalent, and it's used for + // alpha blending instead of drawing a real border. + // + // This doesn't really matter because this part of the UI needs to be + // rewritten per the UI review anyway; we should be matching windows with a + // semi-transparent, rounded border instead of our constantly + // CreateGtkBorderBin() usage. +} diff --git a/chrome/browser/gtk/status_bubble_gtk.h b/chrome/browser/gtk/status_bubble_gtk.h index 006efd0..0ede1f9 100644 --- a/chrome/browser/gtk/status_bubble_gtk.h +++ b/chrome/browser/gtk/status_bubble_gtk.h @@ -14,7 +14,9 @@ #include "chrome/browser/status_bubble.h" #include "chrome/common/owned_widget_gtk.h" +class GtkThemeProperties; class GURL; +class Profile; // GTK implementation of StatusBubble. Unlike Windows, our status bubble // doesn't have the nice leave-the-window effect since we can't rely on the @@ -22,7 +24,7 @@ class GURL; // We therefore position it absolutely in a GtkFixed, that we don't own. class StatusBubbleGtk : public StatusBubble { public: - StatusBubbleGtk(); + StatusBubbleGtk(Profile* profile); virtual ~StatusBubbleGtk(); // StatusBubble implementation. @@ -41,6 +43,9 @@ class StatusBubbleGtk : public StatusBubble { // identification. GtkWidget* widget() { return container_.get(); } + // Notification from the window that we should retheme ourself. + void UserChangedTheme(GtkThemeProperties* properties); + private: // Sets the text of the label widget and controls visibility. (As contrasted // with setting the current status or URL text, which may be ignored for now). @@ -62,6 +67,10 @@ class StatusBubbleGtk : public StatusBubble { // The GtkLabel holding the text. GtkWidget* label_; + // The background event box. We keep this so we can change its background + // color. + GtkWidget* bg_box_; + // The status text we want to display when there are no URLs to display. std::string status_text_; |