Qwt User's Guide: qwt_slider.h Source File

Qwt User's Guide 6.0.1

- 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 #ifndef QWT_SLIDER_H
    00011 #define QWT_SLIDER_H
    00012
    00013 #include "qwt_global.h"
    00014 #include "qwt_abstract_scale.h"
    00015 #include "qwt_abstract_slider.h"
    00016
    00017 class QwtScaleDraw;
    00018
    00032 class QWT_EXPORT QwtSlider : public QwtAbstractSlider, public QwtAbstractScale
    00033 {
    00034     Q_OBJECT
    00035     Q_ENUMS( ScalePos )
    00036     Q_ENUMS( BackgroundStyle )
    00037     Q_PROPERTY( ScalePos scalePosition READ scalePosition
    00038         WRITE setScalePosition )
    00039     Q_PROPERTY( BackgroundStyles backgroundStyle
    00040         READ backgroundStyle WRITE setBackgroundStyle )
    00041     Q_PROPERTY( QSize handleSize READ handleSize WRITE setHandleSize )
    00042     Q_PROPERTY( int borderWidth READ borderWidth WRITE setBorderWidth )
    00043     Q_PROPERTY( int spacing READ spacing WRITE setSpacing )
    00044
    00045 public:
    00046
    00056     enum ScalePos
    00057     {
    00059         NoScale,
    00060
    00062         LeftScale,
    00063
    00065         RightScale,
    00066
    00068         TopScale,
    00069
    00071         BottomScale
    00072     };
    00073
    00078     enum BackgroundStyle
    00079     {
    00081         Trough = 0x01,
    00082
    00084         Groove = 0x02,
    00085     };
    00086
    00088     typedef QFlags<BackgroundStyle> BackgroundStyles;
    00089
    00090     explicit QwtSlider( QWidget *parent,
    00091         Qt::Orientation = Qt::Horizontal,
    00092         ScalePos = NoScale, BackgroundStyles = Trough );
    00093
    00094     virtual ~QwtSlider();
    00095
    00096     virtual void setOrientation( Qt::Orientation );
    00097
    00098     void setBackgroundStyle( BackgroundStyles );
    00099     BackgroundStyles backgroundStyle() const;
    00100
    00101     void setScalePosition( ScalePos s );
    00102     ScalePos scalePosition() const;
    00103
    00104     void setHandleSize( int width, int height );
    00105     void setHandleSize( const QSize & );
    00106     QSize handleSize() const;
    00107
    00108     void setBorderWidth( int bw );
    00109     int borderWidth() const;
    00110
    00111     void setSpacing( int );
    00112     int spacing() const;
    00113
    00114     virtual QSize sizeHint() const;
    00115     virtual QSize minimumSizeHint() const;
    00116
    00117     void setScaleDraw( QwtScaleDraw * );
    00118     const QwtScaleDraw *scaleDraw() const;
    00119
    00120 protected:
    00121     virtual double getValue( const QPoint &p );
    00122     virtual void getScrollMode( const QPoint &p,
    00123         QwtAbstractSlider::ScrollMode &, int &direction ) const;
    00124
    00125     virtual void drawSlider ( QPainter *, const QRect & ) const;
    00126     virtual void drawHandle( QPainter *, const QRect &, int pos ) const;
    00127
    00128     virtual void resizeEvent( QResizeEvent * );
    00129     virtual void paintEvent ( QPaintEvent * );
    00130     virtual void changeEvent( QEvent * );
    00131
    00132     virtual void valueChange();
    00133     virtual void rangeChange();
    00134     virtual void scaleChange();
    00135
    00136     int transform( double v ) const;
    00137
    00138     QwtScaleDraw *scaleDraw();
    00139
    00140 private:
    00141     void layoutSlider( bool );
    00142     void initSlider( Qt::Orientation, ScalePos, BackgroundStyles );
    00143
    00144     class PrivateData;
    00145     PrivateData *d_data;
    00146 };
    00147
    00148 Q_DECLARE_OPERATORS_FOR_FLAGS( QwtSlider::BackgroundStyles )
    00149
    00150 #endif