kdeui Library API Documentation

knumvalidator.h

00001 /**********************************************************************
00002 **
00003 ** $Id: knumvalidator.h,v 1.11.2.1 2002/12/29 15:50:19 buis Exp $
00004 **
00005 ** Copyright (C) 1999 Glen Parker <glenebob@nwlink.com>
00006 ** Copyright (C) 2002 Marc Mutz <mutz@kde.org>
00007 **
00008 ** This library is free software; you can redistribute it and/or
00009 ** modify it under the terms of the GNU Library General Public
00010 ** License as published by the Free Software Foundation; either
00011 ** version 2 of the License, or (at your option) any later version.
00012 **
00013 ** This library is distributed in the hope that it will be useful,
00014 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00015 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00016 ** Library General Public License for more details.
00017 **
00018 ** You should have received a copy of the GNU Library General Public
00019 ** License along with this library; if not, write to the Free
00020 ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00021 **
00022 *****************************************************************************/
00023 
00024 #ifndef __KNUMVALIDATOR_H
00025 #define __KNUMVALIDATOR_H
00026 
00027 #include <qvalidator.h>
00028 
00029 class QWidget;
00030 class QString;
00031 
00042 class KIntValidator : public QValidator {
00043 
00044   public:
00048     KIntValidator ( QWidget * parent, int base = 10, const char * name = 0 );
00052     KIntValidator ( int bottom, int top, QWidget * parent, int base = 10, const char * name = 0 );
00056     virtual ~KIntValidator ();
00060     virtual State validate ( QString &, int & ) const;
00064     virtual void fixup ( QString & ) const;
00068     virtual void setRange ( int bottom, int top );
00072     virtual void setBase ( int base );
00076     virtual int bottom () const;
00080     virtual int top () const;
00084     virtual int base () const;
00085 
00086   private:
00087     int _base;
00088     int _min;
00089     int _max;
00090 
00091 };
00092 
00093 class KFloatValidatorPrivate;
00094 
00106 class KFloatValidator : public QValidator {
00107 
00108   public:
00112     KFloatValidator ( QWidget * parent, const char * name = 0 );
00116     KFloatValidator ( double bottom, double top, QWidget * parent, const char * name = 0 );
00120     KFloatValidator ( double bottom, double top, bool localeAware, QWidget * parent, const char * name = 0 );
00124     virtual ~KFloatValidator ();
00128     virtual State validate ( QString &, int & ) const;
00132     virtual void fixup ( QString & ) const;
00136     virtual void setRange ( double bottom, double top );
00140     virtual double bottom () const;
00144     virtual double top () const;
00150     void setAcceptLocalizedNumbers(bool b);
00155     bool acceptLocalizedNumbers() const;
00156 
00157  private:
00158     double _min;
00159     double _max;
00160 
00161     KFloatValidatorPrivate *d;
00162 };
00163 
00178 class KDoubleValidator : public QDoubleValidator {
00179   Q_OBJECT
00180   Q_PROPERTY( bool acceptLocalizedNumbers READ acceptLocalizedNumbers WRITE setAcceptLocalizedNumbers )
00181 public:
00185   KDoubleValidator( QObject * parent, const char * name=0 );
00189   KDoubleValidator( double bottom, double top, int decimals,
00190             QObject * parent, const char * name=0 );
00193   virtual ~KDoubleValidator();
00194 
00196   virtual QValidator::State validate( QString & input, int & pos ) const;
00197 
00199   bool acceptLocalizedNumbers() const;
00201   void setAcceptLocalizedNumbers( bool accept );
00202 
00203 private:
00204   typedef QDoubleValidator base;
00205   class Private;
00206   Private * d;
00207 };
00208 
00209 #endif
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.0.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Oct 8 12:21:00 2003 by doxygen 1.2.18 written by Dimitri van Heesch, © 1997-2001