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 UI_BASE_ANIMATION_SLIDE_ANIMATION_H_ | 5 #ifndef UI_BASE_ANIMATION_SLIDE_ANIMATION_H_ |
6 #define UI_BASE_ANIMATION_SLIDE_ANIMATION_H_ | 6 #define UI_BASE_ANIMATION_SLIDE_ANIMATION_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "ui/base/animation/linear_animation.h" | 9 #include "ui/base/animation/linear_animation.h" |
10 #include "ui/base/animation/tween.h" | 10 #include "ui/base/animation/tween.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 // Begin a hiding animation or reverse a showing animation in progress. | 60 // Begin a hiding animation or reverse a showing animation in progress. |
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 virtual double GetCurrentValue() const; | 70 virtual double GetCurrentValue() const OVERRIDE; |
71 bool IsShowing() const { return showing_; } | 71 bool IsShowing() const { return showing_; } |
72 bool IsClosing() const { return !showing_ && value_end_ < value_current_; } | 72 bool IsClosing() const { return !showing_ && value_end_ < value_current_; } |
73 | 73 |
74 private: | 74 private: |
75 // Overridden from Animation. | 75 // Overridden from Animation. |
76 virtual void AnimateToState(double state); | 76 virtual void AnimateToState(double state) OVERRIDE; |
77 | 77 |
78 AnimationDelegate* target_; | 78 AnimationDelegate* target_; |
79 | 79 |
80 Tween::Type tween_type_; | 80 Tween::Type tween_type_; |
81 | 81 |
82 // Used to determine which way the animation is going. | 82 // Used to determine which way the animation is going. |
83 bool showing_; | 83 bool showing_; |
84 | 84 |
85 // Animation values. These are a layer on top of Animation::state_ to | 85 // Animation values. These are a layer on top of Animation::state_ to |
86 // provide the reversability. | 86 // provide the reversability. |
87 double value_start_; | 87 double value_start_; |
88 double value_end_; | 88 double value_end_; |
89 double value_current_; | 89 double value_current_; |
90 | 90 |
91 // How long a hover in/out animation will last for. This defaults to | 91 // How long a hover in/out animation will last for. This defaults to |
92 // kHoverFadeDurationMS, but can be overridden with SetDuration. | 92 // kHoverFadeDurationMS, but can be overridden with SetDuration. |
93 int slide_duration_; | 93 int slide_duration_; |
94 | 94 |
95 DISALLOW_COPY_AND_ASSIGN(SlideAnimation); | 95 DISALLOW_COPY_AND_ASSIGN(SlideAnimation); |
96 }; | 96 }; |
97 | 97 |
98 } // namespace ui | 98 } // namespace ui |
99 | 99 |
100 #endif // UI_BASE_ANIMATION_SLIDE_ANIMATION_H_ | 100 #endif // UI_BASE_ANIMATION_SLIDE_ANIMATION_H_ |
OLD | NEW |