OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this |
2 // source code is governed by a BSD-style license that can be found in the | 2 // source code is governed by a BSD-style license that can be found in the |
3 // LICENSE file. | 3 // LICENSE file. |
4 | 4 |
5 #ifndef VIEWS_ANIMATOR_H_ | 5 #ifndef VIEWS_ANIMATOR_H_ |
6 #define VIEWS_ANIMATOR_H_ | 6 #define VIEWS_ANIMATOR_H_ |
7 | 7 |
8 #include <xutility> | |
9 | |
10 #include "app/animation.h" | 8 #include "app/animation.h" |
11 #include "base/gfx/rect.h" | 9 #include "base/gfx/rect.h" |
12 #include "base/ref_counted.h" | 10 #include "base/ref_counted.h" |
13 #include "base/scoped_ptr.h" | 11 #include "base/scoped_ptr.h" |
14 | 12 |
15 class SlideAnimation; | 13 class SlideAnimation; |
16 | 14 |
17 //////////////////////////////////////////////////////////////////////////////// | 15 //////////////////////////////////////////////////////////////////////////////// |
18 // ALERT! | 16 // ALERT! |
19 // | 17 // |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 Animator(View* host, AnimatorDelegate* delegate); | 56 Animator(View* host, AnimatorDelegate* delegate); |
59 virtual ~Animator(); | 57 virtual ~Animator(); |
60 | 58 |
61 // Returns true if the animator is currently animating. | 59 // Returns true if the animator is currently animating. |
62 bool IsAnimating() const; | 60 bool IsAnimating() const; |
63 | 61 |
64 // Moves/sizes the host view to the specified bounds. |direction| is a | 62 // Moves/sizes the host view to the specified bounds. |direction| is a |
65 // combination of the above flags indicating what aspects of the bounds should | 63 // combination of the above flags indicating what aspects of the bounds should |
66 // be animated. | 64 // be animated. |
67 void AnimateToBounds(const gfx::Rect& bounds, int direction); | 65 void AnimateToBounds(const gfx::Rect& bounds, int direction); |
68 void AnimateToBounds(int x, int y, int width, int height, int direction) { | 66 void AnimateToBounds(int x, int y, int width, int height, int direction); |
69 AnimateToBounds(gfx::Rect(x, y, std::max(0, width), std::max(0, height)), | |
70 direction); | |
71 } | |
72 | 67 |
73 // Overridden from AnimationDelegate: | 68 // Overridden from AnimationDelegate: |
74 virtual void AnimationEnded(const Animation* animation); | 69 virtual void AnimationEnded(const Animation* animation); |
75 virtual void AnimationProgressed(const Animation* animation); | 70 virtual void AnimationProgressed(const Animation* animation); |
76 virtual void AnimationCanceled(const Animation* animation); | 71 virtual void AnimationCanceled(const Animation* animation); |
77 | 72 |
78 private: | 73 private: |
79 void InitAnimation(); | 74 void InitAnimation(); |
80 | 75 |
81 // Get the current X/Y position of the host view, clamped to the right edge of | 76 // Get the current X/Y position of the host view, clamped to the right edge of |
(...skipping 19 matching lines...) Expand all Loading... |
101 // Some combination of BoundsChangeFlags indicating the type of bounds change | 96 // Some combination of BoundsChangeFlags indicating the type of bounds change |
102 // the host view is subject to. | 97 // the host view is subject to. |
103 int direction_; | 98 int direction_; |
104 | 99 |
105 DISALLOW_COPY_AND_ASSIGN(Animator); | 100 DISALLOW_COPY_AND_ASSIGN(Animator); |
106 }; | 101 }; |
107 | 102 |
108 } // namespace views | 103 } // namespace views |
109 | 104 |
110 #endif // #ifndef VIEWS_ANIMATOR_H_ | 105 #endif // #ifndef VIEWS_ANIMATOR_H_ |
OLD | NEW |