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

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 
00031 class QWT_EXPORT QwtSlider : public QwtAbstractSlider, public QwtAbstractScale
00032 {
00033     Q_OBJECT
00034     Q_ENUMS( ScalePos )
00035     Q_ENUMS( BGSTYLE )
00036     Q_PROPERTY( ScalePos scalePosition READ scalePosition
00037         WRITE setScalePosition )
00038     Q_PROPERTY( BGSTYLE bgStyle READ bgStyle WRITE setBgStyle )
00039     Q_PROPERTY( int thumbLength READ thumbLength WRITE setThumbLength )
00040     Q_PROPERTY( int thumbWidth READ thumbWidth WRITE setThumbWidth )
00041     Q_PROPERTY( int borderWidth READ borderWidth WRITE setBorderWidth )
00042  
00043 public:
00044 
00053     enum ScalePos { None, Left, Right, Top, Bottom };
00054 
00059     enum BGSTYLE { BgTrough = 0x1, BgSlot = 0x2, BgBoth = BgTrough | BgSlot};
00060 
00061     explicit QwtSlider(QWidget *parent,
00062           Qt::Orientation = Qt::Horizontal,
00063           ScalePos = None, BGSTYLE bgStyle = BgTrough);
00064     
00065     virtual ~QwtSlider();
00066 
00067     virtual void setOrientation(Qt::Orientation); 
00068 
00069     void setBgStyle(BGSTYLE);
00070     BGSTYLE bgStyle() const;
00071     
00072     void setScalePosition(ScalePos s);
00073     ScalePos scalePosition() const;
00074 
00075     int thumbLength() const;
00076     int thumbWidth() const;
00077     int borderWidth() const;
00078 
00079     void setThumbLength(int l);
00080     void setThumbWidth(int w);
00081     void setBorderWidth(int bw);
00082     void setMargins(int x, int y);
00083 
00084     virtual QSize sizeHint() const;
00085     virtual QSize minimumSizeHint() const;
00086     
00087     void setScaleDraw(QwtScaleDraw *);
00088     const QwtScaleDraw *scaleDraw() const;
00089 
00090 protected:
00091     virtual double getValue(const QPoint &p);
00092     virtual void getScrollMode(const QPoint &p, 
00093         int &scrollMode, int &direction);
00094 
00095     void draw(QPainter *p, const QRect& update_rect);
00096     virtual void drawSlider (QPainter *p, const QRect &r);
00097     virtual void drawThumb(QPainter *p, const QRect &, int pos);
00098 
00099     virtual void resizeEvent(QResizeEvent *e);
00100     virtual void paintEvent (QPaintEvent *e);
00101 
00102     virtual void valueChange();
00103     virtual void rangeChange();
00104     virtual void scaleChange();
00105     virtual void fontChange(const QFont &oldFont);
00106 
00107     void layoutSlider( bool update = true );
00108     int xyPosition(double v) const;
00109 
00110     QwtScaleDraw *scaleDraw();
00111 
00112 private:
00113     class PrivateData;
00114     PrivateData *d_data;
00115 };
00116 
00117 #endif

Generated on Mon Jan 30 22:16:26 2006 for Qwt User's Guide by  doxygen 1.4.4