- Timestamp:
- May 5, 2006, 10:44:18 AM (19 years ago)
- Location:
- branches/qt_gui/src/lib/gui
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/qt_gui/src/lib/gui/gui_element.cc
r7484 r7539 42 42 // delete what has to be deleted here 43 43 } 44 45 /**46 * Every GuiElement should set this, or it could result in a SegFault.47 */48 void Element::setMainWidget(Widget* widget)49 {50 this->mainWidget = widget;51 }52 44 } -
branches/qt_gui/src/lib/gui/gui_element.h
r7484 r7539 21 21 Element(const std::string& name); 22 22 virtual ~Element(); 23 24 /** @returns the main Widget of this GuiElement. */25 Widget* getWidget() const { return this->mainWidget; }26 protected:27 void setMainWidget(Widget* widget);28 29 private:30 Widget* mainWidget;31 23 }; 32 24 } -
branches/qt_gui/src/lib/gui/gui_saveable.h
r7493 r7539 22 22 void makeSaveable(); 23 23 24 virtual void load(const MultiType& value) = 0;25 virtual const MultiType& save() = 0;24 virtual void load(const MultiType& value) {}; 25 virtual const MultiType& save() {}; 26 26 27 MultiType& getValue() { return this->value; };28 const MultiType& getValue() const { return this->value; };27 MultiType& value() { return this->_value; }; 28 const MultiType& value() const { return this->_value; }; 29 29 bool isSaveable() const { return this->bSaveable; }; 30 30 … … 34 34 35 35 private: 36 MultiType value;36 MultiType _value; 37 37 bool bSaveable; 38 38 }; -
branches/qt_gui/src/lib/gui/qt_gui/Makefile.am
r7495 r7539 16 16 libORXqtgui_a_SOURCES = \ 17 17 qt_gui.cc \ 18 qt_gui_elements.cc \ 18 19 \ 19 20 gui_video.cc \ … … 22 23 noinst_HEADERS= \ 23 24 qt_gui.h \ 25 qt_gui_elements.h \ 24 26 \ 25 27 gui_video.h \ -
branches/qt_gui/src/lib/gui/qt_gui/gui_audio.cc
r7534 r7539 28 28 29 29 #include <QtGui/QLayout> 30 #include "sdlincl.h"31 30 #include "debug.h" 32 31 33 #include <QtGui/QPushButton> 34 #include <QtGui/QCheckBox> 35 #include <QtGui/QComboBox> 32 #include "qt_gui_elements.h" 36 33 37 34 namespace OrxGui … … 46 43 47 44 { 48 Q CheckBox* fullscreen = new QCheckBox(QString("Enabled"));45 QtGuiCheckBox* fullscreen = new QtGuiCheckBox("Enabled", true); 49 46 //fullscreen->setName(); 50 47 layout->addWidget(fullscreen, 0, 0); 51 48 52 Q CheckBox* wireframe = new QCheckBox("Test");49 QtGuiCheckBox* wireframe = new QtGuiCheckBox("Test"); 53 50 layout->addWidget(wireframe, 1, 0); 54 51 55 Q ComboBox* resolution = new QComboBox();52 QtGuiComboBox* resolution = new QtGuiComboBox("SoundCard"); 56 53 layout->addWidget(resolution, 2, 0); 57 54 -
branches/qt_gui/src/lib/gui/qt_gui/qt_gui_elements.cc
r7531 r7539 16 16 //#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_ 17 17 18 #include "qt_gui.h" 18 #include "qt_gui_elements.h" 19 19 20 20 21 namespace OrxGui … … 23 24 24 25 26 QtGuiCheckBox::QtGuiCheckBox(const std::string& name, bool defaultValue) 27 : QCheckBox(QString().fromStdString(name)), Saveable(name) 28 { 29 //this->load(this->value()); 30 } 31 32 void QtGuiCheckBox::load(const MultiType& value) 33 { 34 this->setTristate(value.getBool()); 35 this->value() = value; 36 } 25 37 26 38 27 QtGuiComboBox::QtGuiComboBox(QWidget* parent, const std::string& name) 28 : QComboBox(parent), Saveable(name) 39 40 const MultiType& QtGuiCheckBox::save() 41 { 42 return this->value(); 43 } 44 45 QtGuiComboBox::QtGuiComboBox(const std::string& name) 46 : QComboBox(), Saveable(name) 29 47 { 30 48 … … 32 50 } 33 51 52 void QtGuiComboBox::load(const MultiType& value) 53 { 54 this->value() = value; 55 //TODO 56 } 57 58 const MultiType& QtGuiComboBox::save() 59 { 60 return this->value(); 61 } 34 62 35 63 -
branches/qt_gui/src/lib/gui/qt_gui/qt_gui_elements.h
r7531 r7539 7 7 #define __QT_GUI_ELEMENTS_H 8 8 9 #include "base_object.h"10 9 #include "../gui_saveable.h" 11 10 #include <list> 12 11 13 12 // grouping 14 #include < qgroupbox.h>15 #include < qprogressbar.h>16 #include < qlabel.h>13 #include <QtGui/QGroupBox> 14 #include <QtGui/QProgressBar> 15 #include <QtGui/QLabel> 17 16 18 17 // events 19 #include < qpushbutton.h>18 #include <QtGui/QPushButton> 20 19 21 20 // options 22 #include <qcheckbox.h> 23 #include <qslider.h> 24 #include <qlineedit.h> 21 #include <QtGui/QCheckBox> 22 #include <QtGui/QSlider> 23 #include <QtGui/QLineEdit> 24 #include <QtGui/QComboBox> 25 25 26 26 namespace OrxGui 27 27 { 28 29 class QtGuiWidget : virtual public BaseObject 30 { 31 public: 32 }; 33 34 35 class QtGuiContainer : public QtGuiWidget 36 { 37 public: 38 virtual bool pack(QtGuiWidget* widget) = 0; 39 40 protected: 41 QtGuiContainer(); 42 ~QtGuiContainer(); 43 44 private: 45 46 }; 47 48 49 typedef enum Orientation 50 { 51 horizontal, 52 vertical 53 }; 54 55 class QtGuiBox : public QtGuiContainer, public GuiSaveableGroup 56 { 57 58 public: 59 QtGuiBox(Orientation orientation); 60 ~QtGuiBox(); 61 62 virtual bool pack(QtGuiWidget* widget); 63 64 private: 65 std::list<QtGuiWidget*> children; 66 67 }; 68 69 class QtGuiGroupBox : public QtGuiContainer, public GuiSaveableGroup 70 { 71 public: 72 QtGuiGroupBox(const std::string& groupName); 73 ~QtGuiGroupBox(); 74 75 virtual bool pack(QtGuiWidget* widget); 76 77 private: 78 QtGuiWidget* child; 79 }; 80 81 82 83 class QtGuiCheckBox : public QCheckBox, public QtGuiWidget, public GuiSaveable 28 class QtGuiCheckBox : public QCheckBox, public Saveable 84 29 { 85 30 public: 86 31 QtGuiCheckBox(const std::string& name, bool defaultValue = false); 87 ~QtGuiCheckBox(); 32 virtual ~QtGuiCheckBox() {}; 33 34 virtual void load(const MultiType& value); 35 virtual const MultiType& save(); 88 36 89 37 public slots: … … 94 42 }; 95 43 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 44 class QtGuiSlider : public QSlider, public Saveable 105 45 { 106 46 public: 107 47 QtGuiSlider(); 108 ~QtGuiSlider();48 virtual ~QtGuiSlider() {}; 109 49 110 50 public slots: … … 118 58 class QtGuiComboBox : public QComboBox, public OrxGui::Saveable 119 59 { 120 QtGuiComboBox(QWidget* parent, const std::string& name);121 }60 public: 61 QtGuiComboBox(const std::string& name); 122 62 123 124 125 class QtGuiTextLine : public QLineEdit, public QtGuiWidget, public GuiSaveable 126 { 127 public: 128 QtGuiTextLine(); 129 ~QtGuiTextLine(); 130 131 public slots: 132 void setTextLineValue(const char*); 133 signals: 134 void textLineChanged(const char*); 63 virtual void load(const MultiType& value); 64 virtual const MultiType& save(); 135 65 }; 136 66 137 138 139 class QtGuiImage : public QtGuiWidget140 {141 }142 ;143 67 } 144 68
Note: See TracChangeset
for help on using the changeset viewer.