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