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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
50 explicit SlideAnimation(AnimationDelegate* target); | 50 explicit SlideAnimation(AnimationDelegate* target); |
51 ~SlideAnimation() override; | 51 ~SlideAnimation() override; |
52 | 52 |
53 // Set the animation back to the 0 state. | 53 // Set the animation back to the 0 state. |
54 virtual void Reset(); | 54 virtual void Reset(); |
55 virtual void Reset(double value); | 55 virtual void Reset(double value); |
56 | 56 |
57 // Begin a showing animation or reverse a hiding animation in progress. | 57 // Begin a showing animation or reverse a hiding animation in progress. |
58 virtual void Show(); | 58 virtual void Show(); |
59 | 59 |
60 // Synchronously completes the show animation. | |
61 void ShowImmediately(); | |
sky
2017/02/08 03:02:56
Can you motivate why you want these? I would prefe
bruthig
2017/02/10 18:49:10
Done.
| |
62 | |
60 // Begin a hiding animation or reverse a showing animation in progress. | 63 // Begin a hiding animation or reverse a showing animation in progress. |
61 virtual void Hide(); | 64 virtual void Hide(); |
62 | 65 |
66 // Synchronously completes the hide animation. | |
67 void HideImmediately(); | |
68 | |
63 // Sets the time a slide will take. Note that this isn't actually | 69 // 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 | 70 // the amount of time an animation will take as the current value of |
65 // the slide is considered. | 71 // the slide is considered. |
66 virtual void SetSlideDuration(int duration); | 72 virtual void SetSlideDuration(int duration); |
67 int GetSlideDuration() const { return slide_duration_; } | 73 int GetSlideDuration() const { return slide_duration_; } |
68 void SetTweenType(Tween::Type tween_type) { tween_type_ = tween_type; } | 74 void SetTweenType(Tween::Type tween_type) { tween_type_ = tween_type; } |
69 | 75 |
70 double GetCurrentValue() const override; | 76 double GetCurrentValue() const override; |
77 // TODO(bruthig): Fix IsShowing() and IsClosing() to be consistent. e.g. | |
78 // IsShowing() will currently return true after the 'show' animation has been | |
79 // completed however IsClosing() will return false after the 'hide' animation | |
80 // has been completed. | |
71 bool IsShowing() const { return showing_; } | 81 bool IsShowing() const { return showing_; } |
72 bool IsClosing() const { return !showing_ && value_end_ < value_current_; } | 82 bool IsClosing() const { return !showing_ && value_end_ < value_current_; } |
73 | 83 |
74 class TestApi; | 84 class TestApi; |
75 | 85 |
76 private: | 86 private: |
77 // Overridden from Animation. | 87 // Overridden from Animation. |
78 void AnimateToState(double state) override; | 88 void AnimateToState(double state) override; |
79 | 89 |
80 AnimationDelegate* target_; | 90 AnimationDelegate* target_; |
(...skipping 12 matching lines...) Expand all Loading... | |
93 // How long a hover in/out animation will last for. This defaults to | 103 // How long a hover in/out animation will last for. This defaults to |
94 // kHoverFadeDurationMS, but can be overridden with SetDuration. | 104 // kHoverFadeDurationMS, but can be overridden with SetDuration. |
95 int slide_duration_; | 105 int slide_duration_; |
96 | 106 |
97 DISALLOW_COPY_AND_ASSIGN(SlideAnimation); | 107 DISALLOW_COPY_AND_ASSIGN(SlideAnimation); |
98 }; | 108 }; |
99 | 109 |
100 } // namespace gfx | 110 } // namespace gfx |
101 | 111 |
102 #endif // UI_GFX_ANIMATION_SLIDE_ANIMATION_H_ | 112 #endif // UI_GFX_ANIMATION_SLIDE_ANIMATION_H_ |
OLD | NEW |