Salome HOME
Update from BR_V5_DEV 13Feb2009
[modules/gui.git] / src / Qtx / QtxDoubleSpinBox.h
1 //  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 //  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 //  This library is free software; you can redistribute it and/or
7 //  modify it under the terms of the GNU Lesser General Public
8 //  License as published by the Free Software Foundation; either
9 //  version 2.1 of the License.
10 //
11 //  This library is distributed in the hope that it will be useful,
12 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
13 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 //  Lesser General Public License for more details.
15 //
16 //  You should have received a copy of the GNU Lesser General Public
17 //  License along with this library; if not, write to the Free Software
18 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 //
20 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 // File:      QtxDoubleSpinBox.h
23 // Author:    Sergey TELKOV
24 //
25 #ifndef QTXDOUBLESPINBOX_H
26 #define QTXDOUBLESPINBOX_H
27
28 #include "Qtx.h"
29
30 #include <QDoubleSpinBox>
31 #include <QValidator>
32
33 class QTX_EXPORT QtxDoubleSpinBox : public QDoubleSpinBox
34 {
35   Q_OBJECT
36
37 public:
38   QtxDoubleSpinBox( QWidget* = 0 );
39   QtxDoubleSpinBox( double, double, double = 1, QWidget* = 0 );
40   QtxDoubleSpinBox( double, double, double, int, int, QWidget* = 0 );
41   virtual ~QtxDoubleSpinBox();
42
43   bool            isCleared() const;
44   virtual void    setCleared( const bool );
45
46   int             getPrecision() const ;
47   void            setPrecision( const int );
48
49   virtual void    stepBy( int );
50
51   virtual double  valueFromText( const QString& ) const;
52   virtual QString textFromValue( double ) const;
53
54   virtual QValidator::State validate( QString&, int& ) const;
55
56 private slots:
57   virtual void    onTextChanged( const QString& );
58
59 protected:
60   QString         removeTrailingZeroes( const QString& ) const;
61
62 private:
63   bool            myCleared;
64   int             myPrecision;
65 };
66
67 #endif