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
00189 void start();
00190
00195 void stop();
00196
00201 void pause();
00202
00207 void unpause();
00208
00213 void togglePause();
00214
00220 bool isRunning() const;
00221
00226 void step(float delta);
00227
00232 bool handleStart(const CEGUI::EventArgs& e);
00233
00238 bool handleStop(const CEGUI::EventArgs& e);
00239
00244 bool handlePause(const CEGUI::EventArgs& e);
00245
00250 bool handleUnpause(const CEGUI::EventArgs& e);
00251
00256 bool handleTogglePause(const CEGUI::EventArgs& e);
00257
00262 void savePropertyValue(const String& propertyName);
00263
00267 void purgeSavedPropertyValues(void);
00268
00272 const String& getSavedPropertyValue(const String& propertyName);
00273
00281 void addAutoConnection(Event::Connection conn);
00282
00290 void unsubscribeAutoConnections();
00291
00292 private:
00294 void apply();
00295
00297 void onAnimationStarted();
00299 void onAnimationStopped();
00301 void onAnimationPaused();
00303 void onAnimationUnpaused();
00304
00306 void onAnimationEnded();
00308 void onAnimationLooped();
00309
00311 Animation* d_definition;
00312
00314 PropertySet* d_target;
00316 EventSet* d_eventReceiver;
00320 EventSet* d_eventSender;
00321
00326 float d_position;
00328 float d_speed;
00330 bool d_bounceBackwards;
00332 bool d_running;
00333
00334 typedef std::map<String, String> PropertyValueMap;
00338 PropertyValueMap d_savedPropertyValues;
00339
00340 typedef std::vector<Event::Connection> ConnectionTracker;
00342 ConnectionTracker d_autoConnections;
00343 };
00344
00345 }
00346
00347 #if defined(_MSC_VER)
00348 # pragma warning(pop)
00349 #endif
00350
00351 #endif // end of guard _CEGUIAnimationInstance_h_
00352