Changeset 7447 in orxonox.OLD for branches/qt_gui/src/lib
- Timestamp:
- Apr 29, 2006, 7:49:19 PM (19 years ago)
- Location:
- branches/qt_gui/src/lib
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/qt_gui/src/lib/gui/qt_gui/gui_saveable.cc
r7442 r7447 18 18 #include "gui_saveable.h" 19 19 20 using namespace std; 20 namespace OrxGui 21 { 22 23 /** 24 * standard constructor 25 */ 26 GuiSaveable::GuiSaveable (const std::string& optionName) 27 { 28 this->bSaveable = false; 29 } 21 30 22 31 23 /** 24 * standard constructor 25 */ 26 GuiSaveable::GuiSaveable () 27 { 28 this->setClassID(CL_GUI_SAVEABLE, "GuiSaveable"); 29 30 } 32 /** 33 * standard deconstructor 34 */ 35 GuiSaveable::~GuiSaveable () 36 { 37 // delete what has to be deleted here 38 } 31 39 32 40 33 /** 34 * standard deconstructor 35 */ 36 GuiSaveable::~GuiSaveable () 37 { 38 // delete what has to be deleted here 39 } 41 void GuiSaveable::makeSaveable() 42 { 43 this->bSaveable = true; 44 45 } 40 46 41 47 42 GuiGroup::GuiGroup(const char* groupName) 43 { 44 this->setName(groupName); 45 } 48 GuiSaveableGroup::GuiSaveableGroup(const std::string& groupName) 49 : GuiSaveable(groupName) 50 { 51 // this->setName(groupName); 52 } 46 53 47 54 48 GuiGroup::~GuiGroup() 49 { 55 56 57 GuiSaveableGroup::~GuiSaveableGroup() 58 { 59 std::vector<GuiSaveableGroup*>::iterator delGroup = std::find(saveableGroups.begin(), saveableGroups.end(), this); 60 61 if (delGroup != saveableGroups.end() ) 62 saveableGroups.erase(delGroup); 63 } 64 65 std::vector<GuiSaveableGroup*> GuiSaveableGroup::saveableGroups; 66 67 void GuiSaveableGroup::makingElementSaveable() 68 { 69 GuiSaveableGroup::saveableGroups.push_back(this); 70 } 50 71 51 72 -
branches/qt_gui/src/lib/gui/qt_gui/gui_saveable.h
r7442 r7447 9 9 #include "base_object.h" 10 10 #include "multi_type.h" 11 #include < list>11 #include <vector> 12 12 13 13 // FORWARD DECLARATION 14 14 15 namespace OrxGui 16 { 17 //! A class for ... 18 class GuiSaveable 19 { 20 public: 21 protected: 22 GuiSaveable(const std::string& optionName); 23 virtual ~GuiSaveable(); 15 24 16 //! A class for ... 17 class GuiSaveable : virtual public BaseObject 18 { 25 void makeSaveable(); 19 26 20 public: 27 virtual void load(const MultiType& value) = 0; 28 virtual const MultiType& save() = 0; 21 29 30 MultiType& getValue() { return this->value; }; 31 const MultiType& getValue() const { return this->value; }; 32 bool isSaveable() const { return this->bSaveable; }; 22 33 23 protected: 24 GuiSaveable(); 25 virtual ~GuiSaveable(); 34 protected: 35 virtual void makingElementSaveable() {}; 26 36 27 virtual void load(const MultiType& value) = 0; 28 virtual const MultiType& save() = 0; 29 30 protected: 31 MultiType value; 32 }; 37 private: 38 MultiType value; 39 bool bSaveable; 40 }; 33 41 34 42 35 43 36 class GuiGroup : virtual public BaseObject 37 {38 public:39 GuiGroup(const char*name);40 ~GuiGroup();44 class GuiSaveableGroup : virtual public GuiSaveable 45 { 46 public: 47 GuiSaveableGroup(const std::string& name); 48 ~GuiSaveableGroup(); 41 49 42 void addSaveable(GuiSaveable* saveable); 50 void addSaveable(GuiSaveable* saveable); 51 void removeSaveable(GuiSaveable* saveable); 43 52 44 private: 45 std::list<GuiSaveable*> saveables; 46 }; 53 protected: 54 virtual void makingElementSaveable(); 55 private: 56 std::vector<GuiSaveable*> saveables; 57 static std::vector<GuiSaveableGroup*> saveableGroups; 58 }; 47 59 60 } 48 61 49 62 #endif /* _GUI_SAVEABLE_H */ -
branches/qt_gui/src/lib/gui/qt_gui/qt_gui.cc
r7442 r7447 18 18 #include "qt_gui.h" 19 19 20 using namespace std; 20 namespace OrxGui 21 { 21 22 23 24 25 } -
branches/qt_gui/src/lib/gui/qt_gui/qt_gui.h
r7442 r7447 24 24 #include <qlineedit.h> 25 25 26 namespace OrxGui 27 { 26 28 27 class QtGuiWidget : virtual public BaseObject28 {29 public:30 };29 class QtGuiWidget : virtual public BaseObject 30 { 31 public: 32 }; 31 33 32 34 33 class QtGuiContainer 34 {35 public:36 virtual bool pack(QtGuiWidget* widget) = 0;35 class QtGuiContainer : public QtGuiWidget 36 { 37 public: 38 virtual bool pack(QtGuiWidget* widget) = 0; 37 39 38 protected:39 QtGuiContainer();40 ~QtGuiContainer();40 protected: 41 QtGuiContainer(); 42 ~QtGuiContainer(); 41 43 42 private:44 private: 43 45 44 };46 }; 45 47 46 48 47 class QtGuiBox : public QtGuiContainer48 {49 public:50 49 typedef enum Orientation 51 50 { … … 54 53 }; 55 54 56 public: 57 QtGuiBox(Orientation orientation); 58 ~QtGuiBox(); 55 class QtGuiBox : public QtGuiContainer, public GuiSaveableGroup 56 { 59 57 60 virtual bool pack(QtGuiWidget* widget); 58 public: 59 QtGuiBox(Orientation orientation); 60 ~QtGuiBox(); 61 61 62 private: 63 std::list<QtGuiWidget*> children; 62 virtual bool pack(QtGuiWidget* widget); 64 63 65 }; 64 private: 65 std::list<QtGuiWidget*> children; 66 66 67 class QtGuiGroupBox : public QtGuiContainer, public GuiGroup 68 { 69 public: 70 QtGuiGroupBox(const char* groupName); 71 ~QtGuiGroupBox(); 67 }; 72 68 73 virtual bool pack(QtGuiWidget* widget); 69 class QtGuiGroupBox : public QtGuiContainer, public GuiSaveableGroup 70 { 71 public: 72 QtGuiGroupBox(const std::string& groupName); 73 ~QtGuiGroupBox(); 74 74 75 private: 76 QtGuiWidget* child; 77 }; 75 virtual bool pack(QtGuiWidget* widget); 76 77 private: 78 QtGuiWidget* child; 79 }; 78 80 79 81 80 class QtGuiCheckBox : public QCheckBox, public QtGuiWidget, public GuiSaveable81 {82 public:83 QtGuiCheckBox(const char* name, bool defaultValue = false);84 ~QtGuiCheckBox();85 82 86 public slots: 87 void setCheckValue(int); 83 class QtGuiCheckBox : public QCheckBox, public QtGuiWidget, public GuiSaveable 84 { 85 public: 86 QtGuiCheckBox(const std::string& name, bool defaultValue = false); 87 ~QtGuiCheckBox(); 88 88 89 signals: 90 void checkValueChanged(); 91 }; 89 public slots: 90 void setCheckValue(int); 92 91 93 class QtGuiPushButtom : public QPushButton, public QtGuiWidget 94 { 95 public: 96 QtGuiPushButtom(); 97 ~QtGuiPushButtom(); 98 }; 99 100 class QtGuiSlider : public QSlider, public QtGuiWidget, public GuiSaveable 101 { 102 public: 103 QtGuiSlider(); 104 ~QtGuiSlider(); 105 106 public slots: 107 void setSliderValue(float); 108 109 signals: 110 void sliderValueChanged(float); 111 }; 112 113 class QtGuiTextLine : public QLineEdit, public QtGuiWidget, public GuiSaveable 114 { 115 public: 116 QtGuiTextLine(); 117 ~QtGuiTextLine(); 118 119 public slots: 120 void setTextLineValue(const char*); 121 signals: 122 void textLineChanged(const char*); 123 124 }; 92 signals: 93 void checkValueChanged(); 94 }; 125 95 126 96 97 class QtGuiPushButtom : public QPushButton, public QtGuiWidget 98 { 99 public: 100 QtGuiPushButtom(); 101 ~QtGuiPushButtom(); 102 }; 103 104 class QtGuiSlider : public QSlider, public QtGuiWidget, public GuiSaveable 105 { 106 public: 107 QtGuiSlider(); 108 ~QtGuiSlider(); 109 110 public slots: 111 void setSliderValue(float); 112 113 signals: 114 void sliderValueChanged(float); 115 }; 116 117 class QtGuiTextLine : public QLineEdit, public QtGuiWidget, public GuiSaveable 118 { 119 public: 120 QtGuiTextLine(); 121 ~QtGuiTextLine(); 122 123 public slots: 124 void setTextLineValue(const char*); 125 signals: 126 void textLineChanged(const char*); 127 }; 128 129 130 131 class QtGuiImage : public QtGuiWidget 132 { 133 } 134 ; 135 } 136 127 137 #endif /* __QT_GUI_H */ -
branches/qt_gui/src/lib/lang/base_object.cc
r7429 r7447 20 20 21 21 #include "util/loading/load_param.h" 22 #include "compiler.h"23 22 #include "class_list.h" 24 23 … … 32 31 * @param root the element to load from 33 32 */ 34 BaseObject::BaseObject( )33 BaseObject::BaseObject(const std::string& objectName) 35 34 { 36 35 this->classID = CL_BASE_OBJECT; 37 36 this->className = "BaseObject"; 38 37 39 this->objectName = "";38 this->objectName = objectName; 40 39 this->classList = NULL; 41 40 this->xmlElem = NULL; -
branches/qt_gui/src/lib/lang/base_object.h
r7221 r7447 27 27 28 28 public: 29 BaseObject ();29 BaseObject (const std::string& objectName = ""); 30 30 virtual ~BaseObject (); 31 31
Note: See TracChangeset
for help on using the changeset viewer.