| OLD | NEW |
| 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 "ui/base/resource/resource_bundle.h" | 7 #include "ui/base/resource/resource_bundle.h" |
| 8 #include "ui/gfx/geometry/vector2d.h" |
| 8 #include "ui/gfx/sys_color_change_listener.h" | 9 #include "ui/gfx/sys_color_change_listener.h" |
| 9 #include "ui/resources/grit/ui_resources.h" | 10 #include "ui/resources/grit/ui_resources.h" |
| 10 #include "ui/views/controls/button/label_button_border.h" | 11 #include "ui/views/controls/button/label_button_border.h" |
| 11 | 12 |
| 12 namespace views { | 13 namespace views { |
| 13 | 14 |
| 14 // static | 15 // static |
| 15 const char BlueButton::kViewClassName[] = "views/BlueButton"; | 16 const char BlueButton::kViewClassName[] = "views/BlueButton"; |
| 16 | 17 |
| 17 BlueButton::BlueButton(ButtonListener* listener, const base::string16& text) | 18 BlueButton::BlueButton(ButtonListener* listener, const base::string16& text) |
| (...skipping 11 matching lines...) Expand all Loading... |
| 29 SetTextColor(STATE_NORMAL, GetNativeTheme()-> | 30 SetTextColor(STATE_NORMAL, GetNativeTheme()-> |
| 30 GetSystemColor(ui::NativeTheme::kColorId_BlueButtonEnabledColor)); | 31 GetSystemColor(ui::NativeTheme::kColorId_BlueButtonEnabledColor)); |
| 31 SetTextColor(STATE_HOVERED, GetNativeTheme()-> | 32 SetTextColor(STATE_HOVERED, GetNativeTheme()-> |
| 32 GetSystemColor(ui::NativeTheme::kColorId_BlueButtonHoverColor)); | 33 GetSystemColor(ui::NativeTheme::kColorId_BlueButtonHoverColor)); |
| 33 SetTextColor(STATE_PRESSED, GetNativeTheme()-> | 34 SetTextColor(STATE_PRESSED, GetNativeTheme()-> |
| 34 GetSystemColor(ui::NativeTheme::kColorId_BlueButtonPressedColor)); | 35 GetSystemColor(ui::NativeTheme::kColorId_BlueButtonPressedColor)); |
| 35 SetTextColor(STATE_DISABLED, GetNativeTheme()-> | 36 SetTextColor(STATE_DISABLED, GetNativeTheme()-> |
| 36 GetSystemColor(ui::NativeTheme::kColorId_BlueButtonDisabledColor)); | 37 GetSystemColor(ui::NativeTheme::kColorId_BlueButtonDisabledColor)); |
| 37 | 38 |
| 38 label()->SetShadows(gfx::ShadowValues( | 39 label()->SetShadows(gfx::ShadowValues( |
| 39 1, | 40 1, gfx::ShadowValue( |
| 40 gfx::ShadowValue( | 41 gfx::Vector2d(0, 1), 0, |
| 41 gfx::Point(0, 1), | 42 GetNativeTheme()->GetSystemColor( |
| 42 0, | 43 ui::NativeTheme::kColorId_BlueButtonShadowColor)))); |
| 43 GetNativeTheme()->GetSystemColor( | |
| 44 ui::NativeTheme::kColorId_BlueButtonShadowColor)))); | |
| 45 } | 44 } |
| 46 } | 45 } |
| 47 | 46 |
| 48 const char* BlueButton::GetClassName() const { | 47 const char* BlueButton::GetClassName() const { |
| 49 return BlueButton::kViewClassName; | 48 return BlueButton::kViewClassName; |
| 50 } | 49 } |
| 51 | 50 |
| 52 scoped_ptr<LabelButtonBorder> BlueButton::CreateDefaultBorder() const { | 51 scoped_ptr<LabelButtonBorder> BlueButton::CreateDefaultBorder() const { |
| 53 // Insets for splitting the images. | 52 // Insets for splitting the images. |
| 54 const gfx::Insets insets(5, 5, 5, 5); | 53 const gfx::Insets insets(5, 5, 5, 5); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 67 button_border->SetPainter(true, STATE_HOVERED, Painter::CreateImagePainter( | 66 button_border->SetPainter(true, STATE_HOVERED, Painter::CreateImagePainter( |
| 68 *rb.GetImageSkiaNamed(IDR_BLUE_BUTTON_FOCUSED_HOVER), insets)); | 67 *rb.GetImageSkiaNamed(IDR_BLUE_BUTTON_FOCUSED_HOVER), insets)); |
| 69 button_border->SetPainter(true, STATE_PRESSED, Painter::CreateImagePainter( | 68 button_border->SetPainter(true, STATE_PRESSED, Painter::CreateImagePainter( |
| 70 *rb.GetImageSkiaNamed(IDR_BLUE_BUTTON_FOCUSED_PRESSED), insets)); | 69 *rb.GetImageSkiaNamed(IDR_BLUE_BUTTON_FOCUSED_PRESSED), insets)); |
| 71 button_border->SetPainter(true, STATE_DISABLED, Painter::CreateImagePainter( | 70 button_border->SetPainter(true, STATE_DISABLED, Painter::CreateImagePainter( |
| 72 *rb.GetImageSkiaNamed(IDR_BLUE_BUTTON_DISABLED), insets)); | 71 *rb.GetImageSkiaNamed(IDR_BLUE_BUTTON_DISABLED), insets)); |
| 73 return button_border.Pass(); | 72 return button_border.Pass(); |
| 74 } | 73 } |
| 75 | 74 |
| 76 } // namespace views | 75 } // namespace views |
| OLD | NEW |