| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/label_button.h" | 5 #include "ui/views/controls/button/label_button.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "grit/ui_resources.h" | 8 #include "grit/ui_resources.h" |
| 9 #include "ui/base/resource/resource_bundle.h" | 9 #include "ui/base/resource/resource_bundle.h" |
| 10 #include "ui/gfx/animation/throb_animation.h" | 10 #include "ui/gfx/animation/throb_animation.h" |
| 11 #include "ui/gfx/sys_color_change_listener.h" | 11 #include "ui/gfx/sys_color_change_listener.h" |
| 12 #include "ui/native_theme/native_theme.h" | 12 #include "ui/native_theme/native_theme.h" |
| 13 #include "ui/views/controls/button/label_button_border.h" | 13 #include "ui/views/controls/button/label_button_border.h" |
| 14 #include "ui/views/focus_border.h" | 14 #include "ui/views/focus_border.h" |
| 15 #include "ui/views/window/dialog_delegate.h" | 15 #include "ui/views/window/dialog_delegate.h" |
| 16 | 16 |
| 17 #if defined(OS_WIN) | 17 #if defined(OS_WIN) |
| 18 #include "ui/native_theme/native_theme_win.h" | 18 #include "ui/native_theme/native_theme_win.h" |
| 19 #endif | 19 #endif |
| 20 | 20 |
| 21 namespace { | 21 namespace { |
| 22 | 22 |
| 23 // The spacing between the icon and text. | 23 // The spacing between the icon and text. |
| 24 const int kSpacing = 5; | 24 const int kSpacing = 5; |
| 25 | 25 |
| 26 // The length of the hover fade animation. | |
| 27 const int kHoverAnimationDurationMs = 170; | |
| 28 | |
| 29 // Default text and shadow colors for STYLE_BUTTON. | 26 // Default text and shadow colors for STYLE_BUTTON. |
| 30 const SkColor kStyleButtonTextColor = SK_ColorBLACK; | 27 const SkColor kStyleButtonTextColor = SK_ColorBLACK; |
| 31 const SkColor kStyleButtonShadowColor = SK_ColorWHITE; | 28 const SkColor kStyleButtonShadowColor = SK_ColorWHITE; |
| 32 | 29 |
| 33 } // namespace | 30 } // namespace |
| 34 | 31 |
| 35 namespace views { | 32 namespace views { |
| 36 | 33 |
| 37 // static | 34 // static |
| 35 const int LabelButton::kHoverAnimationDurationMs = 170; |
| 36 |
| 37 // static |
| 38 const char LabelButton::kViewClassName[] = "LabelButton"; | 38 const char LabelButton::kViewClassName[] = "LabelButton"; |
| 39 | 39 |
| 40 LabelButton::LabelButton(ButtonListener* listener, const string16& text) | 40 LabelButton::LabelButton(ButtonListener* listener, const string16& text) |
| 41 : CustomButton(listener), | 41 : CustomButton(listener), |
| 42 image_(new ImageView()), | 42 image_(new ImageView()), |
| 43 label_(new Label()), | 43 label_(new Label()), |
| 44 button_state_images_(), | 44 button_state_images_(), |
| 45 button_state_colors_(), | 45 button_state_colors_(), |
| 46 explicitly_set_colors_(), | 46 explicitly_set_colors_(), |
| 47 is_default_(false), | 47 is_default_(false), |
| (...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 return ui::NativeTheme::kNormal; | 369 return ui::NativeTheme::kNormal; |
| 370 } | 370 } |
| 371 | 371 |
| 372 ui::NativeTheme::State LabelButton::GetForegroundThemeState( | 372 ui::NativeTheme::State LabelButton::GetForegroundThemeState( |
| 373 ui::NativeTheme::ExtraParams* params) const { | 373 ui::NativeTheme::ExtraParams* params) const { |
| 374 GetExtraParams(params); | 374 GetExtraParams(params); |
| 375 return ui::NativeTheme::kHovered; | 375 return ui::NativeTheme::kHovered; |
| 376 } | 376 } |
| 377 | 377 |
| 378 } // namespace views | 378 } // namespace views |
| OLD | NEW |