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

Side by Side Diff: ui/views/controls/button/blue_button.cc

Issue 309203002: Fix the appearance of Views BlueButtons with GTK theming. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | ui/views/controls/button/label_button.cc » ('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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "ui/views/controls/button/blue_button.h" 5 #include "ui/views/controls/button/blue_button.h"
6 6
7 #include "grit/ui_resources.h" 7 #include "grit/ui_resources.h"
8 #include "ui/base/resource/resource_bundle.h" 8 #include "ui/base/resource/resource_bundle.h"
9 #include "ui/gfx/sys_color_change_listener.h" 9 #include "ui/gfx/sys_color_change_listener.h"
10 #include "ui/views/controls/button/label_button_border.h" 10 #include "ui/views/controls/button/label_button_border.h"
11 11
12 namespace { 12 namespace {
13 13
14 // Default text and shadow colors for the blue button. 14 // Default text and shadow colors for the blue button.
15 const SkColor kBlueButtonTextColor = SK_ColorWHITE; 15 const SkColor kBlueButtonTextColor = SK_ColorWHITE;
16 const SkColor kBlueButtonShadowColor = SkColorSetRGB(0x53, 0x8C, 0xEA); 16 const SkColor kBlueButtonShadowColor = SkColorSetRGB(0x53, 0x8C, 0xEA);
17 17
18 } // namespace 18 } // namespace
19 19
20 namespace views { 20 namespace views {
21 21
22 // static 22 // static
23 const char BlueButton::kViewClassName[] = "views/BlueButton"; 23 const char BlueButton::kViewClassName[] = "views/BlueButton";
24 24
25 BlueButton::BlueButton(ButtonListener* listener, const base::string16& text) 25 BlueButton::BlueButton(ButtonListener* listener, const base::string16& text)
26 : LabelButton(listener, text) { 26 : LabelButton(listener, text) {
27 // Inherit STYLE_BUTTON insets, minimum size, alignment, etc. 27 // Inherit STYLE_BUTTON insets, minimum size, alignment, etc.
28 SetStyle(STYLE_BUTTON); 28 SetStyle(STYLE_BUTTON);
29 UpdateThemedBorder(); 29 // Set the border explicitly, to avoid LinuxUI border theming.
30 SetBorder(CreateDefaultBorder().PassAs<Border>());
30 } 31 }
31 32
32 BlueButton::~BlueButton() {} 33 BlueButton::~BlueButton() {}
33 34
34 void BlueButton::ResetColorsFromNativeTheme() { 35 void BlueButton::ResetColorsFromNativeTheme() {
35 LabelButton::ResetColorsFromNativeTheme(); 36 LabelButton::ResetColorsFromNativeTheme();
36 if (!gfx::IsInvertedColorScheme()) { 37 if (!gfx::IsInvertedColorScheme()) {
37 for (size_t state = STATE_NORMAL; state < STATE_COUNT; ++state) 38 for (size_t state = STATE_NORMAL; state < STATE_COUNT; ++state)
38 SetTextColor(static_cast<ButtonState>(state), kBlueButtonTextColor); 39 SetTextColor(static_cast<ButtonState>(state), kBlueButtonTextColor);
39 label()->SetShadowColors(kBlueButtonShadowColor, kBlueButtonShadowColor); 40 label()->SetShadowColors(kBlueButtonShadowColor, kBlueButtonShadowColor);
(...skipping 23 matching lines...) Expand all
63 button_border->SetPainter(true, STATE_HOVERED, Painter::CreateImagePainter( 64 button_border->SetPainter(true, STATE_HOVERED, Painter::CreateImagePainter(
64 *rb.GetImageSkiaNamed(IDR_BLUE_BUTTON_FOCUSED_HOVER), insets)); 65 *rb.GetImageSkiaNamed(IDR_BLUE_BUTTON_FOCUSED_HOVER), insets));
65 button_border->SetPainter(true, STATE_PRESSED, Painter::CreateImagePainter( 66 button_border->SetPainter(true, STATE_PRESSED, Painter::CreateImagePainter(
66 *rb.GetImageSkiaNamed(IDR_BLUE_BUTTON_FOCUSED_PRESSED), insets)); 67 *rb.GetImageSkiaNamed(IDR_BLUE_BUTTON_FOCUSED_PRESSED), insets));
67 button_border->SetPainter(true, STATE_DISABLED, Painter::CreateImagePainter( 68 button_border->SetPainter(true, STATE_DISABLED, Painter::CreateImagePainter(
68 *rb.GetImageSkiaNamed(IDR_BLUE_BUTTON_DISABLED), insets)); 69 *rb.GetImageSkiaNamed(IDR_BLUE_BUTTON_DISABLED), insets));
69 return button_border.Pass(); 70 return button_border.Pass();
70 } 71 }
71 72
72 } // namespace views 73 } // namespace views
OLDNEW
« no previous file with comments | « no previous file | ui/views/controls/button/label_button.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698