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

Side by Side Diff: views/animation/bounds_animator.h

Issue 6250141: Sidebar mini tabs UI (views version).... Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 10 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 | « chrome/chrome_tests.gypi ('k') | views/animation/bounds_animator.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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/ref_counted.h" 11 #include "base/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 15
16 namespace ui { 16 namespace ui {
17 class SlideAnimation; 17 class SlideAnimation;
18 } 18 }
19 19
20 namespace views { 20 namespace views {
21 21
22 class BoundsAnimator; 22 class BoundsAnimator;
23 class View; 23 class View;
24 24
25 class BoundsAnimatorObserver { 25 class BoundsAnimatorObserver {
26 public: 26 public:
27 virtual ~BoundsAnimatorObserver() {}
28
29 // Invoked after all the animations have progressed.
30 virtual void OnBoundsAnimatorProgressed(BoundsAnimator* animator) = 0;
31
27 // Invoked when all animations are complete. 32 // Invoked when all animations are complete.
28 virtual void OnBoundsAnimatorDone(BoundsAnimator* animator) = 0; 33 virtual void OnBoundsAnimatorDone(BoundsAnimator* animator) = 0;
29 }; 34 };
30 35
31 // Bounds animator is responsible for animating the bounds of a view from the 36 // Bounds animator is responsible for animating the bounds of a view from the
32 // the views current location and size to a target position and size. To use 37 // the views current location and size to a target position and size. To use
33 // BoundsAnimator invoke AnimateViewTo for the set of views you want to 38 // BoundsAnimator invoke AnimateViewTo for the set of views you want to
34 // animate. 39 // animate.
35 // 40 //
36 // BoundsAnimator internally creates an animation for each view. If you need 41 // BoundsAnimator internally creates an animation for each view. If you need
37 // a specific animation invoke SetAnimationForView after invoking AnimateViewTo. 42 // a specific animation invoke SetAnimationForView after invoking AnimateViewTo.
38 // You can attach an AnimationDelegate to the individual animation for a view 43 // You can attach an AnimationDelegate to the individual animation for a view
39 // by way of SetAnimationDelegate. Additionally you can attach an observer to 44 // by way of SetAnimationDelegate. Additionally you can attach an observer to
40 // the BoundsAnimator that is notified when all animations are complete. 45 // the BoundsAnimator that is notified when all animations are complete.
41 class BoundsAnimator : public ui::AnimationDelegate, 46 class BoundsAnimator : public ui::AnimationDelegate,
42 public ui::AnimationContainerObserver { 47 public ui::AnimationContainerObserver {
43 public: 48 public:
44 // If |delete_when_done| is set to true in |SetAnimationDelegate| the 49 // If |delete_when_done| is set to true in |SetAnimationDelegate| the
45 // |AnimationDelegate| must subclass this class. 50 // |AnimationDelegate| must subclass this class.
46 class OwnedAnimationDelegate : public ui::AnimationDelegate { 51 class OwnedAnimationDelegate : public ui::AnimationDelegate {
47 public: 52 public:
48 virtual ~OwnedAnimationDelegate() {} 53 virtual ~OwnedAnimationDelegate() {}
49 }; 54 };
50 55
51 explicit BoundsAnimator(View* view); 56 explicit BoundsAnimator(View* view);
52 ~BoundsAnimator(); 57 virtual ~BoundsAnimator();
53 58
54 // Starts animating |view| from its current bounds to |target|. If there is 59 // Starts animating |view| from its current bounds to |target|. If there is
55 // already an animation running for the view it's stopped and a new one 60 // already an animation running for the view it's stopped and a new one
56 // started. If an AnimationDelegate has been set for |view| it is removed 61 // started. If an AnimationDelegate has been set for |view| it is removed
57 // (after being notified that the animation was canceled). 62 // (after being notified that the animation was canceled).
58 void AnimateViewTo(View* view, const gfx::Rect& target); 63 void AnimateViewTo(View* view, const gfx::Rect& target);
59 64
60 // Sets the animation for the specified view. BoundsAnimator takes ownership 65 // Sets the animation for the specified view. BoundsAnimator takes ownership
61 // of the specified animation. 66 // of the specified animation.
62 void SetAnimationForView(View* view, ui::SlideAnimation* animation); 67 void SetAnimationForView(View* view, ui::SlideAnimation* animation);
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 // the timer (AnimationContainerProgressed is invoked) the parent_ is asked 178 // the timer (AnimationContainerProgressed is invoked) the parent_ is asked
174 // to repaint these bounds. 179 // to repaint these bounds.
175 gfx::Rect repaint_bounds_; 180 gfx::Rect repaint_bounds_;
176 181
177 DISALLOW_COPY_AND_ASSIGN(BoundsAnimator); 182 DISALLOW_COPY_AND_ASSIGN(BoundsAnimator);
178 }; 183 };
179 184
180 } // namespace views 185 } // namespace views
181 186
182 #endif // VIEWS_ANIMATION_BOUNDS_ANIMATOR_H_ 187 #endif // VIEWS_ANIMATION_BOUNDS_ANIMATOR_H_
OLDNEW
« no previous file with comments | « chrome/chrome_tests.gypi ('k') | views/animation/bounds_animator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698