Index: ui/views/controls/button/label_button_border.cc |
diff --git a/ui/views/controls/button/label_button_border.cc b/ui/views/controls/button/label_button_border.cc |
index 9b7b13afb69827301f0a9148f75507d726546737..6625dac88281888bd5a0050637fc822b85224f79 100644 |
--- a/ui/views/controls/button/label_button_border.cc |
+++ b/ui/views/controls/button/label_button_border.cc |
@@ -25,6 +25,16 @@ const int kFocusedNormalImages[] = IMAGE_GRID(IDR_BUTTON_FOCUSED_NORMAL); |
const int kFocusedHoveredImages[] = IMAGE_GRID(IDR_BUTTON_FOCUSED_HOVER); |
const int kFocusedPressedImages[] = IMAGE_GRID(IDR_BUTTON_FOCUSED_PRESSED); |
+const int kBlueNormalImages[] = IMAGE_GRID(IDR_BLUE_BUTTON_NORMAL); |
+const int kBlueHoveredImages[] = IMAGE_GRID(IDR_BLUE_BUTTON_HOVER); |
+const int kBluePressedImages[] = IMAGE_GRID(IDR_BLUE_BUTTON_PRESSED); |
+const int kBlueFocusedNormalImages[] = IMAGE_GRID( |
+ IDR_BLUE_BUTTON_FOCUSED_NORMAL); |
+const int kBlueFocusedHoveredImages[] = IMAGE_GRID( |
+ IDR_BLUE_BUTTON_FOCUSED_HOVER); |
+const int kBlueFocusedPressedImages[] = IMAGE_GRID( |
+ IDR_BLUE_BUTTON_FOCUSED_PRESSED); |
+ |
// The text-button hot and pushed image IDs; normal is unadorned by default. |
const int kTextHoveredImages[] = IMAGE_GRID(IDR_TEXTBUTTON_HOVER); |
const int kTextPressedImages[] = IMAGE_GRID(IDR_TEXTBUTTON_PRESSED); |
@@ -87,6 +97,23 @@ LabelButtonBorder::LabelButtonBorder(Button::ButtonStyle style) |
Painter::CreateImageGridPainter(kTextHoveredImages)); |
SetPainter(false, Button::STATE_PRESSED, |
Painter::CreateImageGridPainter(kTextPressedImages)); |
+ } else if (style == Button::STYLE_BLUE_BUTTON) { |
+ SetPainter(false, Button::STATE_NORMAL, |
+ Painter::CreateImageGridPainter(kBlueNormalImages)); |
+ SetPainter(false, Button::STATE_HOVERED, |
+ Painter::CreateImageGridPainter(kBlueHoveredImages)); |
+ SetPainter(false, Button::STATE_PRESSED, |
+ Painter::CreateImageGridPainter(kBluePressedImages)); |
+ SetPainter(false, Button::STATE_DISABLED, |
+ Painter::CreateImageGridPainter(kBlueNormalImages)); |
+ SetPainter(true, Button::STATE_NORMAL, |
+ Painter::CreateImageGridPainter(kBlueFocusedNormalImages)); |
+ SetPainter(true, Button::STATE_HOVERED, |
+ Painter::CreateImageGridPainter(kBlueFocusedHoveredImages)); |
+ SetPainter(true, Button::STATE_PRESSED, |
+ Painter::CreateImageGridPainter(kBlueFocusedPressedImages)); |
+ SetPainter(true, Button::STATE_DISABLED, |
+ Painter::CreateImageGridPainter(kBlueNormalImages)); |
} |
} |
@@ -103,7 +130,8 @@ void LabelButtonBorder::Paint(const View& view, gfx::Canvas* canvas) { |
const ui::Animation* animation = native_theme_delegate->GetThemeAnimation(); |
ui::NativeTheme::State state = native_theme_delegate->GetThemeState(&extra); |
- if (animation && animation->is_animating()) { |
+ if (animation && animation->is_animating() && |
msw
2013/05/16 17:07:36
nit: comment above that this animation is incorrec
benwells
2013/05/17 02:24:32
Done.
|
+ style() != Button::STYLE_BLUE_BUTTON) { |
// Composite the background and foreground painters during state animations. |
int alpha = animation->CurrentValueBetween(0, 0xff); |
state = native_theme_delegate->GetBackgroundThemeState(&extra); |
@@ -116,7 +144,8 @@ void LabelButtonBorder::Paint(const View& view, gfx::Canvas* canvas) { |
PaintHelper(this, canvas, theme, part, state, rect, extra); |
canvas->Restore(); |
} else if (state == ui::NativeTheme::kDisabled && |
- style() == Button::STYLE_BUTTON) { |
+ (style() == Button::STYLE_BUTTON || |
+ style() == Button::STYLE_BLUE_BUTTON)) { |
canvas->SaveLayerAlpha(static_cast<uint8>(0xff / 2)); |
PaintHelper(this, canvas, theme, part, state, rect, extra); |
canvas->Restore(); |
@@ -138,6 +167,8 @@ gfx::Insets LabelButtonBorder::GetInsets() const { |
return gfx::Insets(5, 6, 5, 6); |
if (style() == Button::STYLE_NATIVE_TEXTBUTTON) |
return gfx::Insets(5, 12, 5, 12); |
+ if (style() == Button::STYLE_BLUE_BUTTON) |
msw
2013/05/16 17:07:36
nit: consider moving this up with STYLE_BUTTON, do
benwells
2013/05/17 02:24:32
Done.
|
+ return gfx::Insets(9, 13, 9, 13); |
NOTREACHED(); |
return gfx::Insets(); |
} |