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 #ifndef UI_VIEWS_ANIMATION_BOUNDS_ANIMATOR_H_ | 5 #ifndef UI_VIEWS_ANIMATION_BOUNDS_ANIMATOR_H_ |
6 #define UI_VIEWS_ANIMATION_BOUNDS_ANIMATOR_H_ | 6 #define UI_VIEWS_ANIMATION_BOUNDS_ANIMATOR_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 // | 32 // |
33 // BoundsAnimator internally creates an animation for each view. If you need | 33 // BoundsAnimator internally creates an animation for each view. If you need |
34 // a specific animation invoke SetAnimationForView after invoking AnimateViewTo. | 34 // a specific animation invoke SetAnimationForView after invoking AnimateViewTo. |
35 // You can attach an AnimationDelegate to the individual animation for a view | 35 // You can attach an AnimationDelegate to the individual animation for a view |
36 // by way of SetAnimationDelegate. Additionally you can attach an observer to | 36 // by way of SetAnimationDelegate. Additionally you can attach an observer to |
37 // the BoundsAnimator that is notified when all animations are complete. | 37 // the BoundsAnimator that is notified when all animations are complete. |
38 class VIEWS_EXPORT BoundsAnimator : public gfx::AnimationDelegate, | 38 class VIEWS_EXPORT BoundsAnimator : public gfx::AnimationDelegate, |
39 public gfx::AnimationContainerObserver { | 39 public gfx::AnimationContainerObserver { |
40 public: | 40 public: |
41 explicit BoundsAnimator(View* view); | 41 explicit BoundsAnimator(View* view); |
42 virtual ~BoundsAnimator(); | 42 ~BoundsAnimator() override; |
43 | 43 |
44 // Starts animating |view| from its current bounds to |target|. If there is | 44 // Starts animating |view| from its current bounds to |target|. If there is |
45 // already an animation running for the view it's stopped and a new one | 45 // already an animation running for the view it's stopped and a new one |
46 // started. If an AnimationDelegate has been set for |view| it is removed | 46 // started. If an AnimationDelegate has been set for |view| it is removed |
47 // (after being notified that the animation was canceled). | 47 // (after being notified that the animation was canceled). |
48 void AnimateViewTo(View* view, const gfx::Rect& target); | 48 void AnimateViewTo(View* view, const gfx::Rect& target); |
49 | 49 |
50 // Similar to |AnimateViewTo|, but does not reset the animation, only the | 50 // Similar to |AnimateViewTo|, but does not reset the animation, only the |
51 // target bounds. If |view| is not being animated this is the same as | 51 // target bounds. If |view| is not being animated this is the same as |
52 // invoking |AnimateViewTo|. | 52 // invoking |AnimateViewTo|. |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 // Used when changing the animation for a view. This resets the maps for | 137 // Used when changing the animation for a view. This resets the maps for |
138 // the animation used by view and returns the current animation. Ownership | 138 // the animation used by view and returns the current animation. Ownership |
139 // of the returned animation passes to the caller. | 139 // of the returned animation passes to the caller. |
140 gfx::Animation* ResetAnimationForView(View* view); | 140 gfx::Animation* ResetAnimationForView(View* view); |
141 | 141 |
142 // Invoked from AnimationEnded and AnimationCanceled. | 142 // Invoked from AnimationEnded and AnimationCanceled. |
143 void AnimationEndedOrCanceled(const gfx::Animation* animation, | 143 void AnimationEndedOrCanceled(const gfx::Animation* animation, |
144 AnimationEndType type); | 144 AnimationEndType type); |
145 | 145 |
146 // gfx::AnimationDelegate overrides. | 146 // gfx::AnimationDelegate overrides. |
147 virtual void AnimationProgressed(const gfx::Animation* animation) override; | 147 void AnimationProgressed(const gfx::Animation* animation) override; |
148 virtual void AnimationEnded(const gfx::Animation* animation) override; | 148 void AnimationEnded(const gfx::Animation* animation) override; |
149 virtual void AnimationCanceled(const gfx::Animation* animation) override; | 149 void AnimationCanceled(const gfx::Animation* animation) override; |
150 | 150 |
151 // gfx::AnimationContainerObserver overrides. | 151 // gfx::AnimationContainerObserver overrides. |
152 virtual void AnimationContainerProgressed( | 152 void AnimationContainerProgressed( |
153 gfx::AnimationContainer* container) override; | 153 gfx::AnimationContainer* container) override; |
154 virtual void AnimationContainerEmpty( | 154 void AnimationContainerEmpty(gfx::AnimationContainer* container) override; |
155 gfx::AnimationContainer* container) override; | |
156 | 155 |
157 // Parent of all views being animated. | 156 // Parent of all views being animated. |
158 View* parent_; | 157 View* parent_; |
159 | 158 |
160 ObserverList<BoundsAnimatorObserver> observers_; | 159 ObserverList<BoundsAnimatorObserver> observers_; |
161 | 160 |
162 // All animations we create up with the same container. | 161 // All animations we create up with the same container. |
163 scoped_refptr<gfx::AnimationContainer> container_; | 162 scoped_refptr<gfx::AnimationContainer> container_; |
164 | 163 |
165 // Maps from view being animated to info about the view. | 164 // Maps from view being animated to info about the view. |
(...skipping 11 matching lines...) Expand all Loading... |
177 int animation_duration_ms_; | 176 int animation_duration_ms_; |
178 | 177 |
179 gfx::Tween::Type tween_type_; | 178 gfx::Tween::Type tween_type_; |
180 | 179 |
181 DISALLOW_COPY_AND_ASSIGN(BoundsAnimator); | 180 DISALLOW_COPY_AND_ASSIGN(BoundsAnimator); |
182 }; | 181 }; |
183 | 182 |
184 } // namespace views | 183 } // namespace views |
185 | 184 |
186 #endif // UI_VIEWS_ANIMATION_BOUNDS_ANIMATOR_H_ | 185 #endif // UI_VIEWS_ANIMATION_BOUNDS_ANIMATOR_H_ |
OLD | NEW |