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

# qwt_sldbase.h

    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_SLDBASE_H
    00011 #define QWT_SLDBASE_H
    00012
    00013 #include <qframe.h>
    00014 #include <qpixmap.h>
    00015 #include <qdatetime.h>
    00016 #include "qwt_global.h"
    00017 #include "qwt_drange.h"
    00018
    00030 class QWT_EXPORT QwtSliderBase : public QWidget, public QwtDblRange
    00031 {
    00032     Q_OBJECT
    00033     Q_PROPERTY( bool readOnly READ isReadOnly WRITE setReadOnly )
    00034     Q_PROPERTY( bool valid READ isValid WRITE setValid )
    00035     Q_PROPERTY( double mass READ mass WRITE setMass )
    00036     Q_PROPERTY( Orientation orientation READ orientation WRITE setOrientation )
    00037
    00038 public:
    00039     enum ScrollMode { ScrNone, ScrMouse,
    00040         ScrTimer, ScrDirect, ScrPage };
    00041
    00042     QwtSliderBase(Qt::Orientation orientation, QWidget *parent = 0,
    00043         const char *name = 0, Qt::WFlags flags = 0 );
    00044     virtual ~QwtSliderBase();
    00045
    00046     void setUpdateTime(int t);
    00047     void stopMoving();
    00048     void setTracking(bool enable);
    00049
    00050     virtual void setMass(double val);
    00051     virtual double mass() const;
    00052
    00053     virtual void setOrientation(Orientation o);
    00054     Orientation orientation() const;
    00055
    00056     bool isReadOnly() const;
    00057
    00058     /*
    00059         Wrappers for QwtDblRange::isValid/QwtDblRange::setValid made
    00060         to be available as Q_PROPERTY in the designer.
    00061     */
    00062
    00066     bool isValid() const { return QwtDblRange::isValid(); }
    00067
    00071     void setValid(bool valid) { QwtDblRange::setValid(valid); }
    00072
    00073 public slots:
    00074     virtual void setValue(double val);
    00075     virtual void fitValue(double val);
    00076     virtual void incValue(int steps);
    00077
    00078     virtual void setReadOnly(bool);
    00079
    00080 signals:
    00081
    00090     void valueChanged(double value);
    00091
    00096     void sliderPressed();
    00097
    00103     void sliderReleased();
    00109     void sliderMoved(double value);
    00110
    00111 protected:
    00112     void setPosition(const QPoint &p);
    00113     virtual void valueChange();
    00114
    00115     virtual void timerEvent(QTimerEvent *e);
    00116     virtual void mousePressEvent(QMouseEvent *e);
    00117     virtual void mouseReleaseEvent(QMouseEvent *e);
    00118     virtual void mouseMoveEvent(QMouseEvent *e);
    00119     virtual void keyPressEvent(QKeyEvent *e);
    00120     virtual void wheelEvent(QWheelEvent *e);
    00121
    00130     virtual double getValue(const QPoint & p) = 0;
    00156     virtual void getScrollMode( const QPoint &p,
    00157                   int &scrollMode, int &direction) = 0;
    00158
    00159     int d_scrollMode;
    00160     double d_mouseOffset;
    00161     int d_direction;
    00162     int d_tracking;
    00163
    00164 private:
    00165     void buttonReleased();
    00166
    00167     int d_tmrID;
    00168     int d_updTime;
    00169     int d_timerTick;
    00170     QTime d_time;
    00171     double d_speed;
    00172     double d_mass;
    00173     Qt::Orientation d_orientation;
    00174     bool d_readOnly;
    00175 };
    00176
    00177 #endif