Crazy Eddie's GUI System  0.8.4
Animation.h
00001 /***********************************************************************
00002     created:    7/8/2010
00003     author:     Martin Preisler
00004 
00005     purpose:    Defines the interface for the Animation class
00006 *************************************************************************/
00007 /***************************************************************************
00008  *   Copyright (C) 2004 - 2010 Paul D Turner & The CEGUI Development Team
00009  *
00010  *   Permission is hereby granted, free of charge, to any person obtaining
00011  *   a copy of this software and associated documentation files (the
00012  *   "Software"), to deal in the Software without restriction, including
00013  *   without limitation the rights to use, copy, modify, merge, publish,
00014  *   distribute, sublicense, and/or sell copies of the Software, and to
00015  *   permit persons to whom the Software is furnished to do so, subject to
00016  *   the following conditions:
00017  *
00018  *   The above copyright notice and this permission notice shall be
00019  *   included in all copies or substantial portions of the Software.
00020  *
00021  *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00022  *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00023  *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
00024  *   IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
00025  *   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
00026  *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
00027  *   OTHER DEALINGS IN THE SOFTWARE.
00028  ***************************************************************************/
00029 #ifndef _CEGUIAnimation_h_
00030 #define _CEGUIAnimation_h_
00031 
00032 #include "CEGUI/String.h"
00033 #include <vector>
00034 #include <map>
00035 
00036 #if defined(_MSC_VER)
00037 #   pragma warning(push)
00038 #   pragma warning(disable : 4251)
00039 #endif
00040 
00041 // Start of CEGUI namespace section
00042 namespace CEGUI
00043 {
00044 
00064 class CEGUIEXPORT Animation : public AllocatedObject<Animation>
00065 {
00066 public:
00068     enum ReplayMode
00069     {
00071         RM_Once,
00073         RM_Loop,
00077         RM_Bounce
00078     };
00079 
00083     Animation(const String& name);
00084 
00086     ~Animation(void);
00087 
00092     const String& getName() const;
00093 
00098     void setReplayMode(ReplayMode mode);
00099 
00104     ReplayMode getReplayMode() const;
00105 
00110     void setDuration(float duration);
00111 
00116     float getDuration() const;
00117 
00126     void setAutoStart(bool autoStart);
00127 
00135     bool getAutoStart() const;
00136 
00144     Affector* createAffector(void);
00145 
00153     Affector* createAffector(const String& targetProperty,
00154                              const String& interpolator);
00155 
00160     void destroyAffector(Affector* affector);
00161 
00166     Affector* getAffectorAtIdx(size_t index) const;
00167 
00172     size_t getNumAffectors(void) const;
00173 
00199     void defineAutoSubscription(const String& eventName, const String& action);
00200 
00208     void undefineAutoSubscription(const String& eventName,
00209                                   const String& action);
00210 
00218     void undefineAllAutoSubscriptions();
00219 
00228     void autoSubscribe(AnimationInstance* instance);
00229 
00238     void autoUnsubscribe(AnimationInstance* instance);
00239 
00249     void savePropertyValues(AnimationInstance* instance);
00250 
00259     void apply(AnimationInstance* instance);
00260 
00271     void writeXMLToStream(XMLSerializer& xml_stream, const String& name_override = "") const;
00272 
00273 private:
00275     String d_name;
00276 
00278     ReplayMode d_replayMode;
00280     float d_duration;
00284     bool d_autoStart;
00285 
00286     typedef std::vector<Affector*
00287         CEGUI_VECTOR_ALLOC(Affector*)> AffectorList;
00289     AffectorList d_affectors;
00290 
00291     typedef std::multimap<String, String, std::less<String>
00292         CEGUI_MAP_ALLOC(String, String)> SubscriptionMap;
00297     SubscriptionMap d_autoSubscriptions;
00298 };
00299 
00300 } // End of  CEGUI namespace section
00301 
00302 #if defined(_MSC_VER)
00303 #   pragma warning(pop)
00304 #endif
00305 
00306 #endif  // end of guard _CEGUIAnimation_h_
00307 
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends