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_GFX_ANIMATION_SLIDE_ANIMATION_H_ | 5 #ifndef UI_GFX_ANIMATION_SLIDE_ANIMATION_H_ |
6 #define UI_GFX_ANIMATION_SLIDE_ANIMATION_H_ | 6 #define UI_GFX_ANIMATION_SLIDE_ANIMATION_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "ui/gfx/animation/linear_animation.h" | 9 #include "ui/gfx/animation/linear_animation.h" |
10 #include "ui/gfx/animation/tween.h" | 10 #include "ui/gfx/animation/tween.h" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 virtual void Hide(); | 61 virtual void Hide(); |
62 | 62 |
63 // Sets the time a slide will take. Note that this isn't actually | 63 // Sets the time a slide will take. Note that this isn't actually |
64 // the amount of time an animation will take as the current value of | 64 // the amount of time an animation will take as the current value of |
65 // the slide is considered. | 65 // the slide is considered. |
66 virtual void SetSlideDuration(int duration); | 66 virtual void SetSlideDuration(int duration); |
67 int GetSlideDuration() const { return slide_duration_; } | 67 int GetSlideDuration() const { return slide_duration_; } |
68 void SetTweenType(Tween::Type tween_type) { tween_type_ = tween_type; } | 68 void SetTweenType(Tween::Type tween_type) { tween_type_ = tween_type; } |
69 | 69 |
70 double GetCurrentValue() const override; | 70 double GetCurrentValue() const override; |
| 71 // TODO(bruthig): Fix IsShowing() and IsClosing() to be consistent. e.g. |
| 72 // IsShowing() will currently return true after the 'show' animation has been |
| 73 // completed however IsClosing() will return false after the 'hide' animation |
| 74 // has been completed. |
71 bool IsShowing() const { return showing_; } | 75 bool IsShowing() const { return showing_; } |
72 bool IsClosing() const { return !showing_ && value_end_ < value_current_; } | 76 bool IsClosing() const { return !showing_ && value_end_ < value_current_; } |
73 | 77 |
74 class TestApi; | 78 class TestApi; |
75 | 79 |
76 private: | 80 private: |
77 // Overridden from Animation. | 81 // Overridden from Animation. |
78 void AnimateToState(double state) override; | 82 void AnimateToState(double state) override; |
79 | 83 |
80 AnimationDelegate* target_; | 84 AnimationDelegate* target_; |
(...skipping 12 matching lines...) Expand all Loading... |
93 // How long a hover in/out animation will last for. This defaults to | 97 // How long a hover in/out animation will last for. This defaults to |
94 // kHoverFadeDurationMS, but can be overridden with SetDuration. | 98 // kHoverFadeDurationMS, but can be overridden with SetDuration. |
95 int slide_duration_; | 99 int slide_duration_; |
96 | 100 |
97 DISALLOW_COPY_AND_ASSIGN(SlideAnimation); | 101 DISALLOW_COPY_AND_ASSIGN(SlideAnimation); |
98 }; | 102 }; |
99 | 103 |
100 } // namespace gfx | 104 } // namespace gfx |
101 | 105 |
102 #endif // UI_GFX_ANIMATION_SLIDE_ANIMATION_H_ | 106 #endif // UI_GFX_ANIMATION_SLIDE_ANIMATION_H_ |
OLD | NEW |