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

Side by Side Diff: chrome/browser/gtk/tabs/tab_renderer_gtk.cc

Issue 155183: GTK Themes: Use the correct text color in the tab strip. (Closed)
Patch Set: Created 11 years, 5 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
« no previous file with comments | « chrome/browser/gtk/tabs/tab_renderer_gtk.h ('k') | chrome/browser/gtk/tabs/tab_strip_gtk.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "chrome/browser/gtk/tabs/tab_renderer_gtk.h" 5 #include "chrome/browser/gtk/tabs/tab_renderer_gtk.h"
6 6
7 #include "app/gfx/canvas_paint.h" 7 #include "app/gfx/canvas_paint.h"
8 #include "app/l10n_util.h" 8 #include "app/l10n_util.h"
9 #include "app/resource_bundle.h" 9 #include "app/resource_bundle.h"
10 #include "chrome/browser/browser.h" 10 #include "chrome/browser/browser.h"
(...skipping 11 matching lines...) Expand all
22 22
23 const int kLeftPadding = 16; 23 const int kLeftPadding = 16;
24 const int kTopPadding = 6; 24 const int kTopPadding = 6;
25 const int kRightPadding = 15; 25 const int kRightPadding = 15;
26 const int kBottomPadding = 5; 26 const int kBottomPadding = 5;
27 const int kFavIconTitleSpacing = 4; 27 const int kFavIconTitleSpacing = 4;
28 const int kTitleCloseButtonSpacing = 5; 28 const int kTitleCloseButtonSpacing = 5;
29 const int kStandardTitleWidth = 175; 29 const int kStandardTitleWidth = 175;
30 const int kFavIconSize = 16; 30 const int kFavIconSize = 16;
31 const int kDropShadowOffset = 2; 31 const int kDropShadowOffset = 2;
32 const int kSelectedTitleColor = SK_ColorBLACK;
33 const int kUnselectedTitleColor = SkColorSetRGB(64, 64, 64);
34 32
35 // How long the hover state takes. 33 // How long the hover state takes.
36 const int kHoverDurationMs = 90; 34 const int kHoverDurationMs = 90;
37 35
38 // How opaque to make the hover state (out of 1). 36 // How opaque to make the hover state (out of 1).
39 const double kHoverOpacity = 0.33; 37 const double kHoverOpacity = 0.33;
40 38
41 const SkScalar kTabCapWidth = 15; 39 const SkScalar kTabCapWidth = 15;
42 const SkScalar kTabTopCurveWidth = 4; 40 const SkScalar kTabTopCurveWidth = 4;
43 const SkScalar kTabBottomCurveWidth = 3; 41 const SkScalar kTabBottomCurveWidth = 3;
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 86
89 bool TabRendererGtk::initialized_ = false; 87 bool TabRendererGtk::initialized_ = false;
90 TabRendererGtk::TabImage TabRendererGtk::tab_active_ = {0}; 88 TabRendererGtk::TabImage TabRendererGtk::tab_active_ = {0};
91 TabRendererGtk::TabImage TabRendererGtk::tab_inactive_ = {0}; 89 TabRendererGtk::TabImage TabRendererGtk::tab_inactive_ = {0};
92 TabRendererGtk::TabImage TabRendererGtk::tab_alpha = {0}; 90 TabRendererGtk::TabImage TabRendererGtk::tab_alpha = {0};
93 TabRendererGtk::TabImage TabRendererGtk::tab_hover_ = {0}; 91 TabRendererGtk::TabImage TabRendererGtk::tab_hover_ = {0};
94 gfx::Font* TabRendererGtk::title_font_ = NULL; 92 gfx::Font* TabRendererGtk::title_font_ = NULL;
95 int TabRendererGtk::title_font_height_ = 0; 93 int TabRendererGtk::title_font_height_ = 0;
96 int TabRendererGtk::close_button_width_ = 0; 94 int TabRendererGtk::close_button_width_ = 0;
97 int TabRendererGtk::close_button_height_ = 0; 95 int TabRendererGtk::close_button_height_ = 0;
96 SkColor TabRendererGtk::selected_title_color_ = SK_ColorBLACK;
97 SkColor TabRendererGtk::unselected_title_color_ = SkColorSetRGB(64, 64, 64);
98 98
99 //////////////////////////////////////////////////////////////////////////////// 99 ////////////////////////////////////////////////////////////////////////////////
100 // TabRendererGtk::LoadingAnimation, public: 100 // TabRendererGtk::LoadingAnimation, public:
101 // 101 //
102 TabRendererGtk::LoadingAnimation::LoadingAnimation(const Data* data) 102 TabRendererGtk::LoadingAnimation::LoadingAnimation(const Data* data)
103 : data_(data), animation_state_(ANIMATION_NONE), animation_frame_(0) { 103 : data_(data), animation_state_(ANIMATION_NONE), animation_frame_(0) {
104 } 104 }
105 105
106 void TabRendererGtk::LoadingAnimation::ValidateLoadingAnimation( 106 void TabRendererGtk::LoadingAnimation::ValidateLoadingAnimation(
107 AnimationState animation_state) { 107 AnimationState animation_state) {
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 tab_inactive_.image_l = rb.GetBitmapNamed(IDR_TAB_INACTIVE_LEFT); 295 tab_inactive_.image_l = rb.GetBitmapNamed(IDR_TAB_INACTIVE_LEFT);
296 tab_inactive_.image_c = rb.GetBitmapNamed(IDR_TAB_INACTIVE_CENTER); 296 tab_inactive_.image_c = rb.GetBitmapNamed(IDR_TAB_INACTIVE_CENTER);
297 tab_inactive_.image_r = rb.GetBitmapNamed(IDR_TAB_INACTIVE_RIGHT); 297 tab_inactive_.image_r = rb.GetBitmapNamed(IDR_TAB_INACTIVE_RIGHT);
298 tab_inactive_.l_width = tab_inactive_.image_l->width(); 298 tab_inactive_.l_width = tab_inactive_.image_l->width();
299 tab_inactive_.r_width = tab_inactive_.image_r->width(); 299 tab_inactive_.r_width = tab_inactive_.image_r->width();
300 300
301 close_button_width_ = rb.GetBitmapNamed(IDR_TAB_CLOSE)->width(); 301 close_button_width_ = rb.GetBitmapNamed(IDR_TAB_CLOSE)->width();
302 close_button_height_ = rb.GetBitmapNamed(IDR_TAB_CLOSE)->height(); 302 close_button_height_ = rb.GetBitmapNamed(IDR_TAB_CLOSE)->height();
303 } 303 }
304 304
305 // static
306 void TabRendererGtk::SetSelectedTitleColor(SkColor color) {
307 selected_title_color_ = color;
308 }
309
310 // static
311 void TabRendererGtk::SetUnselectedTitleColor(SkColor color) {
312 unselected_title_color_ = color;
313 }
314
305 void TabRendererGtk::SetBounds(const gfx::Rect& bounds) { 315 void TabRendererGtk::SetBounds(const gfx::Rect& bounds) {
306 gtk_widget_set_size_request(tab_.get(), bounds.width(), bounds.height()); 316 gtk_widget_set_size_request(tab_.get(), bounds.width(), bounds.height());
307 bounds_ = bounds; 317 bounds_ = bounds;
308 Layout(); 318 Layout();
309 } 319 }
310 320
311 //////////////////////////////////////////////////////////////////////////////// 321 ////////////////////////////////////////////////////////////////////////////////
312 // TabRendererGtk, protected: 322 // TabRendererGtk, protected:
313 323
314 std::wstring TabRendererGtk::GetTitle() const { 324 std::wstring TabRendererGtk::GetTitle() const {
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 if (title.empty()) { 424 if (title.empty()) {
415 if (data_.loading) { 425 if (data_.loading) {
416 title = l10n_util::GetString(IDS_TAB_LOADING_TITLE); 426 title = l10n_util::GetString(IDS_TAB_LOADING_TITLE);
417 } else { 427 } else {
418 title = l10n_util::GetString(IDS_TAB_UNTITLED_TITLE); 428 title = l10n_util::GetString(IDS_TAB_UNTITLED_TITLE);
419 } 429 }
420 } else { 430 } else {
421 Browser::FormatTitleForDisplay(&title); 431 Browser::FormatTitleForDisplay(&title);
422 } 432 }
423 433
424 SkColor title_color = IsSelected() ? kSelectedTitleColor 434 SkColor title_color = IsSelected() ? selected_title_color_
425 : kUnselectedTitleColor; 435 : unselected_title_color_;
426 canvas->DrawStringInt(title, *title_font_, title_color, title_bounds_.x(), 436 canvas->DrawStringInt(title, *title_font_, title_color, title_bounds_.x(),
427 title_bounds_.y(), title_bounds_.width(), 437 title_bounds_.y(), title_bounds_.width(),
428 title_bounds_.height()); 438 title_bounds_.height());
429 } 439 }
430 440
431 SkBitmap TabRendererGtk::PaintBitmap() { 441 SkBitmap TabRendererGtk::PaintBitmap() {
432 gfx::Canvas canvas(width(), height(), false); 442 gfx::Canvas canvas(width(), height(), false);
433 Paint(&canvas); 443 Paint(&canvas);
434 return canvas.ExtractBitmap(); 444 return canvas.ExtractBitmap();
435 } 445 }
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
746 gfx::Font base_font = rb.GetFont(ResourceBundle::BaseFont); 756 gfx::Font base_font = rb.GetFont(ResourceBundle::BaseFont);
747 title_font_ = new gfx::Font(gfx::Font::CreateFont(base_font.FontName(), 10)); 757 title_font_ = new gfx::Font(gfx::Font::CreateFont(base_font.FontName(), 10));
748 title_font_height_ = title_font_->height(); 758 title_font_height_ = title_font_->height();
749 759
750 InitializeLoadingAnimationData(&rb, &loading_animation_data); 760 InitializeLoadingAnimationData(&rb, &loading_animation_data);
751 761
752 crashed_fav_icon = rb.GetBitmapNamed(IDR_SAD_FAVICON); 762 crashed_fav_icon = rb.GetBitmapNamed(IDR_SAD_FAVICON);
753 763
754 initialized_ = true; 764 initialized_ = true;
755 } 765 }
OLDNEW
« no previous file with comments | « chrome/browser/gtk/tabs/tab_renderer_gtk.h ('k') | chrome/browser/gtk/tabs/tab_strip_gtk.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698