00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef _SO_DIALOG_SLIDER_
00024 #define _SO_DIALOG_SLIDER_
00025
00026 #include <DialogViz/dialog/SoDialogComponent.h>
00027 #include <Inventor/fields/SoMFColor.h>
00028
00029 class SoDialogCustomSlider;
00030 class SbLineProjector;
00031 class SoEventCallback;
00032 class SoKeyboardEvent;
00033
00052 class SoDialogSlider : public SoDialogComponent
00053 {
00054 SO_DG_HEADER(SoDialogSlider);
00055
00056 public:
00057
00061 SoSFBool valueVisible;
00062
00066 SoSFString format;
00067
00073 SoSFBool continuousTrigger;
00074
00079 SoSFBool toggleVisible;
00080
00085 SoSFBool fixedLimits;
00086
00092 SoMFColor colors;
00093
00098 SoSFBool shadedColors;
00099
00103 SoDialogSlider();
00104
00105
00106
00107 private:
00108 virtual void buildWidget(SoWidget parent, SbVec2i32 &rSize, SbVec2i32 &pos, SbBool isActive2d);
00109 virtual void destroyWidget();
00110 virtual void eventNotify(unsigned int event, uintptr_t param);
00111 virtual SoWidget getLabelWidget();
00112 static void initClass();
00113 static void exitClass();
00114 virtual void setValueFromEdit(SbBool ) {};
00115 virtual void setValueFromSlider(float ) {};
00116 virtual void changeSliderValue() {};
00117 virtual void updateFromSensor(SoSensor* sensor);
00118 float getValue();
00119 static void finishCallback(void *slider, float newValue);
00120 static void valueChangeCallback(void* slider, float newValue);
00121 virtual void setValue() {};
00122 SbBool getActive2d() { return m_isActive2d; };
00123
00124
00125 void changeValueFromSlider(float newValue);
00126 void changeValueAfterFinish(float newValue);
00127 void changeSliderFromEdit();
00128 void changeSliderFromSlider(float num);
00129
00130
00131 void updateEditWidget();
00132 void updateSliderWidget();
00133 void updateLabelWidget();
00134 void updateToggleWidget();
00135
00136 private:
00137
00138 SoWidget m_sliderWidget;
00139 SoWidget m_toggleWidget;
00140 SoWidget m_editWidget;
00141 int m_sliderWidth;
00142 int m_editWidth;
00143 float m_sliderValue;
00144 SoDialogCustomSlider* m_dialogCustomSlider;
00145 bool m_ownDialogCustomSlider;
00146
00147 virtual ~SoDialogSlider();
00148
00149 virtual void changeEditValue() {};
00150 SbString getValueFromEdit();
00151 virtual int computeEditZoneWidth() {return 0;};
00152
00153 void updateWidget();
00154
00155 private:
00156
00157 FIELD_SENSOR(valueVisible);
00158 FIELD_SENSOR(continuousTrigger);
00159 FIELD_SENSOR(toggleVisible);
00160 FIELD_SENSOR(fixedLimits);
00161 FIELD_SENSOR(colors);
00162 FIELD_SENSOR(shadedColors);
00163 FIELD_SENSOR(format);
00164
00165
00166 virtual SbVec2i32 getComponentInitSize();
00167 virtual void getDefaultSize(SbVec2i32 &size, SbVec2i32 &min, SbVec2i32 &max);
00168
00169
00170 void createEditWidget();
00171 void createLabelWidget();
00172 void createSliderWidget();
00173 void createToggleWidget();
00174
00175
00176
00177
00178 virtual void changeValueVisible();
00179 virtual void changeToggleVisible();
00180 virtual void changeContinuousTrigger();
00181 virtual void changeFormat();
00182
00183
00184 virtual void changeEdgeStyle();
00185 virtual void changeLabelVisibility();
00186
00187
00188 virtual void changeEnable();
00189 virtual void changeWidgetEnable(SbBool state);
00190 virtual void changeLabel();
00191 virtual void changeLabelAlignment();
00192
00194
00195 private:
00196 static char* DialogSlider;
00197 static void change3DSkin();
00198 static SbBool isSkinLoaded();
00199 static void setSkinLoaded(SbBool loaded);
00200
00201 SbBool ip_isEditing;
00202
00203 void change3DSliderValue();
00204 void change3DCursor();
00205
00206 static void processKeyEvents(void *inDragger, SoEventCallback *cb);
00207
00208 private:
00209
00210 SO_DG_CATALOG_ENTRY_HEADER( labelSep );
00211 SO_DG_CATALOG_ENTRY_HEADER( labelSwitch );
00212 SO_DG_CATALOG_ENTRY_HEADER( labelProp );
00213 SO_DG_CATALOG_ENTRY_HEADER( checkSep );
00214 SO_DG_CATALOG_ENTRY_HEADER( checkSwtch );
00215 SO_DG_CATALOG_ENTRY_HEADER( checkStateOff );
00216 SO_DG_CATALOG_ENTRY_HEADER( checkStateOn );
00217 SO_DG_CATALOG_ENTRY_HEADER( sliderSep );
00218 SO_DG_CATALOG_ENTRY_HEADER( frameSep );
00219 SO_DG_CATALOG_ENTRY_HEADER( frame );
00220 SO_DG_CATALOG_ENTRY_HEADER( cursorSep );
00221 SO_DG_CATALOG_ENTRY_HEADER( cursor );
00222 SO_DG_CATALOG_ENTRY_HEADER( edtSwtch );
00223 SO_DG_CATALOG_ENTRY_HEADER( edtFrmSep );
00224 SO_DG_CATALOG_ENTRY_HEADER( edtFrmSwtch );
00225 SO_DG_CATALOG_ENTRY_HEADER( valueFrame );
00226 SO_DG_CATALOG_ENTRY_HEADER( editValueFrame);
00227 SO_DG_CATALOG_ENTRY_HEADER( editTextSep );
00228 SO_DG_CATALOG_ENTRY_HEADER( editTextProp );
00229
00230 SoScale *sliderFrameScale, *sliderEditFrameScale;
00231 SoText3 *sliderLabel, *sliderEditText;
00232 SoTransform *sliderFrameTransform, *sliderEditFrameTransform;
00233 SoTranslation *sliderLabelTranslation, *sliderToggleTranslation;
00234 SoTranslation *sliderFrameTranslation, *sliderEditFrameTranslation;
00235 SoTranslation *sliderEditTextTranslation, *sliderCursorTranslation, *sliderCursorPosTranslation;
00236
00237 SbString get3DValueFromEdit();
00238 virtual void change3DEditValue();
00239 virtual void change3DEnable();
00240
00241 private:
00242 SbBox3f m_editTextCachedBBox;
00243 static SbBool m_isSkinLoaded;
00244
00245 SbLineProjector* m_lineProj;
00246 SbVec3f m_initialPos;
00247 int m_slider3DWidth;
00248
00249 void create3DDialogSlider();
00250 void update3DSlider();
00251 void update3DLabel();
00252
00253 virtual void set3DInactive();
00254 virtual void change3DLabelVisibility();
00255 virtual void change3DLabel();
00256 virtual void change3DLabelAlignment();
00257 void change3DContinuousTrigger();
00258 void change3DValueVisible();
00259 void change3DToggleVisible();
00260
00261 static void startCB3D( void *, SoDragger *inDragger );
00262 static void motionCB3D( void *, SoDragger *inDragger );
00263 static void finishCB3D( void *, SoDragger *inDragger );
00264 void draggerStartCallback3D();
00265 void draggerMotionCallback3D();
00266 void draggerFinishCallback3D();
00267
00268 virtual void computeNewSliderEditValue(SoKeyboardEvent* ) {};
00269
00270 private:
00271 virtual void finish3DEditing() {};
00273
00274 };
00275
00276 #endif // _SO_DIALOG_SLIDER_
00277
00278
00279