| OLD | NEW |
| 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 APP_SLIDE_ANIMATION_H_ | 5 #ifndef APP_SLIDE_ANIMATION_H_ |
| 6 #define APP_SLIDE_ANIMATION_H_ | 6 #define APP_SLIDE_ANIMATION_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "app/linear_animation.h" | 9 #include "app/linear_animation.h" |
| 10 #include "app/tween.h" | 10 #include "app/tween.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 // Begin a hiding animation or reverse a showing animation in progress. | 58 // Begin a hiding animation or reverse a showing animation in progress. |
| 59 virtual void Hide(); | 59 virtual void Hide(); |
| 60 | 60 |
| 61 // Sets the time a slide will take. Note that this isn't actually | 61 // Sets the time a slide will take. Note that this isn't actually |
| 62 // the amount of time an animation will take as the current value of | 62 // the amount of time an animation will take as the current value of |
| 63 // the slide is considered. | 63 // the slide is considered. |
| 64 virtual void SetSlideDuration(int duration) { slide_duration_ = duration; } | 64 virtual void SetSlideDuration(int duration) { slide_duration_ = duration; } |
| 65 int GetSlideDuration() const { return slide_duration_; } | 65 int GetSlideDuration() const { return slide_duration_; } |
| 66 void SetTweenType(Tween::Type tween_type) { tween_type_ = tween_type; } | 66 void SetTweenType(Tween::Type tween_type) { tween_type_ = tween_type; } |
| 67 | 67 |
| 68 double GetCurrentValue() const { return value_current_; } | 68 virtual double GetCurrentValue() const { return value_current_; } |
| 69 bool IsShowing() const { return showing_; } | 69 bool IsShowing() const { return showing_; } |
| 70 bool IsClosing() const { return !showing_ && value_end_ < value_current_; } | 70 bool IsClosing() const { return !showing_ && value_end_ < value_current_; } |
| 71 | 71 |
| 72 private: | 72 private: |
| 73 // Overridden from Animation. | 73 // Overridden from Animation. |
| 74 void AnimateToState(double state); | 74 virtual void AnimateToState(double state); |
| 75 | 75 |
| 76 AnimationDelegate* target_; | 76 AnimationDelegate* target_; |
| 77 | 77 |
| 78 Tween::Type tween_type_; | 78 Tween::Type tween_type_; |
| 79 | 79 |
| 80 // Used to determine which way the animation is going. | 80 // Used to determine which way the animation is going. |
| 81 bool showing_; | 81 bool showing_; |
| 82 | 82 |
| 83 // Animation values. These are a layer on top of Animation::state_ to | 83 // Animation values. These are a layer on top of Animation::state_ to |
| 84 // provide the reversability. | 84 // provide the reversability. |
| 85 double value_start_; | 85 double value_start_; |
| 86 double value_end_; | 86 double value_end_; |
| 87 double value_current_; | 87 double value_current_; |
| 88 | 88 |
| 89 // How long a hover in/out animation will last for. This defaults to | 89 // How long a hover in/out animation will last for. This defaults to |
| 90 // kHoverFadeDurationMS, but can be overridden with SetDuration. | 90 // kHoverFadeDurationMS, but can be overridden with SetDuration. |
| 91 int slide_duration_; | 91 int slide_duration_; |
| 92 | 92 |
| 93 DISALLOW_COPY_AND_ASSIGN(SlideAnimation); | 93 DISALLOW_COPY_AND_ASSIGN(SlideAnimation); |
| 94 }; | 94 }; |
| 95 | 95 |
| 96 #endif // APP_SLIDE_ANIMATION_H_ | 96 #endif // APP_SLIDE_ANIMATION_H_ |
| OLD | NEW |