source:
orxonox.OLD/trunk/src/lib/gui/gui_saveable.h
@
10626
Last change on this file since 10626 was 7661, checked in by bensch, 19 years ago | |
---|---|
File size: 1.5 KB |
Rev | Line | |
---|---|---|
[4838] | 1 | /*! |
[7140] | 2 | * @file gui_saveable.h |
[4838] | 3 | * @brief Definition of ... |
[3245] | 4 | */ |
[1853] | 5 | |
[7140] | 6 | #ifndef _GUI_SAVEABLE_H |
7 | #define _GUI_SAVEABLE_H | |
[1853] | 8 | |
[3543] | 9 | #include "base_object.h" |
[7489] | 10 | #include "lib/util/multi_type.h" |
[7447] | 11 | #include <vector> |
[1853] | 12 | |
[4838] | 13 | // FORWARD DECLARATION |
[7478] | 14 | namespace OrxGui |
15 | { | |
[7549] | 16 | class Gui; |
[7555] | 17 | class SaveableGroup; |
[7549] | 18 | |
[7555] | 19 | //! A class for Elements in the Gui that are Saveable. |
[7480] | 20 | class Saveable : public BaseObject |
[7447] | 21 | { |
[7478] | 22 | public: |
[7480] | 23 | virtual ~Saveable(); |
[1853] | 24 | |
[7478] | 25 | void makeSaveable(); |
[1853] | 26 | |
[7598] | 27 | virtual void load(); |
28 | virtual void save(); | |
[7149] | 29 | |
[7539] | 30 | MultiType& value() { return this->_value; }; |
31 | const MultiType& value() const { return this->_value; }; | |
[7633] | 32 | MultiType& defaultValue() { return this->_defaultValue; }; |
33 | const MultiType& defaultValue() const { return this->_defaultValue; }; | |
[7478] | 34 | bool isSaveable() const { return this->bSaveable; }; |
[7140] | 35 | |
[7478] | 36 | protected: |
[7632] | 37 | Saveable(const std::string& optionName, SaveableGroup* group, const MultiType& defaultValue); |
[7478] | 38 | virtual void makingElementSaveable() {}; |
[7145] | 39 | |
[7478] | 40 | private: |
[7555] | 41 | SaveableGroup* group; |
[7539] | 42 | MultiType _value; |
[7632] | 43 | MultiType _defaultValue; |
[7478] | 44 | bool bSaveable; |
45 | }; | |
[1853] | 46 | |
[7143] | 47 | |
[7149] | 48 | |
[7555] | 49 | class SaveableGroup : public BaseObject |
[7478] | 50 | { |
51 | public: | |
[7480] | 52 | virtual ~SaveableGroup(); |
[7145] | 53 | |
[7480] | 54 | void addSaveable(Saveable* saveable); |
55 | void removeSaveable(Saveable* saveable); | |
[7143] | 56 | |
[7598] | 57 | virtual void load(); |
58 | virtual void save(); | |
[7493] | 59 | |
[7478] | 60 | protected: |
[7549] | 61 | SaveableGroup(const std::string& name, OrxGui::Gui* gui); |
[7143] | 62 | |
[7478] | 63 | private: |
[7555] | 64 | OrxGui::Gui* gui; |
[7480] | 65 | std::vector<Saveable*> saveables; |
[7478] | 66 | }; |
67 | ||
68 | } | |
[7140] | 69 | #endif /* _GUI_SAVEABLE_H */ |
Note: See TracBrowser
for help on using the repository browser.