Open Inventor Release 2024.1.3
 
Loading...
Searching...
No Matches
SoDialogEditText.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-2014 BY FEI S.A.S, ***
17 *** BORDEAUX, FRANCE ***
18 *** ALL RIGHTS RESERVED ***
19**=======================================================================*/
20/*=======================================================================
21** Author : Nicolas DAGUISE (Oct 2002)
22**=======================================================================*/
23#ifndef _SO_DIALOG_EDIT_TEXT_
24#define _SO_DIALOG_EDIT_TEXT_
25
26#include <DialogViz/dialog/SoDialogComponent.h>
27
29class SoEventCallback;
30class SoClipPlane;
31class SbLineProjector;
32
118{
119 SO_DG_HEADER(SoDialogEditText);
120
121 public:
122
127
132
137
142
149
154
159
164
169
170 /*==============================================================================*/
171 private:
172 virtual void buildWidget(SoWidget parent, SbVec2i32 &rSize, SbVec2i32 & pos, SbBool isActive2d);
173 virtual void destroyWidget();
174 virtual void eventNotify(unsigned int event, uintptr_t param);
175 virtual SoWidget getLabelWidget();
176 static void initClass();
177 static void exitClass();
178 virtual void updateFromSensor(SoSensor* sensor);
179 void processEvent(SbBool force);
180
181 void updateLabelWidget(); // update label widget position and size
182 void updateEditTextWidget(); // update edit widget position and size
183
184 void applyDlgCptAuditor();
185
186private:
187 SoWidget m_editTextWidget;
188
189 virtual ~SoDialogEditText();
190
191private:
192 SbVec2i32 m_oeSize, m_olSize;
193 SbBool m_fromSensor;
194
195 void createLabelWidget();
196 void createEditTextWidget();
197 virtual SbVec2i32 getComponentInitSize();
198 virtual void getDefaultSize(SbVec2i32 &size, SbVec2i32 &min, SbVec2i32 &max);
199
200 virtual void changeEditable();
201 virtual void changeMultiLine();
202 virtual void changeWrapLine();
203 virtual void changeEditText();
204 virtual void changeEnable(); // update edit and label widget state
205 virtual void changeWidgetEnable(SbBool state);
206 virtual void changeLabel(); // change the label widget text
207 virtual void changeLabelAlignment(); // change the label widget alignment
208 virtual void changeLabelVisibility(); // show or hide the label widget.
209 virtual void changeEdgeStyle();
210
211 virtual void setFocus(); // set focus to current edit area
212
213 // Declare Field Sensors.
214 FIELD_SENSOR(editText);
215 FIELD_SENSOR(editable);
216 FIELD_SENSOR(multiLine);
217 FIELD_SENSOR(wrapLine);
218
220// 3D methods
221private:
222 static char* DialogEditText; // Internal default skins.
223 static void change3DSkin();
224 static SbBool isSkinLoaded();
225 static void setSkinLoaded(SbBool loaded);
226 void insertCharTo3DText(char c);
227 void removeCharIn3DText();
228
229private:
230 SO_DG_CATALOG_ENTRY_HEADER( labelSep );
231 SO_DG_CATALOG_ENTRY_HEADER( labelSwitch );
232 SO_DG_CATALOG_ENTRY_HEADER( labelProp );
233
234 SO_DG_CATALOG_ENTRY_HEADER( scrollVSwitch );
235 SO_DG_CATALOG_ENTRY_HEADER( downSep );
236 SO_DG_CATALOG_ENTRY_HEADER( downSwitch );
237 SO_DG_CATALOG_ENTRY_HEADER( downPressed );
238 SO_DG_CATALOG_ENTRY_HEADER( downReleased );
239 SO_DG_CATALOG_ENTRY_HEADER( upSep );
240 SO_DG_CATALOG_ENTRY_HEADER( upSwitch );
241 SO_DG_CATALOG_ENTRY_HEADER( upPressed );
242 SO_DG_CATALOG_ENTRY_HEADER( upReleased );
243 SO_DG_CATALOG_ENTRY_HEADER( scrollVSep );
244 SO_DG_CATALOG_ENTRY_HEADER( scrollVBack );
245 SO_DG_CATALOG_ENTRY_HEADER( scrollVFrame );
246 SO_DG_CATALOG_ENTRY_HEADER( cursorVSep );
247 SO_DG_CATALOG_ENTRY_HEADER( cursorVFrame );
248
249 SO_DG_CATALOG_ENTRY_HEADER( scrollHSwitch );
250 SO_DG_CATALOG_ENTRY_HEADER( leftSep );
251 SO_DG_CATALOG_ENTRY_HEADER( leftSwitch );
252 SO_DG_CATALOG_ENTRY_HEADER( leftPressed );
253 SO_DG_CATALOG_ENTRY_HEADER( leftReleased );
254 SO_DG_CATALOG_ENTRY_HEADER( rightSep );
255 SO_DG_CATALOG_ENTRY_HEADER( rightSwitch );
256 SO_DG_CATALOG_ENTRY_HEADER( rightPressed );
257 SO_DG_CATALOG_ENTRY_HEADER( rightReleased );
258 SO_DG_CATALOG_ENTRY_HEADER( scrollHSep );
259 SO_DG_CATALOG_ENTRY_HEADER( scrollHBack );
260 SO_DG_CATALOG_ENTRY_HEADER( scrollHFrame );
261 SO_DG_CATALOG_ENTRY_HEADER( cursorHSep );
262 SO_DG_CATALOG_ENTRY_HEADER( cursorHFrame );
263
264 SO_DG_CATALOG_ENTRY_HEADER( editSep );
265 SO_DG_CATALOG_ENTRY_HEADER( frameSep );
266 SO_DG_CATALOG_ENTRY_HEADER( frameSwitch );
267 SO_DG_CATALOG_ENTRY_HEADER( frame );
268 SO_DG_CATALOG_ENTRY_HEADER( editFrame );
269 SO_DG_CATALOG_ENTRY_HEADER( textSep );
270 SO_DG_CATALOG_ENTRY_HEADER( textProp );
271
272 SO_DG_CATALOG_ENTRY_HEADER( caretSep );
273 SO_DG_CATALOG_ENTRY_HEADER( caretSwitch );
274 SO_DG_CATALOG_ENTRY_HEADER( caretFrame );
275
276private:
277
278 SoText3 *editTextText, *editTextLabel;
279 SoTranslation *editTextLabelTranslation, *editTextFrameTranslation;
280 SoTranslation *editTextTextTranslation, *scrollVCursorTranslation, *scrollHCursorTranslation;
281 SoTranslation *editTextDownTranslation, *editTextUpTranslation;
282 SoTranslation *editTextLeftTranslation, *editTextRightTranslation;
283 SoTranslation *editTextScrollVTranslation, *scrollVCursorPosTranslation, *editTextCaretTranslation;
284 SoTranslation *editTextScrollHTranslation, *scrollHCursorPosTranslation, *editTextScrollTextTranslation;
285 SoScale *editTextFrameScale;
286 SoScale *editTextButtonScale, *editTextScrollVScale, *editTextScrollHScale;
287 SoScale *scrollVCursorScale, *scrollHCursorScale, *editTextCaretScale;
288 SoTransform *editTextFrameTransform, *scrollVFrameTransform, *scrollHFrameTransform;
289 SoClipPlane *editTextClipPlaneTop, *editTextClipPlaneBottom;
290 SoClipPlane *editTextClipPlaneLeft, *editTextClipPlaneRight;
291
292 SoEventCallback* eventCB;
293 SbBool m_isEditing;
294 SbLineProjector* m_lineProj;
295 SbVec3f m_initialVPos, m_initialHPos;
296 int m_currentPos;
297 int m_current3DLine;
298 int m_current3DCaretPos;
299
300 SbBox3f m_textCachedBBox;
301
302 void create3DDialogEditText();
303 void update3DEditText();
304 void update3DLabel();
305 void update3DCursors();
306 void update3DScrollBars();
307 void update3DTextPosition();
308 void update3DTextScrollPosition();
309 void move3DCursor(float inc);
310 void move3DCaret(int line, int pos);
311 void update3DTextCache(int prevLine);
312 void apply3DEvent(SbString str);
313
314 void change3DEditText();
315 virtual void change3DLabelVisibility();
316 virtual void change3DLabel();
317 virtual void change3DLabelAlignment();
318 virtual void set3DInactive();
319
320 static void startCB3D( void *, SoDragger *inDragger );
321 static void motionCB3D( void *, SoDragger *inDragger );
322 static void finishCB3D( void *, SoDragger *inDragger );
323 static void processKeyEvents(void *inDragger, SoEventCallback *cb);
324 void draggerStartCallback3D();
325 void draggerMotionCallback3D();
326 void draggerFinishCallback3D();
327
328 void finish3DEditing();
329
330 static SbBool m_isSkinLoaded;
331
333
334};
335
336#endif // _SO_DIALOG_EDIT_TEXT_
337
338
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
Clipping plane node.
Definition SoClipPlane.h:94
<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> Dialog EditText ...
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Dialog EditText ...
SoDialogEditText()
Constructor.
SoSFString editText
String of the edit zone.
SoSFBool multiLine
Sets multi-line mode.
void removeAuditor(SoDialogEditTextAuditor *auditor)
Removes the specified editTextAuditor from the auditor list.
SoSFBool wrapLine
Sets wraping line mode.
SoSFBool editable
Allows writing in the edit zone.
void addAuditor(SoDialogEditTextAuditor *auditor)
Adds a dialogEditTextAuditor to the current editText component.
SoSFBool trigOnEnter
When trigOnEnter is TRUE, the associated auditor is called only when the <ENTER> key is pressed.
SoSFBool isNumeric
Specifies if typed text is numeric only.
Base class for nodekits that move in response to click-drag-release mouse events.
Definition SoDragger.h:537
Node which invokes callbacks for events.
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