Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7447 in orxonox.OLD for branches/qt_gui/src/lib/gui


Ignore:
Timestamp:
Apr 29, 2006, 7:49:19 PM (19 years ago)
Author:
bensch
Message:

qt_gui: some more stuff

Location:
branches/qt_gui/src/lib/gui/qt_gui
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/qt_gui/src/lib/gui/qt_gui/gui_saveable.cc

    r7442 r7447  
    1818#include "gui_saveable.h"
    1919
    20 using namespace std;
     20namespace OrxGui
     21{
     22
     23  /**
     24   * standard constructor
     25  */
     26  GuiSaveable::GuiSaveable (const std::string& optionName)
     27  {
     28    this->bSaveable = false;
     29  }
    2130
    2231
    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  }
    3139
    3240
    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  }
    4046
    4147
    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  }
    4653
    4754
    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  }
    5071
    5172
  • branches/qt_gui/src/lib/gui/qt_gui/gui_saveable.h

    r7442 r7447  
    99#include "base_object.h"
    1010#include "multi_type.h"
    11 #include <list>
     11#include <vector>
    1212
    1313// FORWARD DECLARATION
    1414
     15namespace OrxGui
     16{
     17  //! A class for ...
     18  class GuiSaveable
     19  {
     20  public:
     21  protected:
     22    GuiSaveable(const std::string& optionName);
     23    virtual ~GuiSaveable();
    1524
    16 //! A class for ...
    17 class GuiSaveable : virtual public BaseObject
    18 {
     25    void makeSaveable();
    1926
    20 public:
     27    virtual void load(const MultiType& value) = 0;
     28    virtual const MultiType& save() = 0;
    2129
     30    MultiType&       getValue() { return this->value; };
     31    const MultiType& getValue() const { return this->value; };
     32    bool             isSaveable() const { return this->bSaveable; };
    2233
    23 protected:
    24   GuiSaveable();
    25   virtual ~GuiSaveable();
     34  protected:
     35    virtual void makingElementSaveable() {};
    2636
    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  };
    3341
    3442
    3543
    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();
    4149
    42   void addSaveable(GuiSaveable* saveable);
     50    void addSaveable(GuiSaveable* saveable);
     51    void removeSaveable(GuiSaveable* saveable);
    4352
    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  };
    4759
     60}
    4861
    4962#endif /* _GUI_SAVEABLE_H */
  • branches/qt_gui/src/lib/gui/qt_gui/qt_gui.cc

    r7442 r7447  
    1818#include "qt_gui.h"
    1919
    20 using namespace std;
     20namespace OrxGui
     21{
    2122
     23
     24
     25}
  • branches/qt_gui/src/lib/gui/qt_gui/qt_gui.h

    r7442 r7447  
    2424#include <qlineedit.h>
    2525
     26namespace OrxGui
     27{
    2628
    27 class QtGuiWidget : virtual public BaseObject
    28 {
    29 public:
    30 };
     29  class QtGuiWidget : virtual public BaseObject
     30  {
     31  public:
     32  };
    3133
    3234
    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;
    3739
    38 protected:
    39   QtGuiContainer();
    40   ~QtGuiContainer();
     40  protected:
     41    QtGuiContainer();
     42    ~QtGuiContainer();
    4143
    42 private:
     44  private:
    4345
    44 };
     46  };
    4547
    4648
    47 class QtGuiBox : public QtGuiContainer
    48 {
    49 public:
    5049  typedef enum Orientation
    5150  {
     
    5453  };
    5554
    56 public:
    57   QtGuiBox(Orientation orientation);
    58   ~QtGuiBox();
     55  class QtGuiBox : public QtGuiContainer, public GuiSaveableGroup
     56  {
    5957
    60   virtual bool pack(QtGuiWidget* widget);
     58  public:
     59    QtGuiBox(Orientation orientation);
     60    ~QtGuiBox();
    6161
    62 private:
    63   std::list<QtGuiWidget*>   children;
     62    virtual bool pack(QtGuiWidget* widget);
    6463
    65 };
     64  private:
     65    std::list<QtGuiWidget*>   children;
    6666
    67 class QtGuiGroupBox : public QtGuiContainer, public GuiGroup
    68 {
    69 public:
    70   QtGuiGroupBox(const char* groupName);
    71   ~QtGuiGroupBox();
     67  };
    7268
    73   virtual bool pack(QtGuiWidget* widget);
     69  class QtGuiGroupBox : public QtGuiContainer, public GuiSaveableGroup
     70  {
     71  public:
     72    QtGuiGroupBox(const std::string& groupName);
     73    ~QtGuiGroupBox();
    7474
    75 private:
    76   QtGuiWidget*              child;
    77 };
     75    virtual bool pack(QtGuiWidget* widget);
     76
     77  private:
     78    QtGuiWidget*              child;
     79  };
    7880
    7981
    80 class QtGuiCheckBox : public QCheckBox, public QtGuiWidget, public GuiSaveable
    81 {
    82 public:
    83   QtGuiCheckBox(const char* name, bool defaultValue = false);
    84   ~QtGuiCheckBox();
    8582
    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();
    8888
    89 signals:
    90   void checkValueChanged();
    91 };
     89  public slots:
     90    void setCheckValue(int);
    9291
    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  };
    12595
    12696
     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
    127137#endif /* __QT_GUI_H */
Note: See TracChangeset for help on using the changeset viewer.