diff options
author | jhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-13 20:21:07 +0000 |
---|---|---|
committer | jhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-13 20:21:07 +0000 |
commit | 9735027999ff93d95f526ecdc8a0728d20d5f951 (patch) | |
tree | ab83a60df7a95792afb6014c97f7efb4a3943145 /chrome/browser/gtk | |
parent | 5020d0a7b98471fc48d690a256f428084d8c7ce2 (diff) | |
download | chromium_src-9735027999ff93d95f526ecdc8a0728d20d5f951.zip chromium_src-9735027999ff93d95f526ecdc8a0728d20d5f951.tar.gz chromium_src-9735027999ff93d95f526ecdc8a0728d20d5f951.tar.bz2 |
Re-add tabstrip background rendering with support for themed backgrounds.
Review URL: http://codereview.chromium.org/115313
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@15991 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/gtk')
-rw-r--r-- | chrome/browser/gtk/browser_window_gtk.cc | 2 | ||||
-rw-r--r-- | chrome/browser/gtk/tabs/tab_strip_gtk.cc | 14 | ||||
-rw-r--r-- | chrome/browser/gtk/tabs/tab_strip_gtk.h | 8 |
3 files changed, 19 insertions, 5 deletions
diff --git a/chrome/browser/gtk/browser_window_gtk.cc b/chrome/browser/gtk/browser_window_gtk.cc index 3c40c7f..5a04c61 100644 --- a/chrome/browser/gtk/browser_window_gtk.cc +++ b/chrome/browser/gtk/browser_window_gtk.cc @@ -299,7 +299,7 @@ BrowserWindowGtk::BrowserWindowGtk(Browser* browser) window_vbox_ = gtk_vbox_new(FALSE, 0); tabstrip_.reset(new TabStripGtk(browser_->tabstrip_model())); - tabstrip_->Init(bounds_.width()); + tabstrip_->Init(bounds_.width(), browser_->profile()); tabstrip_->AddTabStripToBox(window_vbox_); // This vbox surrounds the "content": toolbar+page. diff --git a/chrome/browser/gtk/tabs/tab_strip_gtk.cc b/chrome/browser/gtk/tabs/tab_strip_gtk.cc index 2c75bed..cc07a98 100644 --- a/chrome/browser/gtk/tabs/tab_strip_gtk.cc +++ b/chrome/browser/gtk/tabs/tab_strip_gtk.cc @@ -11,6 +11,7 @@ #include "base/gfx/gtk_util.h" #include "base/gfx/point.h" #include "chrome/browser/browser.h" +#include "chrome/browser/browser_theme_provider.h" #include "chrome/browser/gtk/custom_button.h" #include "chrome/browser/gtk/tabs/dragged_tab_controller_gtk.h" #include "chrome/browser/tab_contents/tab_contents.h" @@ -449,13 +450,13 @@ TabStripGtk::~TabStripGtk() { tab_data_.clear(); } -void TabStripGtk::Init(int width) { - ResourceBundle &rb = ResourceBundle::GetSharedInstance(); +void TabStripGtk::Init(int width, Profile* profile) { + ThemeProvider* theme_provider = profile->GetThemeProvider(); model_->AddObserver(this); if (!background) { - background = rb.GetBitmapNamed(IDR_WINDOW_TOP_CENTER); + background = theme_provider->GetBitmapNamed(IDR_THEME_FRAME); } tabstrip_.Own(gtk_fixed_new()); @@ -993,6 +994,8 @@ gboolean TabStripGtk::OnExpose(GtkWidget* widget, GdkEventExpose* event, event->area.height = tabstrip->bounds_.height(); gdk_region_union_with_rect(event->region, &event->area); + tabstrip->PaintBackground(event); + // Paint the New Tab button. gtk_container_propagate_expose(GTK_CONTAINER(tabstrip->tabstrip_.get()), tabstrip->newtab_button_.get()->widget(), event); @@ -1056,6 +1059,11 @@ void TabStripGtk::OnNewTabClicked(GtkWidget* widget, TabStripGtk* tabstrip) { tabstrip->model_->delegate()->AddBlankTab(true); } +void TabStripGtk::PaintBackground(GdkEventExpose* event) { + ChromeCanvasPaint canvas(event); + canvas.TileImageInt(*background, 0, 0, bounds_.width(), bounds_.height()); +} + void TabStripGtk::SetTabBounds(TabGtk* tab, const gfx::Rect& bounds) { tab->SetBounds(bounds); gtk_fixed_move(GTK_FIXED(tabstrip_.get()), tab->widget(), diff --git a/chrome/browser/gtk/tabs/tab_strip_gtk.h b/chrome/browser/gtk/tabs/tab_strip_gtk.h index d79ed11..d5b1244 100644 --- a/chrome/browser/gtk/tabs/tab_strip_gtk.h +++ b/chrome/browser/gtk/tabs/tab_strip_gtk.h @@ -26,7 +26,10 @@ class TabStripGtk : public TabStripModelObserver, virtual ~TabStripGtk(); // Initialize and load the TabStrip into a container. - void Init(int width); + // TODO(jhawkins): We have to pass in |profile| in order to get a pointer to + // the theme provider. In views, all instances of views::View have access to + // the theme provider. + void Init(int width, Profile* profile); void AddTabStripToBox(GtkWidget* box); void Show(); @@ -112,6 +115,9 @@ class TabStripGtk : public TabStripModelObserver, // Handles the clicked signal from the new tab button. static void OnNewTabClicked(GtkWidget* widget, TabStripGtk* tabstrip); + // Renders the tabstrip background. + void PaintBackground(GdkEventExpose* event); + // Sets the bounds of the tab and moves the tab widget to those bounds. void SetTabBounds(TabGtk* tab, const gfx::Rect& bounds); |