Changeset 2485 for code/branches/presentation/src/core/BaseObject.h
- Timestamp:
- Dec 16, 2008, 6:01:13 PM (16 years ago)
- Location:
- code/branches/presentation
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentation
-
code/branches/presentation/src/core/BaseObject.h
r2171 r2485 36 36 #ifndef _BaseObject_H__ 37 37 #define _BaseObject_H__ 38 39 #define SetMainState(classname, statename, setfunction, getfunction) \ 40 if (this->getMainStateName() == statename) \ 41 { \ 42 this->functorSetMainState_ = createFunctor(&classname::setfunction)->setObject(this); \ 43 this->functorGetMainState_ = createFunctor(&classname::getfunction)->setObject(this); \ 44 } 38 45 39 46 #include <map> … … 100 107 virtual void changedVisibility() {} 101 108 109 void setMainState(bool state); 110 bool getMainState() const; 111 112 void setMainStateName(const std::string& name); 113 inline const std::string& getMainStateName() const { return this->mainStateName_; } 114 virtual void changedMainState(); 115 102 116 /** @brief Sets a pointer to the xml file that loaded this object. @param file The pointer to the XMLFile */ 103 117 inline void setFile(const XMLFile* file) { this->file_ = file; } … … 121 135 inline Scene* getScene() const { return this->scene_; } 122 136 123 inline void setGametype(Gametype* gametype) { this->oldGametype_ = this->gametype_; this->gametype_ = gametype; this->changedGametype(); } 137 inline void setGametype(Gametype* gametype) 138 { 139 if (gametype != this->gametype_) 140 { 141 this->oldGametype_ = this->gametype_; 142 this->gametype_ = gametype; 143 this->changedGametype(); 144 } 145 } 124 146 inline Gametype* getGametype() const { return this->gametype_; } 125 147 inline Gametype* getOldGametype() const { return this->oldGametype_; } 126 virtual inlinevoid changedGametype() {}148 virtual void changedGametype() {} 127 149 128 150 void fireEvent(); … … 153 175 std::string name_; //!< The name of the object 154 176 std::string oldName_; //!< The old name of the object 155 mbool bActive_; //!< True = the object is active 156 mbool bVisible_; //!< True = the object is visible 177 mbool bActive_; //!< True = the object is active 178 mbool bVisible_; //!< True = the object is visible 179 std::string mainStateName_; 180 Functor* functorSetMainState_; 181 Functor* functorGetMainState_; 157 182 158 183 private: … … 160 185 Template* getTemplate(unsigned int index) const; 161 186 162 bool bInitialized_; //!< True if the object was initialized (passed the object registration)163 const XMLFile* file_; //!< The XMLFile that loaded this object164 std::string loaderIndentation_; //!< Indentation of the debug output in the Loader165 Namespace* namespace_;166 BaseObject* creator_;167 Scene* scene_;168 Gametype* gametype_;169 Gametype* oldGametype_;170 std::set<Template*> templates_;171 std::map<BaseObject*, std::string> eventListeners_;187 bool bInitialized_; //!< True if the object was initialized (passed the object registration) 188 const XMLFile* file_; //!< The XMLFile that loaded this object 189 std::string loaderIndentation_; //!< Indentation of the debug output in the Loader 190 Namespace* namespace_; 191 BaseObject* creator_; 192 Scene* scene_; 193 Gametype* gametype_; 194 Gametype* oldGametype_; 195 std::set<Template*> templates_; 196 std::map<BaseObject*, std::string> eventListeners_; 172 197 std::list<BaseObject*> events_; 173 198 std::map<std::string, EventContainer*> eventContainers_; … … 178 203 SUPER_FUNCTION(3, BaseObject, changedVisibility, false); 179 204 SUPER_FUNCTION(4, BaseObject, processEvent, false); 205 SUPER_FUNCTION(6, BaseObject, changedMainState, false); 206 SUPER_FUNCTION(9, BaseObject, changedName, false); 207 SUPER_FUNCTION(10, BaseObject, changedGametype, false); 180 208 } 181 209
Note: See TracChangeset
for help on using the changeset viewer.