| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 VIEWS_ANIMATION_BOUNDS_ANIMATOR_H_ | 5 #ifndef VIEWS_ANIMATION_BOUNDS_ANIMATOR_H_ |
| 6 #define VIEWS_ANIMATION_BOUNDS_ANIMATOR_H_ | 6 #define VIEWS_ANIMATION_BOUNDS_ANIMATOR_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 | 10 |
| 11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 12 #include "ui/base/animation/animation_container_observer.h" | 12 #include "ui/base/animation/animation_container_observer.h" |
| 13 #include "ui/base/animation/animation_delegate.h" | 13 #include "ui/base/animation/animation_delegate.h" |
| 14 #include "ui/gfx/rect.h" | 14 #include "ui/gfx/rect.h" |
| 15 #include "views/views_api.h" | 15 #include "views/views_export.h" |
| 16 | 16 |
| 17 namespace ui { | 17 namespace ui { |
| 18 class SlideAnimation; | 18 class SlideAnimation; |
| 19 } | 19 } |
| 20 | 20 |
| 21 namespace views { | 21 namespace views { |
| 22 | 22 |
| 23 class BoundsAnimator; | 23 class BoundsAnimator; |
| 24 class View; | 24 class View; |
| 25 | 25 |
| 26 class BoundsAnimatorObserver { | 26 class BoundsAnimatorObserver { |
| 27 public: | 27 public: |
| 28 // Invoked when all animations are complete. | 28 // Invoked when all animations are complete. |
| 29 virtual void OnBoundsAnimatorDone(BoundsAnimator* animator) = 0; | 29 virtual void OnBoundsAnimatorDone(BoundsAnimator* animator) = 0; |
| 30 }; | 30 }; |
| 31 | 31 |
| 32 // Bounds animator is responsible for animating the bounds of a view from the | 32 // Bounds animator is responsible for animating the bounds of a view from the |
| 33 // the views current location and size to a target position and size. To use | 33 // the views current location and size to a target position and size. To use |
| 34 // BoundsAnimator invoke AnimateViewTo for the set of views you want to | 34 // BoundsAnimator invoke AnimateViewTo for the set of views you want to |
| 35 // animate. | 35 // animate. |
| 36 // | 36 // |
| 37 // BoundsAnimator internally creates an animation for each view. If you need | 37 // BoundsAnimator internally creates an animation for each view. If you need |
| 38 // a specific animation invoke SetAnimationForView after invoking AnimateViewTo. | 38 // a specific animation invoke SetAnimationForView after invoking AnimateViewTo. |
| 39 // You can attach an AnimationDelegate to the individual animation for a view | 39 // You can attach an AnimationDelegate to the individual animation for a view |
| 40 // by way of SetAnimationDelegate. Additionally you can attach an observer to | 40 // by way of SetAnimationDelegate. Additionally you can attach an observer to |
| 41 // the BoundsAnimator that is notified when all animations are complete. | 41 // the BoundsAnimator that is notified when all animations are complete. |
| 42 class VIEWS_API BoundsAnimator : public ui::AnimationDelegate, | 42 class VIEWS_EXPORT BoundsAnimator : public ui::AnimationDelegate, |
| 43 public ui::AnimationContainerObserver { | 43 public ui::AnimationContainerObserver { |
| 44 public: | 44 public: |
| 45 // If |delete_when_done| is set to true in |SetAnimationDelegate| the | 45 // If |delete_when_done| is set to true in |SetAnimationDelegate| the |
| 46 // |AnimationDelegate| must subclass this class. | 46 // |AnimationDelegate| must subclass this class. |
| 47 class OwnedAnimationDelegate : public ui::AnimationDelegate { | 47 class OwnedAnimationDelegate : public ui::AnimationDelegate { |
| 48 public: | 48 public: |
| 49 virtual ~OwnedAnimationDelegate() {} | 49 virtual ~OwnedAnimationDelegate() {} |
| 50 }; | 50 }; |
| 51 | 51 |
| 52 explicit BoundsAnimator(View* view); | 52 explicit BoundsAnimator(View* view); |
| 53 virtual ~BoundsAnimator(); | 53 virtual ~BoundsAnimator(); |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 // the timer (AnimationContainerProgressed is invoked) the parent_ is asked | 179 // the timer (AnimationContainerProgressed is invoked) the parent_ is asked |
| 180 // to repaint these bounds. | 180 // to repaint these bounds. |
| 181 gfx::Rect repaint_bounds_; | 181 gfx::Rect repaint_bounds_; |
| 182 | 182 |
| 183 DISALLOW_COPY_AND_ASSIGN(BoundsAnimator); | 183 DISALLOW_COPY_AND_ASSIGN(BoundsAnimator); |
| 184 }; | 184 }; |
| 185 | 185 |
| 186 } // namespace views | 186 } // namespace views |
| 187 | 187 |
| 188 #endif // VIEWS_ANIMATION_BOUNDS_ANIMATOR_H_ | 188 #endif // VIEWS_ANIMATION_BOUNDS_ANIMATOR_H_ |
| OLD | NEW |