ObjectTransferable.h

Go to the documentation of this file.
00001 
00011 #ifndef __OBJECTTRANSFERABLE__H__
00012 #define __OBJECTTRANSFERABLE__H__
00013 
00014 #include <wx/wx.h>
00015 #include <wx/colour.h>
00016 
00017 #include "../common.h"
00018 #include "../tinyxml/tinyxml.h"
00019 #include "Object.h"
00020 
00024 class ObjectTransferable: public Object {
00025 public:
00029         class Config: public Object::Config {
00030         public:
00039                 Config(const string & imageFile, const Direction & objectDirection, const Action & objectAction,
00040                         const string & objectName, const string & objectDescription):
00041                                 Object::Config(imageFile, objectDirection, objectAction, objectName, objectDescription)
00042                 {}
00043 
00047                 explicit Config(TiXmlElement * node);
00048 
00052                 virtual ~Config() {}
00053 
00059                 virtual void ShowEditationWindow(wxWindow * parent, bool waitUntilClosed = true);
00060 
00064                 virtual TiXmlElement * CreateXmlNode() const;
00065 
00069                 virtual const string & GetObjectClassName() const {
00070                         return CLASS_NAME;
00071                 }
00072 
00078                 virtual const wxColour * GetObjectTextColour() const {
00079                         return wxGREEN;
00080                 }
00081         };
00082 
00083 
00084 public:
00089         ObjectTransferable(const ObjectTransferable::Config & config): Object(config) {}
00090 
00094         virtual ~ObjectTransferable() {}
00095 
00100         void Collision(Object * collisionObject) {}
00101 
00108         virtual Object::Config * CreateObjectConfig() const;
00109 
00119         virtual void LoadFromConfig(const Object::Config & config, bool fullLoad = true);
00120 
00125         virtual void SetAction(const Action & newAction) {
00126                 if (newAction.GetAction() != Object::Action::WAIT) {
00127                         THROW(ExceptionObjectBadAction, "Transferable object can not change its action.");
00128                 }
00129         }
00130 
00136         virtual void SetDirection(const Direction & newDirection) {
00137                 direction.SetDirection(newDirection.GetDirection());
00138         }
00139 
00143         virtual const Priority & GetPriority() const {
00144                 return ObjectTransferable::PRIORITY;
00145         }
00146 
00151         virtual bool CanAppearMoreThenOnce() const {
00152                 return ObjectTransferable::CAN_APPEAR_MORE_THEN_ONCE;
00153         }
00154 
00159         virtual const string & GetClassName() const {
00160                 return ObjectTransferable::CLASS_NAME;
00161         }
00162 
00166         virtual void ChooseNextAction() {}
00167 
00172         virtual bool IsImaginary() const {
00173                 return false;
00174         }
00175 
00179         virtual bool IsEditableByUser() const {
00180                 return true;
00181         }
00182 
00186         virtual bool IsMoveableByUser() const {
00187                 return true;
00188         }
00189 
00190 public:
00192         static const string CLASS_NAME;
00193 
00194 private:
00196         static const Object::Priority PRIORITY;
00198         static const bool CAN_APPEAR_MORE_THEN_ONCE;
00199 };
00200 
00201 #endif /* #ifndef __OBJECTTRANSFERABLE__H__ */
00202 
00203 /* End of file ObjectTransferable.h */

Generated on Sun Apr 29 11:46:10 2007 for IPP/ICP2007 by  doxygen 1.4.7