00001 #ifndef SOQT_THUMBWHEEL_H
00002 #define SOQT_THUMBWHEEL_H
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #include <qwidget.h>
00028
00029 #include <Inventor/Qt/SoQtBasic.h>
00030
00031 class QPixmap;
00032 class SoAnyThumbWheel;
00033
00034
00035
00036 class SOQT_DLL_API SoQtThumbWheel : public QWidget
00037 {
00038 Q_OBJECT
00039
00040 public:
00041 enum Orientation { Horizontal, Vertical };
00042
00043 SoQtThumbWheel(QWidget * parent = 0, const char * name = 0);
00044 SoQtThumbWheel(Orientation, QWidget * parent = 0, const char * name = 0);
00045 ~SoQtThumbWheel(void);
00046
00047 void setOrientation(Orientation);
00048 Orientation orientation(void) const;
00049
00050 void setValue(float value);
00051 float value(void) const;
00052
00053 void setEnabled(bool enable);
00054 bool isEnabled(void) const;
00055
00056 enum boundaryHandling {
00057 CLAMP,
00058 MODULATE,
00059 ACCUMULATE
00060 };
00061 void setRangeBoundaryHandling(boundaryHandling handling);
00062 boundaryHandling getRangeBoundaryHandling(void) const;
00063
00064 QSize sizeHint(void) const;
00065
00066 signals:
00067 void wheelPressed(void);
00068 void wheelMoved(float value);
00069 void wheelReleased(void);
00070
00071 protected:
00072 void paintEvent(QPaintEvent *);
00073
00074 void mousePressEvent(QMouseEvent *);
00075 void mouseReleaseEvent(QMouseEvent *);
00076 void mouseMoveEvent(QMouseEvent *);
00077
00078 private:
00079 void constructor(Orientation);
00080
00081 SoQtThumbWheel(const SoQtThumbWheel & wheel);
00082 SoQtThumbWheel & operator = (const SoQtThumbWheel & wheel);
00083
00084 enum State { Idle, Dragging, Disabled } state;
00085
00086 Orientation orient;
00087 float wheelValue, tempWheelValue;
00088 int mouseDownPos, mouseLastPos;
00089
00090 void initWheel(int diameter, int width);
00091
00092 SoAnyThumbWheel * wheel;
00093 QPixmap ** pixmaps;
00094 int numPixmaps;
00095 int currentPixmap;
00096
00097 };
00098
00099
00100
00101 #endif // ! SOQT_THUMBWHEEL_H