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

qwt_counter.h

Go to the documentation of this file.
00001 /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
00002  * Qwt Widget Library
00003  * Copyright (C) 1997   Josef Wilgen
00004  * Copyright (C) 2002   Uwe Rathmann
00005  * 
00006  * This library is free software; you can redistribute it and/or
00007  * modify it under the terms of the Qwt License, Version 1.0
00008  *****************************************************************************/
00009 
00010 #ifndef QWT_COUNTER_H
00011 #define QWT_COUNTER_H
00012 
00013 #include <qwidget.h>
00014 #include "qwt_global.h"
00015 #include "qwt_drange.h"
00016 
00017 class QwtArrowButton;
00018 class QLineEdit;
00019 
00054 class QWT_EXPORT QwtCounter : public QWidget, public QwtDblRange
00055 {
00056     Q_OBJECT
00057 
00058     Q_PROPERTY( int numButtons READ numButtons WRITE setNumButtons )
00059     Q_PROPERTY( double basicstep READ step WRITE setStep )
00060     Q_PROPERTY( double minValue READ minVal WRITE setMinValue )
00061     Q_PROPERTY( double maxValue READ maxVal WRITE setMaxValue )
00062     Q_PROPERTY( int stepButton1 READ stepButton1 WRITE setStepButton1 )
00063     Q_PROPERTY( int stepButton2 READ stepButton2 WRITE setStepButton2 )
00064     Q_PROPERTY( int stepButton3 READ stepButton3 WRITE setStepButton3 )
00065     Q_PROPERTY( double value READ value WRITE setValue )
00066 
00067 public:
00072     enum Button { Button1, Button2, Button3, ButtonCnt };
00073 
00074     QwtCounter(QWidget *parent = 0, const char *name = 0);
00075 
00076     double step() const {return QwtDblRange::step();}
00077     void setStep(double s) {QwtDblRange::setStep(s);}
00078     double minVal() const {return minValue();}
00079     void setMinValue(double m) { setRange(m, maxValue(), step());}
00080     double maxVal() const {return QwtDblRange::maxValue();}
00081     void setMaxValue(double m) {setRange(minValue(), m, step());}
00082     void setStepButton1(int nSteps) {setIncSteps(Button1, nSteps);}
00083     int stepButton1() const {return incSteps(Button1);}
00084     void setStepButton2(int nSteps) {setIncSteps(Button2, nSteps);}
00085     int stepButton2() const {return incSteps(Button2);}
00086     void setStepButton3(int nSteps) {setIncSteps(Button3, nSteps);}
00087     int stepButton3() const {return incSteps(Button3);}
00088     virtual double value() const { return QwtDblRange::value();}
00089  
00090     void setNumButtons(int n);
00091     int numButtons() const;
00092     
00093     void setIncSteps(QwtCounter::Button btn, int nSteps);
00094     int incSteps(QwtCounter::Button btn) const;
00095 
00096     virtual void setValue(double);
00097     virtual QSizePolicy sizePolicy() const;
00098     virtual QSize sizeHint() const;
00099 
00100 signals:
00105     void buttonReleased (double value);  
00106 
00111     void valueChanged (double value);
00112 
00113 protected:
00114     virtual void fontChange(const QFont &f);
00115 
00116 private slots:
00117     void btnReleased();
00118     void btnClicked();
00119 
00120 private:
00121     void updateButtons();
00122     void showNum(double);
00123     virtual void valueChange();
00124 
00125     QwtArrowButton *d_buttonDown[ButtonCnt];
00126     QwtArrowButton *d_buttonUp[ButtonCnt];
00127     QLineEdit *d_valueEdit;
00128 
00129     int d_increment[ButtonCnt];
00130     int d_nButtons;
00131 };
00132 
00133 #endif

Generated on Fri Nov 7 14:11:45 2003 for Qwt Developer's Guide by doxygen 1.3.2