PrefWidgets.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef GUI_PREFWIDGETS_H
00025 #define GUI_PREFWIDGETS_H
00026
00027 #include <QCheckBox>
00028 #include <QComboBox>
00029 #include <QRadioButton>
00030 #include <Base/Parameter.h>
00031 #include "Widgets.h"
00032 #include "Window.h"
00033 #include "SpinBox.h"
00034 #include "FileDialog.h"
00035
00036 namespace Gui {
00037 class CommandManager;
00038 class WidgetFactoryInst;
00039
00054 class GuiExport PrefWidget : public WindowParameter
00055 {
00056 public:
00057 virtual void setEntryName( const QByteArray& name );
00058 virtual QByteArray entryName() const;
00059
00060 virtual void setParamGrpPath( const QByteArray& path );
00061 virtual QByteArray paramGrpPath() const;
00062
00063 virtual void OnChange(Base::Subject<const char*> &rCaller, const char * sReason);
00064 void onSave();
00065 void onRestore();
00066
00067 protected:
00071 virtual void restorePreferences() = 0;
00075 virtual void savePreferences() = 0;
00076
00077 PrefWidget();
00078 virtual ~PrefWidget();
00079
00080 private:
00081 QByteArray m_sPrefName;
00082 QByteArray m_sPrefGrp;
00083
00084
00085 friend class Gui::WidgetFactoryInst;
00086 };
00087
00091 class GuiExport PrefSpinBox : public QSpinBox, public PrefWidget
00092 {
00093 Q_OBJECT
00094
00095 Q_PROPERTY( QByteArray prefEntry READ entryName WRITE setEntryName )
00096 Q_PROPERTY( QByteArray prefPath READ paramGrpPath WRITE setParamGrpPath )
00097
00098 public:
00099 PrefSpinBox ( QWidget * parent = 0 );
00100 virtual ~PrefSpinBox();
00101
00102
00103
00104 QByteArray entryName () const;
00105 QByteArray paramGrpPath () const;
00106
00107 void setEntryName ( const QByteArray& name );
00108 void setParamGrpPath ( const QByteArray& name );
00109
00110 protected:
00111
00112 void restorePreferences();
00113 void savePreferences();
00114 };
00115
00119 class GuiExport PrefDoubleSpinBox : public QDoubleSpinBox, public PrefWidget
00120 {
00121 Q_OBJECT
00122
00123 Q_PROPERTY( QByteArray prefEntry READ entryName WRITE setEntryName )
00124 Q_PROPERTY( QByteArray prefPath READ paramGrpPath WRITE setParamGrpPath )
00125
00126 public:
00127 PrefDoubleSpinBox ( QWidget * parent = 0 );
00128 virtual ~PrefDoubleSpinBox();
00129
00130
00131
00132 QByteArray entryName () const;
00133 QByteArray paramGrpPath () const;
00134
00135 void setEntryName ( const QByteArray& name );
00136 void setParamGrpPath ( const QByteArray& name );
00137
00138 protected:
00139
00140 void restorePreferences();
00141 void savePreferences();
00142 };
00143
00148 class GuiExport PrefLineEdit : public QLineEdit, public PrefWidget
00149 {
00150 Q_OBJECT
00151
00152 Q_PROPERTY( QByteArray prefEntry READ entryName WRITE setEntryName )
00153 Q_PROPERTY( QByteArray prefPath READ paramGrpPath WRITE setParamGrpPath )
00154
00155 public:
00156 PrefLineEdit ( QWidget * parent = 0 );
00157 virtual ~PrefLineEdit();
00158
00159
00160
00161 QByteArray entryName () const;
00162 QByteArray paramGrpPath () const;
00163
00164 void setEntryName ( const QByteArray& name );
00165 void setParamGrpPath ( const QByteArray& name );
00166
00167 protected:
00168
00169 void restorePreferences();
00170 void savePreferences();
00171 };
00172
00177 class GuiExport PrefFileChooser : public FileChooser, public PrefWidget
00178 {
00179 Q_OBJECT
00180
00181 Q_PROPERTY( QByteArray prefEntry READ entryName WRITE setEntryName )
00182 Q_PROPERTY( QByteArray prefPath READ paramGrpPath WRITE setParamGrpPath )
00183
00184 public:
00185 PrefFileChooser ( QWidget * parent = 0 );
00186 virtual ~PrefFileChooser();
00187
00188
00189
00190 QByteArray entryName () const;
00191 QByteArray paramGrpPath () const;
00192
00193 void setEntryName ( const QByteArray& name );
00194 void setParamGrpPath ( const QByteArray& name );
00195
00196 protected:
00197
00198 void restorePreferences();
00199 void savePreferences();
00200 };
00201
00206 class GuiExport PrefComboBox : public QComboBox, public PrefWidget
00207 {
00208 Q_OBJECT
00209
00210 Q_PROPERTY( QByteArray prefEntry READ entryName WRITE setEntryName )
00211 Q_PROPERTY( QByteArray prefPath READ paramGrpPath WRITE setParamGrpPath )
00212
00213 public:
00214 PrefComboBox ( QWidget * parent = 0 );
00215 virtual ~PrefComboBox();
00216
00217
00218
00219 QByteArray entryName () const;
00220 QByteArray paramGrpPath () const;
00221
00222 void setEntryName ( const QByteArray& name );
00223 void setParamGrpPath ( const QByteArray& name );
00224
00225 protected:
00226
00227 void restorePreferences();
00228 void savePreferences();
00229 };
00230
00235 class GuiExport PrefCheckBox : public QCheckBox, public PrefWidget
00236 {
00237 Q_OBJECT
00238
00239 Q_PROPERTY( QByteArray prefEntry READ entryName WRITE setEntryName )
00240 Q_PROPERTY( QByteArray prefPath READ paramGrpPath WRITE setParamGrpPath )
00241
00242 public:
00243 PrefCheckBox ( QWidget * parent = 0 );
00244 virtual ~PrefCheckBox();
00245
00246
00247
00248 QByteArray entryName () const;
00249 QByteArray paramGrpPath () const;
00250
00251 void setEntryName ( const QByteArray& name );
00252 void setParamGrpPath ( const QByteArray& name );
00253
00254 protected:
00255
00256 void restorePreferences();
00257 void savePreferences();
00258 };
00259
00264 class GuiExport PrefRadioButton : public QRadioButton, public PrefWidget
00265 {
00266 Q_OBJECT
00267
00268 Q_PROPERTY( QByteArray prefEntry READ entryName WRITE setEntryName )
00269 Q_PROPERTY( QByteArray prefPath READ paramGrpPath WRITE setParamGrpPath )
00270
00271 public:
00272 PrefRadioButton ( QWidget * parent = 0 );
00273 virtual ~PrefRadioButton();
00274
00275
00276
00277 QByteArray entryName () const;
00278 QByteArray paramGrpPath () const;
00279
00280 void setEntryName ( const QByteArray& name );
00281 void setParamGrpPath ( const QByteArray& name );
00282
00283 protected:
00284
00285 void restorePreferences();
00286 void savePreferences();
00287 };
00288
00293 class GuiExport PrefSlider : public QSlider, public PrefWidget
00294 {
00295 Q_OBJECT
00296
00297 Q_PROPERTY( QByteArray prefEntry READ entryName WRITE setEntryName )
00298 Q_PROPERTY( QByteArray prefPath READ paramGrpPath WRITE setParamGrpPath )
00299
00300 public:
00301 PrefSlider ( QWidget * parent = 0 );
00302 virtual ~PrefSlider();
00303
00304
00305
00306 QByteArray entryName () const;
00307 QByteArray paramGrpPath () const;
00308
00309 void setEntryName ( const QByteArray& name );
00310 void setParamGrpPath ( const QByteArray& name );
00311
00312 protected:
00313
00314 void restorePreferences();
00315 void savePreferences();
00316 };
00317
00322 class GuiExport PrefColorButton : public ColorButton, public PrefWidget
00323 {
00324 Q_OBJECT
00325
00326 Q_PROPERTY( QByteArray prefEntry READ entryName WRITE setEntryName )
00327 Q_PROPERTY( QByteArray prefPath READ paramGrpPath WRITE setParamGrpPath )
00328
00329 public:
00330 PrefColorButton ( QWidget * parent = 0 );
00331 virtual ~PrefColorButton();
00332
00333
00334
00335 QByteArray entryName () const;
00336 QByteArray paramGrpPath () const;
00337
00338 void setEntryName ( const QByteArray& name );
00339 void setParamGrpPath ( const QByteArray& name );
00340
00341 protected:
00342
00343 void restorePreferences();
00344 void savePreferences();
00345 };
00346
00347 }
00348
00349 #endif // GUI_PREFWIDGETS_H