1 // File : QAD_SpinBoxDbl.h
2 // Created : UI team, 21.11.02
3 // Descr : Spin box for double values
5 // Modified : Fri Nov 22 09:30:11 2002
6 // Author : Vadim SANDLER
9 // Copyright : Open CASCADE 2002
12 #ifndef QAD_SPINBOXDBL_H
13 #define QAD_SPINBOXDBL_H
18 class QAD_EXPORT QDblRangeControl
22 QDblRangeControl( double minValue, double maxValue,
23 double lineStep, double pageStep,
26 double dblPrecision = 10e-6,
28 virtual ~QDblRangeControl();
30 void setValue( double );
36 double minValue() const;
37 double maxValue() const;
38 void setRange( double minValue, double maxValue );
39 void setMinValue( double minVal );
40 void setMaxValue( double minVal );
42 double lineStep() const;
43 double pageStep() const;
44 void setSteps( double line, double page );
46 int precision() const;
47 void setPrecision( int precision );
48 double dblPrecision() const;
49 void setDblPrecision( double dblPrecision );
50 char convertFlag() const;
51 void setConvertFlag( char cFlag );
53 double bound( double ) const;
56 void directSetValue( double val );
57 double prevValue() const;
59 virtual void valueChange();
60 virtual void rangeChange();
61 virtual void stepChange();
62 bool equal( double first, double second ) const;
63 double roundPrecision( double value) const;
66 double minVal, maxVal;
73 private: // Disabled copy constructor and operator=
74 #if defined(Q_DISABLE_COPY)
75 QDblRangeControl( const QDblRangeControl & );
76 QDblRangeControl &operator=( const QDblRangeControl & );
84 class QAD_EXPORT QAD_SpinBoxDbl: public QFrame, public QDblRangeControl
89 QAD_SpinBoxDbl( QWidget* parent, const char* name = 0 );
90 QAD_SpinBoxDbl( QWidget* parent,
95 double dblPrecision = 10e-6,
97 const char* name = 0 );
100 QString text() const;
102 virtual QString prefix() const;
103 virtual QString suffix() const;
104 virtual QString cleanText() const;
106 virtual void setSpecialValueText( const QString &text );
107 QString specialValueText() const;
109 virtual void setWrapping( bool on );
110 bool wrapping() const;
112 enum ButtonSymbols { UpDownArrows, PlusMinus };
113 void setButtonSymbols( ButtonSymbols );
114 ButtonSymbols buttonSymbols() const;
116 virtual void setValidator( const QValidator* v );
117 const QValidator* validator() const;
119 QSize sizeHint() const;
123 void setMinValue( double );
124 void setMaxValue( double );
126 void setLineStep( double );
130 virtual void setValue( double );
131 virtual void setPrefix( const QString &text );
132 virtual void setSuffix( const QString &text );
133 virtual void stepUp();
134 virtual void stepDown();
135 virtual void setEnabled( bool );
136 virtual void selectAll();
139 void valueChanged( double value );
140 void valueChanged( const QString &valueText );
143 virtual QString mapValueToText( double value );
144 virtual double mapTextToValue( bool* ok );
145 QString currentValueText();
147 virtual void updateDisplay();
148 virtual void interpretText();
150 QPushButton* upButton() const;
151 QPushButton* downButton() const;
152 QLineEdit* editor() const;
154 virtual void valueChange();
155 virtual void rangeChange();
157 bool eventFilter( QObject* obj, QEvent* ev );
158 void resizeEvent( QResizeEvent* ev );
159 void wheelEvent( QWheelEvent * );
160 void leaveEvent( QEvent* );
162 void styleChange( QStyle& );
170 ButtonSymbols butSymbols;
174 QValidator* validate;
182 void arrangeWidgets();
183 void updateButtonSymbols();
185 private: // Disabled copy constructor and operator=
186 #if defined(Q_DISABLE_COPY)
187 QAD_SpinBoxDbl( const QAD_SpinBoxDbl& );
188 QAD_SpinBoxDbl& operator=( const QAD_SpinBoxDbl& );