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

Side by Side Diff: ui/views/controls/scrollbar/overlay_scroll_bar.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/scrollbar/overlay_scroll_bar.h ('k') | ui/views/controls/slider.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 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/scrollbar/overlay_scroll_bar.h" 5 #include "ui/views/controls/scrollbar/overlay_scroll_bar.h"
6 6
7 #include "third_party/skia/include/core/SkColor.h" 7 #include "third_party/skia/include/core/SkColor.h"
8 #include "third_party/skia/include/core/SkXfermode.h" 8 #include "third_party/skia/include/core/SkXfermode.h"
9 #include "ui/gfx/canvas.h" 9 #include "ui/gfx/canvas.h"
10 #include "ui/views/background.h" 10 #include "ui/views/background.h"
11 #include "ui/views/border.h" 11 #include "ui/views/border.h"
12 #include "ui/views/controls/scrollbar/base_scroll_bar_thumb.h" 12 #include "ui/views/controls/scrollbar/base_scroll_bar_thumb.h"
13 13
14 namespace views { 14 namespace views {
15 namespace { 15 namespace {
16 16
17 const int kScrollbarWidth = 10; 17 const int kScrollbarWidth = 10;
18 const int kThumbInsetInside = 3; 18 const int kThumbInsetInside = 3;
19 const int kThumbInsetFromEdge = 1; 19 const int kThumbInsetFromEdge = 1;
20 const int kThumbCornerRadius = 2; 20 const int kThumbCornerRadius = 2;
21 const int kThumbMinimumSize = kScrollbarWidth; 21 const int kThumbMinimumSize = kScrollbarWidth;
22 const int kThumbHoverAlpha = 128; 22 const int kThumbHoverAlpha = 128;
23 const int kThumbDefaultAlpha = 64; 23 const int kThumbDefaultAlpha = 64;
24 24
25 class OverlayScrollBarThumb : public BaseScrollBarThumb, 25 class OverlayScrollBarThumb : public BaseScrollBarThumb,
26 public ui::AnimationDelegate { 26 public gfx::AnimationDelegate {
27 public: 27 public:
28 explicit OverlayScrollBarThumb(BaseScrollBar* scroll_bar); 28 explicit OverlayScrollBarThumb(BaseScrollBar* scroll_bar);
29 virtual ~OverlayScrollBarThumb(); 29 virtual ~OverlayScrollBarThumb();
30 30
31 protected: 31 protected:
32 // View overrides: 32 // View overrides:
33 virtual gfx::Size GetPreferredSize() OVERRIDE; 33 virtual gfx::Size GetPreferredSize() OVERRIDE;
34 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; 34 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE;
35 35
36 // ui::AnimationDelegate overrides: 36 // gfx::AnimationDelegate overrides:
37 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; 37 virtual void AnimationProgressed(const gfx::Animation* animation) OVERRIDE;
38 38
39 private: 39 private:
40 double animation_opacity_; 40 double animation_opacity_;
41 DISALLOW_COPY_AND_ASSIGN(OverlayScrollBarThumb); 41 DISALLOW_COPY_AND_ASSIGN(OverlayScrollBarThumb);
42 }; 42 };
43 43
44 OverlayScrollBarThumb::OverlayScrollBarThumb(BaseScrollBar* scroll_bar) 44 OverlayScrollBarThumb::OverlayScrollBarThumb(BaseScrollBar* scroll_bar)
45 : BaseScrollBarThumb(scroll_bar), 45 : BaseScrollBarThumb(scroll_bar),
46 animation_opacity_(0.0) { 46 animation_opacity_(0.0) {
47 if (get_use_acceleration_when_possible()) { 47 if (get_use_acceleration_when_possible()) {
(...skipping 22 matching lines...) Expand all
70 // just display the deeper color. 70 // just display the deeper color.
71 alpha = kThumbHoverAlpha; 71 alpha = kThumbHoverAlpha;
72 } 72 }
73 73
74 paint.setStyle(SkPaint::kFill_Style); 74 paint.setStyle(SkPaint::kFill_Style);
75 paint.setColor(SkColorSetARGB(alpha, 0, 0, 0)); 75 paint.setColor(SkColorSetARGB(alpha, 0, 0, 0));
76 canvas->DrawRoundRect(local_bounds, kThumbCornerRadius, paint); 76 canvas->DrawRoundRect(local_bounds, kThumbCornerRadius, paint);
77 } 77 }
78 78
79 void OverlayScrollBarThumb::AnimationProgressed( 79 void OverlayScrollBarThumb::AnimationProgressed(
80 const ui::Animation* animation) { 80 const gfx::Animation* animation) {
81 animation_opacity_ = animation->GetCurrentValue(); 81 animation_opacity_ = animation->GetCurrentValue();
82 SchedulePaint(); 82 SchedulePaint();
83 } 83 }
84 84
85 } // namespace 85 } // namespace
86 86
87 OverlayScrollBar::OverlayScrollBar(bool horizontal) 87 OverlayScrollBar::OverlayScrollBar(bool horizontal)
88 : BaseScrollBar(horizontal, new OverlayScrollBarThumb(this)), 88 : BaseScrollBar(horizontal, new OverlayScrollBarThumb(this)),
89 animation_(static_cast<OverlayScrollBarThumb*>(GetThumb())) { 89 animation_(static_cast<OverlayScrollBarThumb*>(GetThumb())) {
90 set_notify_enter_exit_on_child(true); 90 set_notify_enter_exit_on_child(true);
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 thumb_bounds.set_y(thumb->y()); 154 thumb_bounds.set_y(thumb->y());
155 thumb_bounds.set_height(thumb->height()); 155 thumb_bounds.set_height(thumb->height());
156 } 156 }
157 thumb->SetBoundsRect(thumb_bounds); 157 thumb->SetBoundsRect(thumb_bounds);
158 } 158 }
159 159
160 void OverlayScrollBar::OnPaint(gfx::Canvas* canvas) { 160 void OverlayScrollBar::OnPaint(gfx::Canvas* canvas) {
161 } 161 }
162 162
163 } // namespace views 163 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/scrollbar/overlay_scroll_bar.h ('k') | ui/views/controls/slider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698