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/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "ui/gfx/animation/throb_animation.h" | 9 #include "ui/gfx/animation/throb_animation.h" |
10 #include "ui/gfx/canvas.h" | 10 #include "ui/gfx/canvas.h" |
11 #include "ui/gfx/font_list.h" | 11 #include "ui/gfx/font_list.h" |
| 12 #include "ui/gfx/geometry/vector2d.h" |
12 #include "ui/gfx/sys_color_change_listener.h" | 13 #include "ui/gfx/sys_color_change_listener.h" |
13 #include "ui/native_theme/native_theme.h" | 14 #include "ui/native_theme/native_theme.h" |
14 #include "ui/views/background.h" | 15 #include "ui/views/background.h" |
15 #include "ui/views/controls/button/label_button_border.h" | 16 #include "ui/views/controls/button/label_button_border.h" |
16 #include "ui/views/painter.h" | 17 #include "ui/views/painter.h" |
17 #include "ui/views/window/dialog_delegate.h" | 18 #include "ui/views/window/dialog_delegate.h" |
18 | 19 |
19 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) | 20 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) |
20 #include "ui/views/linux_ui/linux_ui.h" | 21 #include "ui/views/linux_ui/linux_ui.h" |
21 #endif | 22 #endif |
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 // confusion. These details should either be pushed into ui::NativeThemeWin | 406 // confusion. These details should either be pushed into ui::NativeThemeWin |
406 // or should be obsoleted by rendering buttons with paint calls instead of | 407 // or should be obsoleted by rendering buttons with paint calls instead of |
407 // with static assets. http://crbug.com/350498 | 408 // with static assets. http://crbug.com/350498 |
408 #if !(defined(OS_LINUX) && !defined(OS_CHROMEOS)) | 409 #if !(defined(OS_LINUX) && !defined(OS_CHROMEOS)) |
409 constant_text_color = true; | 410 constant_text_color = true; |
410 colors[STATE_NORMAL] = kStyleButtonTextColor; | 411 colors[STATE_NORMAL] = kStyleButtonTextColor; |
411 label_->SetBackgroundColor(theme->GetSystemColor( | 412 label_->SetBackgroundColor(theme->GetSystemColor( |
412 ui::NativeTheme::kColorId_ButtonBackgroundColor)); | 413 ui::NativeTheme::kColorId_ButtonBackgroundColor)); |
413 label_->SetAutoColorReadabilityEnabled(false); | 414 label_->SetAutoColorReadabilityEnabled(false); |
414 label_->SetShadows(gfx::ShadowValues( | 415 label_->SetShadows(gfx::ShadowValues( |
415 1, gfx::ShadowValue(gfx::Point(0, 1), 0, kStyleButtonShadowColor))); | 416 1, gfx::ShadowValue(gfx::Vector2d(0, 1), 0, kStyleButtonShadowColor))); |
416 #endif | 417 #endif |
417 label_->set_background(NULL); | 418 label_->set_background(NULL); |
418 } else { | 419 } else { |
419 label_->set_background(NULL); | 420 label_->set_background(NULL); |
420 } | 421 } |
421 | 422 |
422 if (constant_text_color) | 423 if (constant_text_color) |
423 colors[STATE_HOVERED] = colors[STATE_PRESSED] = colors[STATE_NORMAL]; | 424 colors[STATE_HOVERED] = colors[STATE_PRESSED] = colors[STATE_NORMAL]; |
424 | 425 |
425 for (size_t state = STATE_NORMAL; state < STATE_COUNT; ++state) { | 426 for (size_t state = STATE_NORMAL; state < STATE_COUNT; ++state) { |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
515 GetExtraParams(params); | 516 GetExtraParams(params); |
516 return ui::NativeTheme::kHovered; | 517 return ui::NativeTheme::kHovered; |
517 } | 518 } |
518 | 519 |
519 void LabelButton::ResetCachedPreferredSize() { | 520 void LabelButton::ResetCachedPreferredSize() { |
520 cached_preferred_size_valid_ = false; | 521 cached_preferred_size_valid_ = false; |
521 cached_preferred_size_ = gfx::Size(); | 522 cached_preferred_size_ = gfx::Size(); |
522 } | 523 } |
523 | 524 |
524 } // namespace views | 525 } // namespace views |
OLD | NEW |