Qwt User's Guide 5.2.2

- Main Page
- Related Pages
- Classes
- Files

- File List

# qwt_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 // vim: expandtab
    00011
    00012 #ifndef QWT_SLIDER_H
    00013 #define QWT_SLIDER_H
    00014
    00015 #include "qwt_global.h"
    00016 #include "qwt_abstract_scale.h"
    00017 #include "qwt_abstract_slider.h"
    00018
    00019 class QwtScaleDraw;
    00020
    00034 class QWT_EXPORT QwtSlider : public QwtAbstractSlider, public QwtAbstractScale
    00035 {
    00036     Q_OBJECT
    00037     Q_ENUMS( ScalePos )
    00038     Q_ENUMS( BGSTYLE )
    00039     Q_PROPERTY( ScalePos scalePosition READ scalePosition
    00040         WRITE setScalePosition )
    00041     Q_PROPERTY( BGSTYLE bgStyle READ bgStyle WRITE setBgStyle )
    00042     Q_PROPERTY( int thumbLength READ thumbLength WRITE setThumbLength )
    00043     Q_PROPERTY( int thumbWidth READ thumbWidth WRITE setThumbWidth )
    00044     Q_PROPERTY( int borderWidth READ borderWidth WRITE setBorderWidth )
    00045
    00046 public:
    00047
    00056     enum ScalePos
    00057     {
    00058         NoScale,
    00059
    00060         LeftScale,
    00061         RightScale,
    00062         TopScale,
    00063         BottomScale
    00064     };
    00065
    00070     enum BGSTYLE
    00071     {
    00072         BgTrough = 0x1,
    00073         BgSlot = 0x2,
    00074         BgBoth = BgTrough | BgSlot
    00075     };
    00076
    00077     explicit QwtSlider(QWidget *parent,
    00078           Qt::Orientation = Qt::Horizontal,
    00079           ScalePos = NoScale, BGSTYLE bgStyle = BgTrough);
    00080 #if QT_VERSION < 0x040000
    00081     explicit QwtSlider(QWidget *parent, const char *name);
    00082 #endif
    00083
    00084     virtual ~QwtSlider();
    00085
    00086     virtual void setOrientation(Qt::Orientation);
    00087
    00088     void setBgStyle(BGSTYLE);
    00089     BGSTYLE bgStyle() const;
    00090
    00091     void setScalePosition(ScalePos s);
    00092     ScalePos scalePosition() const;
    00093
    00094     int thumbLength() const;
    00095     int thumbWidth() const;
    00096     int borderWidth() const;
    00097
    00098     void setThumbLength(int l);
    00099     void setThumbWidth(int w);
    00100     void setBorderWidth(int bw);
    00101     void setMargins(int x, int y);
    00102
    00103     virtual QSize sizeHint() const;
    00104     virtual QSize minimumSizeHint() const;
    00105
    00106     void setScaleDraw(QwtScaleDraw *);
    00107     const QwtScaleDraw *scaleDraw() const;
    00108
    00109 protected:
    00110     virtual double getValue(const QPoint &p);
    00111     virtual void getScrollMode(const QPoint &p,
    00112         int &scrollMode, int &direction);
    00113
    00114     void draw(QPainter *p, const QRect& update_rect);
    00115     virtual void drawSlider (QPainter *p, const QRect &r);
    00116     virtual void drawThumb(QPainter *p, const QRect &, int pos);
    00117
    00118     virtual void resizeEvent(QResizeEvent *e);
    00119     virtual void paintEvent (QPaintEvent *e);
    00120
    00121     virtual void valueChange();
    00122     virtual void rangeChange();
    00123     virtual void scaleChange();
    00124     virtual void fontChange(const QFont &oldFont);
    00125
    00126     void layoutSlider( bool update = true );
    00127     int xyPosition(double v) const;
    00128
    00129     QwtScaleDraw *scaleDraw();
    00130
    00131 private:
    00132     void initSlider(Qt::Orientation, ScalePos scalePos, BGSTYLE bgStyle);
    00133
    00134     class PrivateData;
    00135     PrivateData *d_data;
    00136 };
    00137
    00138 #endif