- Main Page
- Related Pages
- Classes
- Files

- File List

# qwt_abstract_slider.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_ABSTRACT_SLIDER_H
    00011 #define QWT_ABSTRACT_SLIDER_H
    00012
    00013 #include <qwidget.h>
    00014 #include "qwt_global.h"
    00015 #include "qwt_double_range.h"
    00016
    00028 class QWT_EXPORT QwtAbstractSlider : public QWidget, public QwtDoubleRange
    00029 {
    00030     Q_OBJECT
    00031     Q_PROPERTY( bool readOnly READ isReadOnly WRITE setReadOnly )
    00032     Q_PROPERTY( bool valid READ isValid WRITE setValid )
    00033     Q_PROPERTY( double mass READ mass WRITE setMass )
    00034 #ifndef Q_MOC_RUN // Qt3 moc
    00035 #define QWT_PROPERTY Q_PROPERTY
    00036     Q_PROPERTY( Orientation orientation
    00037         READ orientation WRITE setOrientation )
    00038 #else // Qt4 moc
    00039 // MOC_SKIP_BEGIN
    00040     Q_PROPERTY( Qt::Orientation orientation
    00041         READ orientation WRITE setOrientation )
    00042 // MOC_SKIP_END
    00043 #endif
    00044
    00045 public:
    00050     enum ScrollMode
    00051     {
    00052         ScrNone,
    00053         ScrMouse,
    00054         ScrTimer,
    00055         ScrDirect,
    00056         ScrPage
    00057     };
    00058
    00059     explicit QwtAbstractSlider(Qt::Orientation, QWidget *parent = NULL);
    00060     virtual ~QwtAbstractSlider();
    00061
    00062     void setUpdateTime(int t);
    00063     void stopMoving();
    00064     void setTracking(bool enable);
    00065
    00066     virtual void setMass(double val);
    00067     virtual double mass() const;
    00068
    00069 #if QT_VERSION >= 0x040000
    00070     virtual void setOrientation(Qt::Orientation o);
    00071     Qt::Orientation orientation() const;
    00072 #else
    00073     virtual void setOrientation(Orientation o);
    00074     Orientation orientation() const;
    00075 #endif
    00076
    00077     bool isReadOnly() const;
    00078
    00079     /*
    00080         Wrappers for QwtDblRange::isValid/QwtDblRange::setValid made
    00081         to be available as Q_PROPERTY in the designer.
    00082     */
    00083
    00087     bool isValid() const { return QwtDoubleRange::isValid(); }
    00088
    00093     void setValid(bool valid) { QwtDoubleRange::setValid(valid); }
    00094
    00095 public slots:
    00096     virtual void setValue(double val);
    00097     virtual void fitValue(double val);
    00098     virtual void incValue(int steps);
    00099
    00100     virtual void setReadOnly(bool);
    00101
    00102 signals:
    00103
    00112     void valueChanged(double value);
    00113
    00118     void sliderPressed();
    00119
    00125     void sliderReleased();
    00131     void sliderMoved(double value);
    00132
    00133 protected:
    00134     virtual void setPosition(const QPoint &);
    00135     virtual void valueChange();
    00136
    00137     virtual void timerEvent(QTimerEvent *e);
    00138     virtual void mousePressEvent(QMouseEvent *e);
    00139     virtual void mouseReleaseEvent(QMouseEvent *e);
    00140     virtual void mouseMoveEvent(QMouseEvent *e);
    00141     virtual void keyPressEvent(QKeyEvent *e);
    00142     virtual void wheelEvent(QWheelEvent *e);
    00143
    00152     virtual double getValue(const QPoint & p) = 0;
    00178     virtual void getScrollMode( const QPoint &p,
    00179                   int &scrollMode, int &direction) = 0;
    00180
    00181     void setMouseOffset(double);
    00182     double mouseOffset() const;
    00183
    00184     int scrollMode() const;
    00185
    00186 private:
    00187     void buttonReleased();
    00188
    00189     class PrivateData;
    00190     PrivateData *d_data;
    00191 };
    00192
    00193 #endif