Salome HOME
References in object browser
[modules/gui.git] / src / Qtx / QtxDblSpinBox.h
1 // File:      QtxDblSpinBox.h
2 // Author:    Sergey TELKOV
3
4 #ifndef QTXDBLSPINBOX_H
5 #define QTXDBLSPINBOX_H
6
7 #include "Qtx.h"
8
9 #include <qspinbox.h>
10
11 class QTX_EXPORT QtxDblSpinBox : public QSpinBox
12 {
13   Q_OBJECT
14
15   class Validator;
16
17 public:
18         typedef enum QSpinBox::ButtonSymbols ButtonSymbols;
19
20 public:
21   QtxDblSpinBox( QWidget* = 0, const char* = 0 );
22   QtxDblSpinBox( double, double, double = 1, QWidget* = 0, const char* = 0 );
23   virtual ~QtxDblSpinBox();
24
25   double                   minValue() const;
26   double                   maxValue() const;
27   void               setMinValue( int );
28   void               setMaxValue( int );
29   void               setMinValue( double );
30   void               setMaxValue( double );
31   void               setRange( int, int );
32   void               setRange( double, double );
33
34   double                   lineStep() const;
35   void               setLineStep( int );
36   void               setLineStep( double );
37
38   double             value() const;
39
40   int                precision() const;
41   void               setPrecision( const int );
42   
43   bool               isCleared() const;
44   void               setCleared( const bool );
45   
46   virtual bool       eventFilter( QObject*, QEvent* );
47     
48 signals:
49   void               valueChanged( double );
50   void                     valueChanged( const QString& );
51     
52 public slots:
53   virtual void       stepUp();
54   virtual void       stepDown();
55   virtual void       selectAll();
56   virtual void       setValue( int );
57   virtual void       setValue( double );
58   
59 protected:
60   virtual void       updateDisplay();
61   virtual void       interpretText();
62   
63   virtual void       valueChange();
64   virtual void       rangeChange();
65   
66   QString            currentValueText();
67   virtual QString    mapValueToText( int );
68   virtual QString    mapValueToText( double );
69   virtual double     mapTextToDoubleValue( bool* );
70   
71   virtual void       leaveEvent( QEvent* );
72   virtual void       wheelEvent( QWheelEvent* );
73   
74   double             bound( double );
75   
76 private:
77   double             myMin;
78   double             myMax;
79   double             myStep;
80   double             myValue;
81   bool               myCleared;
82   bool               myBlocked;
83   int                myPrecision;
84 };
85
86 #endif