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

Side by Side Diff: ui/gfx/animation/slide_animation.h

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/gfx/animation/multi_animation_unittest.cc ('k') | ui/gfx/animation/slide_animation.cc » ('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 #ifndef UI_BASE_ANIMATION_SLIDE_ANIMATION_H_ 5 #ifndef UI_BASE_ANIMATION_SLIDE_ANIMATION_H_
6 #define UI_BASE_ANIMATION_SLIDE_ANIMATION_H_ 6 #define UI_BASE_ANIMATION_SLIDE_ANIMATION_H_
7 7
8 #include "ui/base/animation/linear_animation.h" 8 #include "ui/gfx/animation/linear_animation.h"
9 #include "ui/base/animation/tween.h" 9 #include "ui/gfx/animation/tween.h"
10 10
11 namespace ui { 11 namespace gfx {
12 12
13 // Slide Animation 13 // Slide Animation
14 // 14 //
15 // Used for reversible animations and as a general helper class. Typical usage: 15 // Used for reversible animations and as a general helper class. Typical usage:
16 // 16 //
17 // #include "ui/base/animation/slide_animation.h" 17 // #include "ui/gfx/animation/slide_animation.h"
18 // 18 //
19 // class MyClass : public AnimationDelegate { 19 // class MyClass : public AnimationDelegate {
20 // public: 20 // public:
21 // MyClass() { 21 // MyClass() {
22 // animation_.reset(new SlideAnimation(this)); 22 // animation_.reset(new SlideAnimation(this));
23 // animation_->SetSlideDuration(500); 23 // animation_->SetSlideDuration(500);
24 // } 24 // }
25 // void OnMouseOver() { 25 // void OnMouseOver() {
26 // animation_->Show(); 26 // animation_->Show();
27 // } 27 // }
28 // void OnMouseOut() { 28 // void OnMouseOut() {
29 // animation_->Hide(); 29 // animation_->Hide();
30 // } 30 // }
31 // void AnimationProgressed(const Animation* animation) { 31 // void AnimationProgressed(const Animation* animation) {
32 // if (animation == animation_.get()) { 32 // if (animation == animation_.get()) {
33 // Layout(); 33 // Layout();
34 // SchedulePaint(); 34 // SchedulePaint();
35 // } else if (animation == other_animation_.get()) { 35 // } else if (animation == other_animation_.get()) {
36 // ... 36 // ...
37 // } 37 // }
38 // } 38 // }
39 // void Layout() { 39 // void Layout() {
40 // if (animation_->is_animating()) { 40 // if (animation_->is_animating()) {
41 // hover_image_.SetOpacity(animation_->GetCurrentValue()); 41 // hover_image_.SetOpacity(animation_->GetCurrentValue());
42 // } 42 // }
43 // } 43 // }
44 // private: 44 // private:
45 // scoped_ptr<SlideAnimation> animation_; 45 // scoped_ptr<SlideAnimation> animation_;
46 // } 46 // }
47 class UI_EXPORT SlideAnimation : public LinearAnimation { 47 class GFX_EXPORT SlideAnimation : public LinearAnimation {
48 public: 48 public:
49 explicit SlideAnimation(AnimationDelegate* target); 49 explicit SlideAnimation(AnimationDelegate* target);
50 virtual ~SlideAnimation(); 50 virtual ~SlideAnimation();
51 51
52 // Set the animation back to the 0 state. 52 // Set the animation back to the 0 state.
53 virtual void Reset(); 53 virtual void Reset();
54 virtual void Reset(double value); 54 virtual void Reset(double value);
55 55
56 // Begin a showing animation or reverse a hiding animation in progress. 56 // Begin a showing animation or reverse a hiding animation in progress.
57 virtual void Show(); 57 virtual void Show();
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 double value_end_; 89 double value_end_;
90 double value_current_; 90 double value_current_;
91 91
92 // How long a hover in/out animation will last for. This defaults to 92 // How long a hover in/out animation will last for. This defaults to
93 // kHoverFadeDurationMS, but can be overridden with SetDuration. 93 // kHoverFadeDurationMS, but can be overridden with SetDuration.
94 int slide_duration_; 94 int slide_duration_;
95 95
96 DISALLOW_COPY_AND_ASSIGN(SlideAnimation); 96 DISALLOW_COPY_AND_ASSIGN(SlideAnimation);
97 }; 97 };
98 98
99 } // namespace ui 99 } // namespace gfx
100 100
101 #endif // UI_BASE_ANIMATION_SLIDE_ANIMATION_H_ 101 #endif // UI_BASE_ANIMATION_SLIDE_ANIMATION_H_
OLDNEW
« no previous file with comments | « ui/gfx/animation/multi_animation_unittest.cc ('k') | ui/gfx/animation/slide_animation.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698