Crazy Eddie's GUI System  0.8.1
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
Animation.h
1 /***********************************************************************
2  filename: CEGUIAnimation.h
3  created: 7/8/2010
4  author: Martin Preisler
5 
6  purpose: Defines the interface for the Animation class
7 *************************************************************************/
8 /***************************************************************************
9  * Copyright (C) 2004 - 2010 Paul D Turner & The CEGUI Development Team
10  *
11  * Permission is hereby granted, free of charge, to any person obtaining
12  * a copy of this software and associated documentation files (the
13  * "Software"), to deal in the Software without restriction, including
14  * without limitation the rights to use, copy, modify, merge, publish,
15  * distribute, sublicense, and/or sell copies of the Software, and to
16  * permit persons to whom the Software is furnished to do so, subject to
17  * the following conditions:
18  *
19  * The above copyright notice and this permission notice shall be
20  * included in all copies or substantial portions of the Software.
21  *
22  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
25  * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
26  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
27  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
28  * OTHER DEALINGS IN THE SOFTWARE.
29  ***************************************************************************/
30 #ifndef _CEGUIAnimation_h_
31 #define _CEGUIAnimation_h_
32 
33 #include "CEGUI/String.h"
34 #include <vector>
35 #include <map>
36 
37 #if defined(_MSC_VER)
38 # pragma warning(push)
39 # pragma warning(disable : 4251)
40 #endif
41 
42 // Start of CEGUI namespace section
43 namespace CEGUI
44 {
45 
65 class CEGUIEXPORT Animation : public AllocatedObject<Animation>
66 {
67 public:
70  {
78  RM_Bounce
79  };
80 
84  Animation(const String& name);
85 
87  ~Animation(void);
88 
93  const String& getName() const;
94 
99  void setReplayMode(ReplayMode mode);
100 
105  ReplayMode getReplayMode() const;
106 
111  void setDuration(float duration);
112 
117  float getDuration() const;
118 
127  void setAutoStart(bool autoStart);
128 
136  bool getAutoStart() const;
137 
145  Affector* createAffector(void);
146 
154  Affector* createAffector(const String& targetProperty,
155  const String& interpolator);
156 
161  void destroyAffector(Affector* affector);
162 
167  Affector* getAffectorAtIdx(size_t index) const;
168 
173  size_t getNumAffectors(void) const;
174 
200  void defineAutoSubscription(const String& eventName, const String& action);
201 
209  void undefineAutoSubscription(const String& eventName,
210  const String& action);
211 
219  void undefineAllAutoSubscriptions();
220 
229  void autoSubscribe(AnimationInstance* instance);
230 
239  void autoUnsubscribe(AnimationInstance* instance);
240 
250  void savePropertyValues(AnimationInstance* instance);
251 
260  void apply(AnimationInstance* instance);
261 
272  void writeXMLToStream(XMLSerializer& xml_stream, const String& name_override = "") const;
273 
274 private:
276  String d_name;
277 
279  ReplayMode d_replayMode;
281  float d_duration;
285  bool d_autoStart;
286 
287  typedef std::vector<Affector*
288  CEGUI_VECTOR_ALLOC(Affector*)> AffectorList;
290  AffectorList d_affectors;
291 
292  typedef std::multimap<String, String, std::less<String>
293  CEGUI_MAP_ALLOC(String, String)> SubscriptionMap;
298  SubscriptionMap d_autoSubscriptions;
299 };
300 
301 } // End of CEGUI namespace section
302 
303 #if defined(_MSC_VER)
304 # pragma warning(pop)
305 #endif
306 
307 #endif // end of guard _CEGUIAnimation_h_
308