Main Page | Namespace List | Class Hierarchy | Compound List | File List | Compound Members | File Members | Related Pages

superspinbox.h

Go to the documentation of this file.
00001 /****************************************************************************
00002 
00003  File:    superspinbox.h
00004  Created: by Aidan Lane, January  02, 2004
00005  Updated: by Aidan Lane, February 16, 2004
00006  
00007  This file is part of Glitch
00008  Copyright (C) 2003-2004  Monash University, Clayton Campus, Australia
00009  Created by Aidan Lane, under the supervision of Jon McCormack.
00010  
00011  This program was developed to aid the students studying the CSE3313
00012  Computer Graphics course at Monash University.
00013  
00014  This software may contain portions that are copyright (C) 1993,
00015  Silicon Graphics, Inc. All Rights Reserved.
00016  
00017  Glitch is free software; you can redistribute it and/or modify
00018  it under the terms of the GNU General Public License as published by
00019  the Free Software Foundation, version 2.
00020  
00021  Glitch is distributed in the hope that it will be useful,
00022  but WITHOUT ANY WARRANTY; without even the implied warranty of
00023  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00024  GNU General Public License for more details.
00025  
00026  You should have received a copy of the GNU General Public License
00027  along with this program; if not, write to the Free Software
00028  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00029 
00030 *****************************************************************************/
00031 
00032 #ifndef __SUPERSPINBOX_H__
00033 #define __SUPERSPINBOX_H__
00034 
00035 
00036 #include <qspinbox.h>
00037 #include <qvalidator.h>
00038 
00039 #define DEFAULT_VALUE      0.0
00040 #define DEFAULT_MIN_VALUE  0.0
00041 #define DEFAULT_MAX_VALUE  99.0
00042 #define DEFAULT_STEP_VALUE 1.0
00043 
00044 
00055 class SuperSpinBox : public QSpinBox
00056 {
00057     Q_OBJECT    // make QT's signal/slot system work
00058 
00059 public:
00060     SuperSpinBox( QWidget* parent = NULL, const char* name = NULL );
00061     SuperSpinBox( double minValue, double maxValue, double step = DEFAULT_STEP_VALUE,
00062                   QWidget* parent = NULL, const char* name = NULL );
00063 
00064     double value() const { return d_value; }
00065     double minValue() const { return d_minValue; }
00066     double maxValue() const { return d_maxValue; }
00067     double lineStep() const { return d_lineStep; }
00068 
00069     void setMinValue( double min );
00070     void setMaxValue( double max );
00071     void setLineStep( double step );
00072 
00073 public slots:
00074     virtual void setValue( double value );
00075     virtual void stepUp();
00076     virtual void stepDown();
00077 
00078 signals:
00079     void valueChanged( double value );
00080     void valueChanged( const QString& valueText );
00081 
00082 protected:
00083     double d_value;
00084     double d_minValue;
00085     double d_maxValue;
00086     double d_lineStep;
00087 
00088     virtual int mapTextToValue( bool* ok );
00089     virtual QString mapValueToText( int );
00090     virtual void valueChange();
00091     virtual void rangeChange();
00092 
00093 private:
00094     void sharedInit();
00095 
00096     QDoubleValidator* validator;
00097 };
00098 
00099 
00100 #endif  // __SUPERSPINBOX_H__

Generated on Fri Feb 27 12:01:39 2004 for Glitch by doxygen 1.3.2