Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Side by Side Diff: ui/views/controls/button/text_button.cc

Issue 23531053: ui/base/animation -> ui/gfx/animation (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge 2 trunk Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/views/controls/button/text_button.h ('k') | ui/views/controls/glow_hover_controller.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 #include "ui/base/animation/throb_animation.h"
12 #include "ui/base/resource/resource_bundle.h" 11 #include "ui/base/resource/resource_bundle.h"
12 #include "ui/gfx/animation/throb_animation.h"
13 #include "ui/gfx/canvas.h" 13 #include "ui/gfx/canvas.h"
14 #include "ui/gfx/image/image.h" 14 #include "ui/gfx/image/image.h"
15 #include "ui/views/controls/button/button.h" 15 #include "ui/views/controls/button/button.h"
16 #include "ui/views/focus_border.h" 16 #include "ui/views/focus_border.h"
17 #include "ui/views/widget/widget.h" 17 #include "ui/views/widget/widget.h"
18 18
19 #if defined(OS_WIN) 19 #if defined(OS_WIN)
20 #include "skia/ext/skia_utils_win.h" 20 #include "skia/ext/skia_utils_win.h"
21 #include "ui/gfx/platform_font_win.h" 21 #include "ui/gfx/platform_font_win.h"
22 #include "ui/native_theme/native_theme_win.h" 22 #include "ui/native_theme/native_theme_win.h"
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 338
339 void TextButtonBase::OnPaint(gfx::Canvas* canvas) { 339 void TextButtonBase::OnPaint(gfx::Canvas* canvas) {
340 PaintButton(canvas, PB_NORMAL); 340 PaintButton(canvas, PB_NORMAL);
341 } 341 }
342 342
343 void TextButtonBase::OnBoundsChanged(const gfx::Rect& previous_bounds) { 343 void TextButtonBase::OnBoundsChanged(const gfx::Rect& previous_bounds) {
344 if (multi_line_) 344 if (multi_line_)
345 UpdateTextSize(); 345 UpdateTextSize();
346 } 346 }
347 347
348 const ui::Animation* TextButtonBase::GetAnimation() const { 348 const gfx::Animation* TextButtonBase::GetAnimation() const {
349 return hover_animation_.get(); 349 return hover_animation_.get();
350 } 350 }
351 351
352 void TextButtonBase::UpdateColor() { 352 void TextButtonBase::UpdateColor() {
353 color_ = enabled() ? color_enabled_ : color_disabled_; 353 color_ = enabled() ? color_enabled_ : color_disabled_;
354 } 354 }
355 355
356 void TextButtonBase::UpdateTextSize() { 356 void TextButtonBase::UpdateTextSize() {
357 int text_width = width(); 357 int text_width = width();
358 // If width is defined, use GetTextBounds.width() for maximum text width, 358 // If width is defined, use GetTextBounds.width() for maximum text width,
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
563 case STATE_HOVERED: 563 case STATE_HOVERED:
564 return ui::NativeTheme::kHovered; 564 return ui::NativeTheme::kHovered;
565 case STATE_PRESSED: 565 case STATE_PRESSED:
566 return ui::NativeTheme::kPressed; 566 return ui::NativeTheme::kPressed;
567 default: 567 default:
568 NOTREACHED() << "Unknown state: " << state(); 568 NOTREACHED() << "Unknown state: " << state();
569 return ui::NativeTheme::kNormal; 569 return ui::NativeTheme::kNormal;
570 } 570 }
571 } 571 }
572 572
573 const ui::Animation* TextButtonBase::GetThemeAnimation() const { 573 const gfx::Animation* TextButtonBase::GetThemeAnimation() const {
574 #if defined(OS_WIN) 574 #if defined(OS_WIN)
575 if (GetNativeTheme() == ui::NativeThemeWin::instance()) { 575 if (GetNativeTheme() == ui::NativeThemeWin::instance()) {
576 return ui::NativeThemeWin::instance()->IsThemingActive() ? 576 return ui::NativeThemeWin::instance()->IsThemingActive() ?
577 hover_animation_.get() : NULL; 577 hover_animation_.get() : NULL;
578 } 578 }
579 #endif 579 #endif
580 return hover_animation_.get(); 580 return hover_animation_.get();
581 } 581 }
582 582
583 ui::NativeTheme::State TextButtonBase::GetBackgroundThemeState( 583 ui::NativeTheme::State TextButtonBase::GetBackgroundThemeState(
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
735 if (show_multiple_icon_states_) { 735 if (show_multiple_icon_states_) {
736 if (has_hover_icon_ && (state() == STATE_HOVERED)) 736 if (has_hover_icon_ && (state() == STATE_HOVERED))
737 return icon_hover_; 737 return icon_hover_;
738 if (has_pushed_icon_ && (state() == STATE_PRESSED)) 738 if (has_pushed_icon_ && (state() == STATE_PRESSED))
739 return icon_pushed_; 739 return icon_pushed_;
740 } 740 }
741 return icon_; 741 return icon_;
742 } 742 }
743 743
744 } // namespace views 744 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/button/text_button.h ('k') | ui/views/controls/glow_hover_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698