source:
orxonox.OLD/branches/qt_gui/src/lib/gui/gui_saveable.h
@
7555
Last change on this file since 7555 was 7555, checked in by bensch, 18 years ago | |
---|---|
File size: 1.4 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 | |
[7539] | 27 | virtual void load(const MultiType& value) {}; |
28 | virtual const MultiType& save() {}; | |
[7149] | 29 | |
[7539] | 30 | MultiType& value() { return this->_value; }; |
31 | const MultiType& value() const { return this->_value; }; | |
[7478] | 32 | bool isSaveable() const { return this->bSaveable; }; |
[7140] | 33 | |
[7478] | 34 | protected: |
[7555] | 35 | Saveable(const std::string& optionName, SaveableGroup* group); |
[7478] | 36 | virtual void makingElementSaveable() {}; |
[7145] | 37 | |
[7478] | 38 | private: |
[7555] | 39 | SaveableGroup* group; |
[7539] | 40 | MultiType _value; |
[7478] | 41 | bool bSaveable; |
42 | }; | |
[1853] | 43 | |
[7143] | 44 | |
[7149] | 45 | |
[7555] | 46 | class SaveableGroup : public BaseObject |
[7478] | 47 | { |
48 | public: | |
[7480] | 49 | virtual ~SaveableGroup(); |
[7145] | 50 | |
[7480] | 51 | void addSaveable(Saveable* saveable); |
52 | void removeSaveable(Saveable* saveable); | |
[7143] | 53 | |
[7493] | 54 | virtual void load(const MultiType& value); |
55 | virtual const MultiType& save(); | |
56 | ||
[7478] | 57 | protected: |
[7549] | 58 | SaveableGroup(const std::string& name, OrxGui::Gui* gui); |
[7143] | 59 | |
[7478] | 60 | private: |
[7555] | 61 | OrxGui::Gui* gui; |
[7480] | 62 | std::vector<Saveable*> saveables; |
[7478] | 63 | }; |
64 | ||
65 | } | |
[7140] | 66 | #endif /* _GUI_SAVEABLE_H */ |
Note: See TracBrowser
for help on using the repository browser.