Crazy Eddie's GUI System  0.8.4
Affector.h
00001 /***********************************************************************
00002     created:    7/8/2010
00003     author:     Martin Preisler
00004 
00005     purpose:    Defines the interface for the Affector clas
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 _CEGUIAffector_h_
00030 #define _CEGUIAffector_h_
00031 
00032 #include "CEGUI/String.h"
00033 #include "CEGUI/KeyFrame.h"
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 
00055 class CEGUIEXPORT Affector : public AllocatedObject<Affector>
00056 {
00057 public:
00059     enum ApplicationMethod
00060     {
00062         AM_Absolute,
00063 
00067         AM_Relative,
00068 
00072         AM_RelativeMultiply
00073     };
00074 
00078     Affector(Animation* parent);
00079 
00081     ~Affector(void);
00082 
00087     inline Animation* getParent() const
00088     {
00089         return d_parent;
00090     }
00091 
00099     size_t getIdxInParent() const;
00100 
00109     void setApplicationMethod(ApplicationMethod method);
00110 
00118     ApplicationMethod getApplicationMethod() const;
00119 
00124     void setTargetProperty(const String& target);
00125 
00130     const String& getTargetProperty() const;
00131 
00139     void setInterpolator(Interpolator* interpolator);
00140 
00148     void setInterpolator(const String& name);
00149 
00154     Interpolator* getInterpolator() const;
00155 
00160     KeyFrame* createKeyFrame(float position);
00161 
00170     KeyFrame* createKeyFrame(float position, const String& value,
00171                              KeyFrame::Progression progression = KeyFrame::P_Linear,
00172                              const String& sourceProperty = "");
00173 
00178     void destroyKeyFrame(KeyFrame* keyframe);
00179 
00184     KeyFrame* getKeyFrameAtPosition(float position) const;
00185 
00190     bool hasKeyFrameAtPosition(float position) const;
00191 
00196     KeyFrame* getKeyFrameAtIdx(size_t index) const;
00197 
00202     size_t getNumKeyFrames() const;
00203 
00208     void moveKeyFrameToPosition(KeyFrame* keyframe, float newPosition);
00209 
00214     void moveKeyFrameToPosition(float oldPosition, float newPosition);
00215 
00225     void savePropertyValues(AnimationInstance* instance);
00226 
00239     void apply(AnimationInstance* instance);
00240 
00248     void writeXMLToStream(XMLSerializer& xml_stream) const;
00249 
00250 private:
00252     Animation* d_parent;
00254     ApplicationMethod d_applicationMethod;
00256     String d_targetProperty;
00258     Interpolator* d_interpolator;
00259 
00260     typedef std::map<float, KeyFrame*, std::less<float>
00261         CEGUI_MAP_ALLOC(float, KeyFrame*)> KeyFrameMap;
00265     KeyFrameMap d_keyFrames;
00266 };
00267 
00268 } // End of  CEGUI namespace section
00269 
00270 #if defined(_MSC_VER)
00271 #   pragma warning(pop)
00272 #endif
00273 
00274 #endif  // end of guard _CEGUIAffector_h_
00275 
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends