00001 // This file is part of ff3d - http://www.freefem.org/ff3d 00002 // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino 00003 00004 // This program is free software; you can redistribute it and/or modify 00005 // it under the terms of the GNU General Public License as published by 00006 // the Free Software Foundation; either version 2, or (at your option) 00007 // any later version. 00008 00009 // This program is distributed in the hope that it will be useful, 00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 // GNU General Public License for more details. 00013 00014 // You should have received a copy of the GNU General Public License 00015 // along with this program; if not, write to the Free Software Foundation, 00016 // Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00017 00018 // $Id: QRealSpinBox.hpp,v 1.2 2005/07/31 22:30:05 delpinux Exp $ 00019 00020 #ifndef Q_REAL_SPIN_BOX_HPP 00021 #define Q_REAL_SPIN_BOX_HPP 00022 00023 #include <QtGui/QSpinBox> 00024 #include <QtGui/QValidator> 00025 00026 #include <Types.hpp> 00027 00039 class QRealSpinBox 00040 : public QSpinBox 00041 { 00042 Q_OBJECT 00043 private: 00044 QDoubleValidator* __validator; 00045 int __decimals; 00046 00047 public: 00048 QRealSpinBox(QWidget* parent = 0); 00049 00050 QRealSpinBox(const real_t& minValue, 00051 const real_t& maxValue, 00052 const int& decimals = 2, 00053 const real_t& step = 1.0, 00054 QWidget* parent = 0); 00055 00056 ~QRealSpinBox(); 00057 00058 virtual QSize sizeHint () const; 00059 00060 real_t value() const; 00061 int percentage() const; 00062 00063 real_t minValue() const; 00064 real_t maxValue() const; 00065 00066 void setRange( real_t minValue, real_t maxValue ); 00067 00068 public slots: 00069 void setValue( real_t value ); 00070 void setPercentage( int value ); 00071 00072 signals: 00073 void valueChanged( real_t value ); 00074 00075 protected: 00076 virtual QString mapValueToText ( int value ); 00077 virtual int mapTextToValue ( bool * ok = 0 ); 00078 virtual void valueChange (); 00079 }; 00080 00081 #endif // Q_REAL_SPIN_BOX_HPP
1.5.6