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/text_button.h" | 5 #include "ui/views/controls/button/text_button.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "grit/ui_resources.h" | 10 #include "grit/ui_resources.h" |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
200 has_text_shadow_(false), | 200 has_text_shadow_(false), |
201 active_text_shadow_color_(0), | 201 active_text_shadow_color_(0), |
202 inactive_text_shadow_color_(0), | 202 inactive_text_shadow_color_(0), |
203 text_shadow_offset_(gfx::Point(1, 1)), | 203 text_shadow_offset_(gfx::Point(1, 1)), |
204 min_width_(0), | 204 min_width_(0), |
205 min_height_(0), | 205 min_height_(0), |
206 max_width_(0), | 206 max_width_(0), |
207 show_multiple_icon_states_(true), | 207 show_multiple_icon_states_(true), |
208 is_default_(false), | 208 is_default_(false), |
209 multi_line_(false), | 209 multi_line_(false), |
210 color_(ui::NativeTheme::instance()->GetSystemColor( | |
211 ui::NativeTheme::kColorId_TextButtonEnabledColor)), | |
212 color_enabled_(ui::NativeTheme::instance()->GetSystemColor( | |
213 ui::NativeTheme::kColorId_TextButtonEnabledColor)), | |
214 color_disabled_(ui::NativeTheme::instance()->GetSystemColor( | |
215 ui::NativeTheme::kColorId_TextButtonDisabledColor)), | |
216 color_highlight_(ui::NativeTheme::instance()->GetSystemColor( | |
217 ui::NativeTheme::kColorId_TextButtonHighlightColor)), | |
218 color_hover_(ui::NativeTheme::instance()->GetSystemColor( | |
219 ui::NativeTheme::kColorId_TextButtonHoverColor)), | |
220 use_enabled_color_from_theme_(true), | 210 use_enabled_color_from_theme_(true), |
221 use_disabled_color_from_theme_(true), | 211 use_disabled_color_from_theme_(true), |
222 use_highlight_color_from_theme_(true), | 212 use_highlight_color_from_theme_(true), |
223 use_hover_color_from_theme_(true) { | 213 use_hover_color_from_theme_(true) { |
224 SetText(text); | 214 SetText(text); |
215 // OnNativeThemeChanged sets the color member variables. | |
216 OnNativeThemeChanged(GetNativeTheme()); | |
sky
2012/12/13 00:54:26
Change this so that you aren't invoking a virtual
| |
225 SetAnimationDuration(kHoverAnimationDurationMs); | 217 SetAnimationDuration(kHoverAnimationDurationMs); |
226 } | 218 } |
227 | 219 |
228 TextButtonBase::~TextButtonBase() { | 220 TextButtonBase::~TextButtonBase() { |
229 } | 221 } |
230 | 222 |
231 void TextButtonBase::SetIsDefault(bool is_default) { | 223 void TextButtonBase::SetIsDefault(bool is_default) { |
232 if (is_default == is_default_) | 224 if (is_default == is_default_) |
233 return; | 225 return; |
234 is_default_ = is_default; | 226 is_default_ = is_default; |
(...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
821 // when not using NativeThemeWin. | 813 // when not using NativeThemeWin. |
822 #if defined(OS_WIN) | 814 #if defined(OS_WIN) |
823 if (GetNativeTheme() == ui::NativeThemeWin::instance()) | 815 if (GetNativeTheme() == ui::NativeThemeWin::instance()) |
824 return; | 816 return; |
825 #endif | 817 #endif |
826 params->button.is_focused = HasFocus() && | 818 params->button.is_focused = HasFocus() && |
827 (focusable() || IsAccessibilityFocusable()); | 819 (focusable() || IsAccessibilityFocusable()); |
828 } | 820 } |
829 | 821 |
830 } // namespace views | 822 } // namespace views |
OLD | NEW |