00001 #ifndef IGUANA_GL_BROWSERS_IG_QT_RANGE_CONTROL_COMMON_H
00002 # define IGUANA_GL_BROWSERS_IG_QT_RANGE_CONTROL_COMMON_H
00003
00004
00005
00006 # include "Iguana/GLBrowsers/interface/IgControlItem.h"
00007
00008
00009
00010
00011
00012 class QFrame;
00013 class QWidget;
00014 class IgQtPixButton;
00015 class IgQtLineEdit;
00016 class QSlider;
00017 class QPopupMenu;
00018 class QVBoxLayout;
00019
00020
00021
00022
00023
00024 class IGUANA_GL_BROWSERS_API IgQtRangeControlCommon : public IgControlItem
00025 {
00026 Q_OBJECT
00027 public:
00028 enum StepType {
00029 ADD,
00030 MULTIPLE
00031 };
00032
00033 enum Parts {
00035 StepperPart = 1,
00036 ValuePart = 2,
00037 SliderPart = 4,
00038 IndexPart = 8,
00039 AllParts = (StepperPart
00040 | ValuePart
00041 | SliderPart
00042 | IndexPart)
00043 };
00044
00045 IgQtRangeControlCommon (QWidget *parent, int parts,
00046 const char *name = 0);
00047
00048
00049
00050
00051
00052 StepType getStepType (void) const;
00053
00054 QWidget * widget (void) const;
00055 void addFwdButton (QWidget *w);
00056 void addRevButton (QWidget *w);
00057 void addFwdWidget (QWidget *w);
00058 void addRevWidget (QWidget *w);
00059 void insertWidget (QWidget *w, int index = -1);
00060
00061 bool isValueEditable (void) const;
00062 bool isRangeEditable (void) const;
00063 bool isStepEditable (void) const;
00064 bool isPrecisionEditable (void) const;
00065
00066 void valueEditable (bool editable = true);
00067 void rangeEditable (bool editable = true);
00068 void stepEditable (bool editable = true);
00069 void precisionEditable (bool editable = true);
00070 bool isEmitSettingsChanged (void) const;
00071
00072 void updateEditSettingConnection (const QObject * receiver,
00073 const char * member);
00074 QPopupMenu* popupMenu (void) const;
00075
00076 static QString getSettingItem (QString &setting);
00077 static void addSettingItem (const QString &item, QString &setting);
00078
00079 using IgControlItem::setDirty;
00080 public slots:
00081 void setStepType (StepType type);
00082
00083 virtual void revMin (void);
00084 virtual void revLong (void);
00085 virtual void revSmall (void);
00086 virtual void fwdSmall (void);
00087 virtual void fwdLong (void);
00088 virtual void fwdMax (void);
00089
00090 virtual void setDirty (bool dirty);
00091
00092 virtual void resetChangedValue (bool);
00093
00094 virtual void show (void);
00095 virtual void hide (void);
00096 virtual void editSettings (void);
00097 virtual void editSettingsChanged (void);
00098 virtual void setEmitSettingsChanged (bool value=true);
00099
00100 signals:
00101 void settingsChanged (void);
00102
00103 protected slots:
00104
00105 virtual void sliderChanged (int newval);
00106 virtual void textChanged (const QString &newval);
00107
00108 protected:
00109 enum MoveDirection { MoveFWD, MoveREV };
00110
00111 virtual void emitSignals (void);
00112 virtual void fwdEnable (bool enable);
00113 virtual void revEnable (bool enable);
00114
00115 virtual void initialize (int parts);
00116
00117 StepType m_stepType;
00118 bool m_fwdEnabled;
00119 bool m_revEnabled;
00120
00121 QFrame *m_widget;
00122 QVBoxLayout *m_layout;
00123 QWidget *m_row;
00124 IgQtPixButton *m_revMin;
00125 IgQtPixButton *m_revLong;
00126 IgQtPixButton *m_revSmall;
00127 IgQtLineEdit *m_text;
00128 IgQtPixButton *m_fwdSmall;
00129 IgQtPixButton *m_fwdLong;
00130 IgQtPixButton *m_fwdMax;
00131 QSlider *m_slider;
00132 bool m_resetChangedValue;
00133 QPopupMenu *m_editSettingMenu;
00134 int m_editSettingMenuIndex;
00135 bool m_valueEditable;
00136 bool m_stepEditable;
00137 bool m_rangeEditable;
00138 bool m_precisionEditable;
00139 bool m_emitSettingsChanged;
00140 };
00141
00142
00143
00144
00145 #endif // IGUANA_GL_BROWSERS_IG_QT_RANGE_CONTROL_COMMON_H