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 _PO_XT_SLIDER_DATA_H_
00025 #define _PO_XT_SLIDER_DATA_H_
00026
00027 #include <Inventor/dialog/PoXtElementData.h>
00028
00029 #ifndef _WIN32
00030 class SliderGl;
00031 class PoXtLabelData;
00032 #else
00033 class SoCallbackList;
00034 class PoXtLabelData;
00035 class PoXtCustomSlider;
00036 class PoEdit;
00037 class PoButton;
00038 #endif
00039
00040 class SbColor;
00041 class SbVec2s;
00042 class SoDEPRECATED PoXtSliderData : public PoXtElementData
00056 {
00057
00058 public:
00059
00063 enum TriggerMode
00064 {
00068 CONTINUOUS_TRIGGER,
00072 MOUSE_ON_RELEASE_TRIGGER
00073 } ;
00074
00075
00076
00080 virtual ~PoXtSliderData();
00081
00087 SoNONUNICODE void setLabel(const char * label);
00088
00092 void setLabel( const SbString& label );
00093
00097 SbString getLabel() const;
00098
00102 SbBool isNumericFieldVisible() const;
00103
00107 void setNumericFieldVisibility(SbBool flag);
00108
00114 void setTrigger(TriggerMode mode);
00115
00121 TriggerMode getTrigger() const;
00122
00127 void setFixedLimits(SbBool flag) ;
00128
00132 SbBool isFixedLimits() const ;
00133
00134
00135
00136
00137
00141 void setAppearance(const SbColor & color);
00142
00147 void setAppearance(const SbColor & startColor, const SbColor & endColor);
00148
00153 void setAppearance(int numColors,
00154 const SbColor * colors,
00155 SbBool isColorShaded=TRUE);
00156
00161 typedef void PoXtSliderAppearanceCB(const SbVec2s & start,
00162 const SbVec2s & end,
00163 void * userData);
00164
00172 void setAppearance(PoXtSliderAppearanceCB * function, void * userData=NULL);
00173
00177 virtual TypeXtElement getType() const=0;
00178
00179
00180
00181 #ifndef _WIN32
00182 private:
00183
00184 virtual SoWidget buildWidget(SoWidget parent);
00185 virtual void handleTextFieldCallback(SoWidget w)=0;
00186
00187
00188
00189 virtual void updateValues(const PoXtElementData * xtElement);
00190
00191
00192
00193 virtual int getRealMinWidgetWidth() const;
00194 virtual void setMinWidgetWidth(int value);
00195
00196
00197
00198 SliderGl * getSliderGl() const;
00199 SoWidget getNumberWidget() const;
00200
00201 virtual void addCallback(SoCallbackListCB * function, void * data);
00202 virtual void removeCallback(SoCallbackListCB * function, void * data);
00203
00204
00205
00206 virtual void valueChangedCallback(PoXtSliderData * slider,
00207 float * thumbPosition)=0;
00208
00209 virtual void releaseCallback(PoXtSliderData * slider,
00210 float * thumbPosition)=0;
00211
00212
00213 virtual void updateNumericFieldCallback(PoXtSliderData * slider,
00214 float * thumbPosition)=0;
00215
00216 private:
00217 PoXtSliderData(const char * label=NULL,
00218 TriggerMode mode=MOUSE_ON_RELEASE_TRIGGER);
00219
00220 PoXtSliderData(const PoXtSliderData & slider);
00221
00222
00223 virtual void drawTextField(SoWidget numericWidget)=0;
00224 SoCallbackList * _sliderCallback;
00225
00226 private:
00227 void buildNumericField();
00228 void attachLabel();
00229 void buildToggle();
00230
00231 SliderGl * _sliderGl;
00232 SoWidget _sliderGlWidget, _labelWidget, _numberWidget;
00233 SoWidget _toggleWidget;
00234 SbBool _numberVisible;
00235 TriggerMode _modeTrigger;
00236 PoXtLabelData * _label;
00237 SbBool _isFixedLimits ;
00238 #else
00239 private:
00240 virtual void buildWidget(SoWidget parent, int verticalOffset);
00241
00242 virtual void updateValues(const PoXtElementData *);
00243
00244
00245 virtual void setSize (int value, int verticalOffset);
00246 virtual int getSize () const;
00247
00248 virtual void addCallback(SoCallbackListCB * function, void * data);
00249 virtual void removeCallback(SoCallbackListCB * function, void * data);
00250
00251 static const int toggleSize;
00252 static const int editSize;
00253
00254 private:
00255 PoXtSliderData(const char * label=NULL,
00256 TriggerMode mode=MOUSE_ON_RELEASE_TRIGGER);
00257 PoXtSliderData (const PoXtSliderData &);
00258
00259
00260 virtual void updateNumericField(float value);
00261
00262 virtual void changeSliderValue();
00263 virtual void invokeCallbacks();
00264
00265 SoCallbackList * _sliderCallback;
00266
00267 static void handleCallback (void *, float);
00268 static void updateEditCallback (void *, float);
00269
00270 PoXtCustomSlider * _slider;
00271 PoEdit * _edit;
00272 PoButton * _toggle;
00273 PoXtLabelData * _label;
00274
00275 TriggerMode _triggerMode;
00276
00277 private:
00278 void buildNumericField(SoWidget Parent);
00279 void buildToggle(SoWidget Parent);
00280 void redrawNumericField();
00281 void redrawToggle();
00282
00283 void redraw ();
00284
00285 static void toggleCallback (void *, void *);
00286 static void editCallback (void *, void *);
00287
00288 int _verticalOffset;
00289 int _horizontalOffset;
00290 int _size;
00291 int _height;
00292
00293 SbBool _isFixedLimits ;
00294
00295 SbBool _numberVisible;
00296 #endif
00297 };
00298
00299 #endif //_PO_XT_SLIDER_DATA_H_
00300
00301
00302