OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 // Inspired by NSAnimation | 4 // Inspired by NSAnimation |
5 | 5 |
6 #ifndef APP_ANIMATION_H_ | 6 #ifndef APP_ANIMATION_H_ |
7 #define APP_ANIMATION_H_ | 7 #define APP_ANIMATION_H_ |
8 | 8 |
9 #include "base/timer.h" | 9 #include "base/timer.h" |
10 | 10 |
11 class Animation; | 11 class Animation; |
(...skipping 13 matching lines...) Expand all Loading... |
25 virtual void AnimationEnded(const Animation* animation) { | 25 virtual void AnimationEnded(const Animation* animation) { |
26 } | 26 } |
27 | 27 |
28 // Called when an animation has progressed. | 28 // Called when an animation has progressed. |
29 virtual void AnimationProgressed(const Animation* animation) { | 29 virtual void AnimationProgressed(const Animation* animation) { |
30 } | 30 } |
31 | 31 |
32 // Called when an animation has been canceled. | 32 // Called when an animation has been canceled. |
33 virtual void AnimationCanceled(const Animation* animation) { | 33 virtual void AnimationCanceled(const Animation* animation) { |
34 } | 34 } |
35 | |
36 protected: | |
37 ~AnimationDelegate() {} | |
38 }; | 35 }; |
39 | 36 |
40 // Animation | 37 // Animation |
41 // | 38 // |
42 // This class provides a basic implementation of an object that uses a timer | 39 // This class provides a basic implementation of an object that uses a timer |
43 // to increment its state over the specified time and frame-rate. To | 40 // to increment its state over the specified time and frame-rate. To |
44 // actually do something useful with this you need to subclass it and override | 41 // actually do something useful with this you need to subclass it and override |
45 // AnimateToState and optionally GetCurrentValue to update your state. | 42 // AnimateToState and optionally GetCurrentValue to update your state. |
46 // | 43 // |
47 // The Animation notifies a delegate when events of interest occur. | 44 // The Animation notifies a delegate when events of interest occur. |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 base::RepeatingTimer<Animation> timer_; | 118 base::RepeatingTimer<Animation> timer_; |
122 | 119 |
123 private: | 120 private: |
124 // Called when the animation's timer expires, calls Step. | 121 // Called when the animation's timer expires, calls Step. |
125 void Run(); | 122 void Run(); |
126 | 123 |
127 DISALLOW_COPY_AND_ASSIGN(Animation); | 124 DISALLOW_COPY_AND_ASSIGN(Animation); |
128 }; | 125 }; |
129 | 126 |
130 #endif // APP_ANIMATION_H_ | 127 #endif // APP_ANIMATION_H_ |
OLD | NEW |