Crazy Eddie's GUI System  0.8.6
Affector.h
1 /***********************************************************************
2  created: 7/8/2010
3  author: Martin Preisler
4 
5  purpose: Defines the interface for the Affector clas
6 *************************************************************************/
7 /***************************************************************************
8  * Copyright (C) 2004 - 2010 Paul D Turner & The CEGUI Development Team
9  *
10  * Permission is hereby granted, free of charge, to any person obtaining
11  * a copy of this software and associated documentation files (the
12  * "Software"), to deal in the Software without restriction, including
13  * without limitation the rights to use, copy, modify, merge, publish,
14  * distribute, sublicense, and/or sell copies of the Software, and to
15  * permit persons to whom the Software is furnished to do so, subject to
16  * the following conditions:
17  *
18  * The above copyright notice and this permission notice shall be
19  * included in all copies or substantial portions of the Software.
20  *
21  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
24  * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
25  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
26  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27  * OTHER DEALINGS IN THE SOFTWARE.
28  ***************************************************************************/
29 #ifndef _CEGUIAffector_h_
30 #define _CEGUIAffector_h_
31 
32 #include "CEGUI/String.h"
33 #include "CEGUI/KeyFrame.h"
34 #include <map>
35 
36 #if defined(_MSC_VER)
37 # pragma warning(push)
38 # pragma warning(disable : 4251)
39 #endif
40 
41 // Start of CEGUI namespace section
42 namespace CEGUI
43 {
44 
55 class CEGUIEXPORT Affector : public AllocatedObject<Affector>
56 {
57 public:
60  {
63 
68 
72  AM_RelativeMultiply
73  };
74 
78  Affector(Animation* parent);
79 
81  ~Affector(void);
82 
87  inline Animation* getParent() const
88  {
89  return d_parent;
90  }
91 
99  size_t getIdxInParent() const;
100 
109  void setApplicationMethod(ApplicationMethod method);
110 
118  ApplicationMethod getApplicationMethod() const;
119 
124  void setTargetProperty(const String& target);
125 
130  const String& getTargetProperty() const;
131 
139  void setInterpolator(Interpolator* interpolator);
140 
148  void setInterpolator(const String& name);
149 
154  Interpolator* getInterpolator() const;
155 
160  KeyFrame* createKeyFrame(float position);
161 
170  KeyFrame* createKeyFrame(float position, const String& value,
172  const String& sourceProperty = "");
173 
178  void destroyKeyFrame(KeyFrame* keyframe);
179 
184  KeyFrame* getKeyFrameAtPosition(float position) const;
185 
190  bool hasKeyFrameAtPosition(float position) const;
191 
196  KeyFrame* getKeyFrameAtIdx(size_t index) const;
197 
202  size_t getNumKeyFrames() const;
203 
208  void moveKeyFrameToPosition(KeyFrame* keyframe, float newPosition);
209 
214  void moveKeyFrameToPosition(float oldPosition, float newPosition);
215 
225  void savePropertyValues(AnimationInstance* instance);
226 
239  void apply(AnimationInstance* instance);
240 
248  void writeXMLToStream(XMLSerializer& xml_stream) const;
249 
250 private:
252  Animation* d_parent;
254  ApplicationMethod d_applicationMethod;
256  String d_targetProperty;
258  Interpolator* d_interpolator;
259 
260  typedef std::map<float, KeyFrame*, std::less<float>
261  CEGUI_MAP_ALLOC(float, KeyFrame*)> KeyFrameMap;
265  KeyFrameMap d_keyFrames;
266 };
267 
268 } // End of CEGUI namespace section
269 
270 #if defined(_MSC_VER)
271 # pragma warning(pop)
272 #endif
273 
274 #endif // end of guard _CEGUIAffector_h_
275 
applies values as absolutes
Definition: Affector.h:62
Progression
Definition: KeyFrame.h:56
Definition: Affector.h:67
Definition: MemoryAllocatedObject.h:109
Defines a 'key frame' class.
Definition: KeyFrame.h:49
Main namespace for Crazy Eddie's GUI Library.
Definition: arch_overview.dox:1
Defines an 'animation' class.
Definition: Animation.h:64
Animation * getParent() const
Retrieves the parent animation of this keyframe.
Definition: Affector.h:87
Defines an 'affector' class.
Definition: Affector.h:55
ApplicationMethod
enumerates the possible methods of application
Definition: Affector.h:59
Class used to create XML Document.
Definition: XMLSerializer.h:85
Defines a 'interpolator' class.
Definition: Interpolator.h:53
linear progression
Definition: KeyFrame.h:59
Defines an 'animation instance' class.
Definition: AnimationInstance.h:73
String class used within the GUI system.
Definition: String.h:62