00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #ifndef _CEGUIAnimationInstance_h_
00031 #define _CEGUIAnimationInstance_h_
00032
00033 #include "CEGUIEventArgs.h"
00034 #include "CEGUIEvent.h"
00035 #include <map>
00036 #include <vector>
00037
00038 #if defined(_MSC_VER)
00039 # pragma warning(push)
00040 # pragma warning(disable : 4251)
00041 #endif
00042
00043
00044 namespace CEGUI
00045 {
00046
00052 class CEGUIEXPORT AnimationEventArgs : public EventArgs
00053 {
00054 public:
00055 AnimationEventArgs(AnimationInstance* inst) : instance(inst) {}
00057 AnimationInstance* instance;
00058 };
00059
00074 class CEGUIEXPORT AnimationInstance
00075 {
00076 public:
00079 static const String EventNamespace;
00080
00082 static const String EventAnimationStarted;
00084 static const String EventAnimationStopped;
00086 static const String EventAnimationPaused;
00088 static const String EventAnimationUnpaused;
00090 static const String EventAnimationEnded;
00092 static const String EventAnimationLooped;
00093
00095 AnimationInstance(Animation* definition);
00096
00100 ~AnimationInstance(void);
00101
00106 Animation* getDefinition() const;
00107
00113 void setTarget(PropertySet* target);
00114
00119 PropertySet* getTarget() const;
00120
00127 void setEventReceiver(EventSet* receiver);
00128
00133 EventSet* getEventReceiver() const;
00134
00141 void setEventSender(EventSet* sender);
00142
00147 EventSet* getEventSender() const;
00148
00154 void setTargetWindow(Window* target);
00155
00161 void setPosition(float position);
00162
00167 float getPosition() const;
00168
00174 void setSpeed(float speed);
00175
00180 float getSpeed() const;
00181
00186 void setSkipNextStep(bool skip);
00187
00196 bool getSkipNextStep() const;
00197
00213 void setMaxStepDeltaSkip(float maxDelta);
00214
00219 float getMaxStepDeltaSkip() const;
00220
00234 void setMaxStepDeltaClamp(float maxDelta);
00235
00240 float getMaxStepDeltaClamp() const;
00241
00252 void start(bool skipNextStep = true);
00253
00258 void stop();
00259
00264 void pause();
00265
00273 void unpause(bool skipNextStep = true);
00274
00283 void togglePause(bool skipNextStep = true);
00284
00290 bool isRunning() const;
00291
00296 void step(float delta);
00297
00302 bool handleStart(const CEGUI::EventArgs& e);
00303
00308 bool handleStop(const CEGUI::EventArgs& e);
00309
00314 bool handlePause(const CEGUI::EventArgs& e);
00315
00320 bool handleUnpause(const CEGUI::EventArgs& e);
00321
00326 bool handleTogglePause(const CEGUI::EventArgs& e);
00327
00332 void savePropertyValue(const String& propertyName);
00333
00337 void purgeSavedPropertyValues(void);
00338
00342 const String& getSavedPropertyValue(const String& propertyName);
00343
00351 void addAutoConnection(Event::Connection conn);
00352
00360 void unsubscribeAutoConnections();
00361
00362 private:
00364 void apply();
00365
00367 void onAnimationStarted();
00369 void onAnimationStopped();
00371 void onAnimationPaused();
00373 void onAnimationUnpaused();
00374
00376 void onAnimationEnded();
00378 void onAnimationLooped();
00379
00381 Animation* d_definition;
00382
00384 PropertySet* d_target;
00386 EventSet* d_eventReceiver;
00390 EventSet* d_eventSender;
00391
00396 float d_position;
00398 float d_speed;
00400 bool d_bounceBackwards;
00402 bool d_running;
00404 bool d_skipNextStep;
00406 float d_maxStepDeltaSkip;
00408 float d_maxStepDeltaClamp;
00409
00410 typedef std::map<String, String> PropertyValueMap;
00414 PropertyValueMap d_savedPropertyValues;
00415
00416 typedef std::vector<Event::Connection> ConnectionTracker;
00418 ConnectionTracker d_autoConnections;
00419 };
00420
00421 }
00422
00423 #if defined(_MSC_VER)
00424 # pragma warning(pop)
00425 #endif
00426
00427 #endif // end of guard _CEGUIAnimationInstance_h_
00428