summaryrefslogtreecommitdiffstats
path: root/app/throb_animation.h
diff options
context:
space:
mode:
authorben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-05 04:52:11 +0000
committerben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-05 04:52:11 +0000
commit220705c2b06962462e471b28ad85c76c0f9c3080 (patch)
treecfc44266116bbf2acc3a4fae32625c4481c8243e /app/throb_animation.h
parent1b8d02f181d089ee670f2ba72089c3722f679d5f (diff)
downloadchromium_src-220705c2b06962462e471b28ad85c76c0f9c3080.zip
chromium_src-220705c2b06962462e471b28ad85c76c0f9c3080.tar.gz
chromium_src-220705c2b06962462e471b28ad85c76c0f9c3080.tar.bz2
Move *Animation to app/
http://crbug.com/11387 Review URL: http://codereview.chromium.org/109001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@15275 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'app/throb_animation.h')
-rw-r--r--app/throb_animation.h59
1 files changed, 59 insertions, 0 deletions
diff --git a/app/throb_animation.h b/app/throb_animation.h
new file mode 100644
index 0000000..637e8e0
--- /dev/null
+++ b/app/throb_animation.h
@@ -0,0 +1,59 @@
+// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef APP_THROB_ANIMATION_H_
+#define APP_THROB_ANIMATION_H_
+
+#include "app/slide_animation.h"
+
+// A subclass of SlideAnimation that can continually slide. All of the Animation
+// methods behave like that of SlideAnimation: transition to the next state.
+// The StartThrobbing method causes the ThrobAnimation to cycle between hidden
+// and shown for a set number of cycles.
+//
+// A ThrobAnimation has two durations: the duration used when behavior like
+// a SlideAnimation, and the duration used when throbbing.
+class ThrobAnimation : public SlideAnimation {
+ public:
+ explicit ThrobAnimation(AnimationDelegate* target);
+ virtual ~ThrobAnimation() {}
+
+ // Starts throbbing. cycles_til_stop gives the number of cycles to do before
+ // stopping.
+ void StartThrobbing(int cycles_til_stop);
+
+ // Sets the duration of the slide animation when throbbing.
+ void SetThrobDuration(int duration) { throb_duration_ = duration; }
+
+ // Overridden to reset to the slide duration.
+ virtual void Reset();
+ virtual void Show();
+ virtual void Hide();
+
+ // Overriden to continually throb (assuming we're throbbing).
+ virtual void Step();
+
+ // Overridden to maintain the slide duration.
+ virtual void SetSlideDuration(int duration) { slide_duration_ = duration; }
+
+ private:
+ // Resets state such that we behave like SlideAnimation.
+ void ResetForSlide();
+
+ // Duration of the slide animation.
+ int slide_duration_;
+
+ // Duration of the slide animation when throbbing.
+ int throb_duration_;
+
+ // If throbbing, this is the number of cycles left.
+ int cycles_remaining_;
+
+ // Are we throbbing?
+ bool throbbing_;
+
+ DISALLOW_COPY_AND_ASSIGN(ThrobAnimation);
+};
+
+#endif // APP_THROB_ANIMATION_H_