Open Inventor Release 2024.2.0
 
Loading...
Searching...
No Matches
SoDialogSlider.h
1/*=======================================================================
2 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), ***
3 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. ***
4 *** ***
5 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS ***
6 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR ***
7 *** WRITTEN AUTHORIZATION OF FEI S.A.S. ***
8 *** ***
9 *** RESTRICTED RIGHTS LEGEND ***
10 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS ***
11 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN ***
12 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT ***
13 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN ***
14 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. ***
15 *** ***
16 *** COPYRIGHT (C) 1996-2018 BY FEI S.A.S, ***
17 *** BORDEAUX, FRANCE ***
18 *** ALL RIGHTS RESERVED ***
19**=======================================================================*/
20/*=======================================================================
21** Author : Nicolas Daguise (Jan 2002)
22**=======================================================================*/
23#ifndef _SO_DIALOG_SLIDER_
24#define _SO_DIALOG_SLIDER_
25
26#include <DialogViz/dialog/SoDialogComponent.h>
27#include <Inventor/fields/SoMFColor.h>
28
29class SoDialogCustomSlider;
30class SbLineProjector;
31class SoEventCallback;
32class SoKeyboardEvent;
33
53{
54 SO_DG_HEADER(SoDialogSlider);
55
56 public:
57
62
67
74
80
86
93
99
104
105
106 /*==============================================================================*/
107 private:
108 virtual void buildWidget(SoWidget parent, SbVec2i32 &rSize, SbVec2i32 &pos, SbBool isActive2d);
109 virtual void destroyWidget();
110 virtual void eventNotify(unsigned int event, uintptr_t param);
111 virtual SoWidget getLabelWidget();
112 static void initClass();
113 static void exitClass();
114 virtual void setValueFromEdit(SbBool ) {};
115 virtual void setValueFromSlider(float ) {};
116 virtual void changeSliderValue() {};
117 virtual void updateFromSensor(SoSensor* sensor);
118 float getValue();
119 static void finishCallback(void *slider, float newValue);
120 static void valueChangeCallback(void* slider, float newValue);
121 virtual void setValue() {};
122 SbBool getActive2d() { return m_isActive2d; };
123
124// methods called by callbacks
125 void changeValueFromSlider(float newValue);
126 void changeValueAfterFinish(float newValue);
127 void changeSliderFromEdit();
128 void changeSliderFromSlider(float num);
129
130 // pos and size changes
131 void updateEditWidget();
132 void updateSliderWidget();
133 void updateLabelWidget();
134 void updateToggleWidget();
135
136 private:
137 // m_dialogCustomSlider has ownership of the m_sliderWidget, we should not delete it
138 SoWidget m_sliderWidget;
139 SoWidget m_toggleWidget;
140 SoWidget m_editWidget;
141 int m_sliderWidth;
142 int m_editWidth;
143 float m_sliderValue;
144 SoDialogCustomSlider* m_dialogCustomSlider;
145 bool m_ownDialogCustomSlider;
146
147 virtual ~SoDialogSlider();
148
149 virtual void changeEditValue() {};
150 SbString getValueFromEdit();
151 virtual int computeEditZoneWidth() {return 0;};
152
153 void updateWidget();
154
155 private:
156 /* === FIELDS DECLARATION === */
157 FIELD_SENSOR(valueVisible);
158 FIELD_SENSOR(continuousTrigger);
159 FIELD_SENSOR(toggleVisible);
160 FIELD_SENSOR(fixedLimits);
161 FIELD_SENSOR(colors);
162 FIELD_SENSOR(shadedColors);
163 FIELD_SENSOR(format);
164
165 /* === COMPUTING METHODS === */
166 virtual SbVec2i32 getComponentInitSize();
167 virtual void getDefaultSize(SbVec2i32 &size, SbVec2i32 &min, SbVec2i32 &max);
168
169 /* === CREATION METHODS === */
170 void createEditWidget();
171 void createLabelWidget();
172 void createSliderWidget();
173 void createToggleWidget();
174
175 /* === UPDATE METHODS === */
176
177 // local change methods
178 virtual void changeValueVisible();
179 virtual void changeToggleVisible();
180 virtual void changeContinuousTrigger();
181 virtual void changeFormat();
182
183 // inherited change methods from SoDialogComponent
184 virtual void changeEdgeStyle();
185 virtual void changeLabelVisibility();
186
187 // inherited change methods from SoDialogViz
188 virtual void changeEnable();
189 virtual void changeWidgetEnable(SbBool state);
190 virtual void changeLabel();
191 virtual void changeLabelAlignment();
192
194// 3D methods
195private:
196 static char* DialogSlider; // Internal default skins.
197 static void change3DSkin();
198 static SbBool isSkinLoaded();
199 static void setSkinLoaded(SbBool loaded);
200
201 SbBool ip_isEditing;
202
203 void change3DSliderValue();
204 void change3DCursor();
205
206 static void processKeyEvents(void *inDragger, SoEventCallback *cb);
207
208private:
209
210 SO_DG_CATALOG_ENTRY_HEADER( labelSep );
211 SO_DG_CATALOG_ENTRY_HEADER( labelSwitch );
212 SO_DG_CATALOG_ENTRY_HEADER( labelProp );
213 SO_DG_CATALOG_ENTRY_HEADER( checkSep );
214 SO_DG_CATALOG_ENTRY_HEADER( checkSwtch );
215 SO_DG_CATALOG_ENTRY_HEADER( checkStateOff );
216 SO_DG_CATALOG_ENTRY_HEADER( checkStateOn );
217 SO_DG_CATALOG_ENTRY_HEADER( sliderSep );
218 SO_DG_CATALOG_ENTRY_HEADER( frameSep );
219 SO_DG_CATALOG_ENTRY_HEADER( frame );
220 SO_DG_CATALOG_ENTRY_HEADER( cursorSep );
221 SO_DG_CATALOG_ENTRY_HEADER( cursor );
222 SO_DG_CATALOG_ENTRY_HEADER( edtSwtch );
223 SO_DG_CATALOG_ENTRY_HEADER( edtFrmSep );
224 SO_DG_CATALOG_ENTRY_HEADER( edtFrmSwtch );
225 SO_DG_CATALOG_ENTRY_HEADER( valueFrame );
226 SO_DG_CATALOG_ENTRY_HEADER( editValueFrame);
227 SO_DG_CATALOG_ENTRY_HEADER( editTextSep );
228 SO_DG_CATALOG_ENTRY_HEADER( editTextProp );
229
230 SoScale *sliderFrameScale, *sliderEditFrameScale;
231 SoText3 *sliderLabel, *sliderEditText;
232 SoTransform *sliderFrameTransform, *sliderEditFrameTransform;
233 SoTranslation *sliderLabelTranslation, *sliderToggleTranslation;
234 SoTranslation *sliderFrameTranslation, *sliderEditFrameTranslation;
235 SoTranslation *sliderEditTextTranslation, *sliderCursorTranslation, *sliderCursorPosTranslation;
236
237 SbString get3DValueFromEdit();
238 virtual void change3DEditValue();
239 virtual void change3DEnable();
240
241private:
242 SbBox3f m_editTextCachedBBox;
243 static SbBool m_isSkinLoaded;
244
245 SbLineProjector* m_lineProj;
246 SbVec3f m_initialPos;
247 int m_slider3DWidth;
248
249 void create3DDialogSlider();
250 void update3DSlider();
251 void update3DLabel();
252
253 virtual void set3DInactive();
254 virtual void change3DLabelVisibility();
255 virtual void change3DLabel();
256 virtual void change3DLabelAlignment();
257 void change3DContinuousTrigger();
258 void change3DValueVisible();
259 void change3DToggleVisible();
260
261 static void startCB3D( void *, SoDragger *inDragger );
262 static void motionCB3D( void *, SoDragger *inDragger );
263 static void finishCB3D( void *, SoDragger *inDragger );
264 void draggerStartCallback3D();
265 void draggerMotionCallback3D();
266 void draggerFinishCallback3D();
267
268 virtual void computeNewSliderEditValue(SoKeyboardEvent* ) {};
269
270private:
271 virtual void finish3DEditing() {};
273
274};
275
276#endif // _SO_DIALOG_SLIDER_
277
278
3D box class.
Definition SbBox.h:649
Line projector.
Class for smart character strings.
Definition SbString.h:202
2D vector class.
Definition SbVec.h:517
3D vector class.
Definition SbVec.h:932
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Abstract base cl...
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Abstract class f...
SoSFBool fixedLimits
Allows user to enter a value outside the min/max range.
SoSFBool valueVisible
Specifies whether the edit zone value is visible or not.
SoSFString format
Specify the string format of the slider value edit zone.
SoSFBool continuousTrigger
If this field is set to FALSE, the associated interface is called when the mouse button is released.
SoSFBool shadedColors
Indicates is the set of colors defined in the field colors is rendered in shaded mode or not.
SoSFBool toggleVisible
Specifies whether the toggle button that manages continuous triggering is visible or not.
SoMFColor colors
Contains an array of colors.
SoDialogSlider()
Constructor.
Base class for nodekits that move in response to click-drag-release mouse events.
Definition SoDragger.h:537
Node which invokes callbacks for events.
Keyboard key press and release events.
Multiple-value field containing any number of RGB colors stored as three floats.
Definition SoMFColor.h:98
Field containing a single Boolean value.
Definition SoSFBool.h:79
Field containing a string.
Definition SoSFString.h:117
Node representing a 3D geometric scaling.
Definition SoScale.h:96
Abstract base class for Open Inventor sensors.
Definition SoSensor.h:100
3D text shape node.
Definition SoText3.h:204
General 3D geometric transformation node.
Node representing a 3D translation.
int SbBool
Boolean type.
Definition SbBase.h:87