00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef _SO_QT_BASIC_SLIDER_
00025 #define _SO_QT_BASIC_SLIDER_
00026 #include <Inventor/Qt/OivQtCompat.h>
00027 #include <Inventor/Qt/SoQtGLWidget.h>
00028
00029 class SbColor;
00030 class SoFloatCallbackList;
00031
00032
00033 typedef void SoQtBasicSliderCB(void *userData, float val);
00034
00036
00037
00038 {
00039 Q_OBJECT
00040
00041 public:
00042
00043 enum Type {
00044 RED_SLIDER,
00045 GREEN_SLIDER,
00046 BLUE_SLIDER,
00047 HUE_SLIDER,
00048 SATURATION_SLIDER,
00049 VALUE_SLIDER,
00050 INTENSITY_SLIDER,
00051 PLAIN_SLIDER
00052 };
00053
00054
00055 SoQtBasicSlider (QWidget *parent, Type t);
00056 ~SoQtBasicSlider ();
00057
00058
00059 void setValue(float v);
00060 float getValue() const
00061 { return value; }
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076 void setBaseColor(const float rgbOrHsv[3]);
00077 const float *getBaseColor() { return color; }
00078
00079
00080
00081
00082 void setWYSIWYG(SbBool trueOrFalse);
00083 SbBool isWYSIWYG() { return WYSIWYGmode; }
00084
00085
00086
00087
00088
00089 void addStartCallback (SoQtBasicSliderCB *f, void *userData = NULL);
00090 void addValueChangedCallback (SoQtBasicSliderCB *f, void *userData = NULL);
00091 void addFinishCallback (SoQtBasicSliderCB *f, void *userData = NULL);
00092 void removeStartCallback (SoQtBasicSliderCB *f, void *userData = NULL);
00093 void removeValueChangedCallback (SoQtBasicSliderCB *f, void *userData = NULL);
00094 void removeFinishCallback (SoQtBasicSliderCB *f, void *userData = NULL);
00095
00096
00097 void interactivity( SbBool flag ) { interactive = flag; }
00098 SbBool isInteractive() { return interactive; }
00099
00100 private:
00101
00102
00103 virtual void redraw();
00104 virtual void drawSliderTopRegion();
00105
00106
00107 short slx1, sly1, slx2, sly2;
00108 short thumx1, thumy1, thumx2, thumy2;
00109
00110 private:
00111
00112
00113 float value;
00114 short position;
00115 short posdiff;
00116 SbBool interactive;
00117 SbBool leftButtonPressed;
00118
00119
00120 SbBool WYSIWYGmode;
00121 SbColor *defaultColors;
00122 SbColor *colors;
00123 SbVec2f *geometry;
00124 Type type;
00125 float color[3];
00126
00127
00128 void makeDefaultColors();
00129 void makeWYSIWYGcolors();
00130
00131
00132
00133 SoFloatCallbackList *startCallbacks;
00134 SoFloatCallbackList *changedCallbacks;
00135 SoFloatCallbackList *finishCallbacks;
00136
00137
00138 virtual void sizeChanged(const SbVec2s &newSize);
00139 void processEvent(QEvent *anyevent);
00140 static void sliderChangedCB(void *, float val);
00141 };
00142
00143 #endif // _SO_QT_BASIC_SLIDER_
00144
00145
00146