Open Inventor Release 2024.1.3
 
Loading...
Searching...
No Matches
SoTopLevelDialog.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_TOP_LEVEL_DIALOG_
24#define _SO_TOP_LEVEL_DIALOG_
25
26#include <DialogViz/dialog/SoDialogViz.h>
27#include <DialogViz/dialog/SoTopComponent.h>
28#include <Inventor/fields/SoSFInt32.h>
29#include <Inventor/fields/SoSFVec2i32.h>
30#include <Inventor/fields/SoSFBool.h>
31#include <Inventor/fields/SoSFEnum.h>
32
34class SoDialogAuditor;
35class SoText3;
36class SoTranslation;
37class SoTransform;
38class SoScale;
39
40class SoMenuBar;
41
111{
112 SO_DG_HEADER(SoTopLevelDialog);
113
114 public:
115
122
129
130
135
140
145
150
156
162
168
174
180
186
191
196
205
210
215
221
227
236
241
248 void buildDialog(SoWidget parent, SbBool buildInsideParent = FALSE);
249
253 void close();
254
258 virtual void show();
259
263 virtual void hide();
264
269
274
279
285
289 virtual void addChild(SoTopComponent *child);
290
294 virtual void insertChild(SoTopComponent *child, int newChildIndex);
295
299 virtual SoNode *getChild(int index) const;
300
304 virtual int getNumChildren() const;
305
309 virtual int findChild(const SoTopComponent *child) const;
310
314 virtual void removeChild(int index);
315
319 virtual void removeChild(SoTopComponent *child);
320
324 virtual void removeAllChildren();
325
329 virtual void replaceChild(int index, SoTopComponent *newChild);
330
334 virtual void replaceChild(SoTopComponent *oldChild, SoTopComponent *newChild);
335
336/*==============================================================================*/
337 private:
338
339 //update from minimized state
340 void updateMinimizedState();
341
342 //Returns computed top level dialog size
343 SbVec3f getTopLevelSize(){ return topLevelFrameScale->scaleFactor.getValue();}
344
345 void buildWidget(SoWidget parent, SbVec2i32 &, SbVec2i32 &, SbBool isActive2d);
346 void updateDialogBuild(SbBool is2dRender);
347 void fixSizeWithBorder(SbVec2i32 &size, int revert = 1);
348 SoWidget getBaseWidget() {return m_baseWidget;};
349 SoWidget getWidget();
350
351 static void initClass();
352 static void exitClass();
353
354 void setCurrentFocusedWidget(SoWidget widget);
355 void setCurrentScrolledWidget(SoWidget widget);
356 SoWidget getCurrentScrolledWidget();
357 SoWidget getCurrentFocusedWidget();
358
359 SbBool destroyDialog();
360 void setScrollProperties();
361 void setPosition(SbVec2i32& pos);
362 void setSize(int32_t sw, int32_t sh, int32_t smw, int32_t smh, int32_t smmw, int32_t smmh);
363 void updateTopLevelWidgetScrollPosition();
364 void updateAfterSceneGraphChange();
365 virtual void resetSize();
366
367 void setDefaultState();
368 void getDefaultState(SbVec2i32 &size, SbVec2i32 &min, SbVec2i32 &max);
369
370 SoMenuBar* widgetHasMenuBar();
371 void* getLayout();
372 void updateChildren();
373 void updateTopLevelWidget(SbVec2i32 &rSize);
374
375 // Internal child management following inheritance of classes.
376 virtual void internalRemoveChild( int index ) { removeChild(index); }
377 virtual void internalRemoveChild( SoNode *child ) { removeChild(findChild(dynamic_cast<SoTopComponent*>(child))); }
378 virtual void internalRemoveAllChildren() { removeAllChildren(); }
379 virtual void internalAddChild( SoNode *child );
380 virtual int internalFindChild( const SoNode *child ) const;
381 virtual void internalInsertChild( SoNode *child, int newChildIndex );
382 virtual SoNode *internalGetChild( int index) const { return getChild(index); }
383 virtual void internalReplaceChild( int index, SoNode *newChild);
384 virtual void internalReplaceChild( SoNode *oldChild, SoNode *newChild) { replaceChild(dynamic_cast<SoTopComponent*>(oldChild),dynamic_cast<SoTopComponent*>(newChild)); }
385
386 private:
387
388 virtual SoChildList *getChildren() const;
389
390 // Reads stuff into instance of SoGroup. Returns FALSE on error
391 virtual SbBool readInstance(SoInput *in, unsigned short flags);
392
393 // Reads just the children into instance of SoGroup. Returns FALSE on error
394 virtual SbBool readChildren(SoInput *in);
395
396 SoWidget m_baseWidget;
397 SbBool m_buildInside;
398 SoWidget m_topLevelWidget;
399 SoWidget m_topLevelWidgetXt;
400 SoWidget m_topForm;
401
402 virtual ~SoTopLevelDialog();
403 void getDefaultSize(SbVec2i32 &size, SbVec2i32 &min, SbVec2i32 &max);
404 void getSize(SbVec2i32 &size, SbVec2i32 &min, SbVec2i32 &max);
405
406 private:
407 FIELD_SENSOR(minimized);
408 FIELD_SENSOR(margin);
409 FIELD_SENSOR(modalFrame);
410 FIELD_SENSOR(resizable);
411 FIELD_SENSOR(rowSpacing);
412 FIELD_SENSOR(position);
413 FIELD_SENSOR(position3D);
414 FIELD_SENSOR(minimized3DPosition);
415 FIELD_SENSOR(independentMinimizedPosition);
416 FIELD_SENSOR(width);
417 FIELD_SENSOR(height);
418 FIELD_SENSOR(minWidth);
419 FIELD_SENSOR(minHeight);
420 FIELD_SENSOR(maxWidth);
421 FIELD_SENSOR(maxHeight);
422
423 int m_numberOfChildren;
424 SbBool m_firstBuild;
425 SoWidget m_currentFocusedWidget;
426 SoWidget m_currentScrolledWidget;
427 SoWidget m_menu;
428 void* m_layout;
429 SbBool m_isFirstBuild;
430 int m_arrayNumChildren;
431 SbVec2i32* m_childrenMax;
432 SbVec2i32* m_childrenMin;
433 SbVec2i32* m_childrenSize;
434 int m_cptToResize;
435 SbBool m_hScrollVisible;
436 SbBool m_vScrollVisible;
437 SoWidget m_clipWindowXt;
438 SoWidget m_vertSBXt;
439 SoWidget m_horzSBXt;
440 int m_borderWidth;
441 int m_borderHeight;
442 int m_menuHeight;
443 int m_titleHeight;
444
445 SbVec2i32 m_initSize;
446 SbVec2i32 m_initMinSize;
447 SbVec2i32 m_initMaxSize;
448
449 void computeNewChildrenHeight(SbVec2i32 &rSize);
450 void createBaseWidget(SoWidget parent);
451 int m_scrollWidth;
452 void createTopLevelWidget();
453 void initWidgetConstant();
454 void setChildrenComponentSize();
455 void setChildrenLabelSize();
456 void updateBaseWidget();
457 void updateChildrenSizeDB();
458 void computeSize(SbVec2i32 &rSize, SbVec2i32 & pos);
459
460 void changeRowSpacing();
461 void changeResizable();
462 void changeModalFrame();
463 void changePosition();
464 void changeMinMaxSize();
465
466 virtual void changeEnable();
467 virtual void changeLabel();
468 virtual void changeWidth();
469 virtual void changeHeight();
470
471 virtual void applyAuditor(SoDialogViz* dlgCpt);
472
473 virtual void updateFromSensor(SoSensor* sensor);
474 SoDialogAuditor* m_defaultAuditor;
475
477// 3D methods
478private:
479 static char* TopLevelDialog; //Internal default skin.
480 static void change3DSkin();
481 static SbBool isSkinLoaded();
482 static void setSkinLoaded(SbBool loaded);
483
484 virtual void show3D(SbBool show);
485
486private:
487
488 SO_DG_CATALOG_ENTRY_HEADER( frameSep );
489 SO_DG_CATALOG_ENTRY_HEADER( frame );
490 SO_DG_CATALOG_ENTRY_HEADER( labelSep );
491 SO_DG_CATALOG_ENTRY_HEADER( labelProp );
492 SO_DG_CATALOG_ENTRY_HEADER( minSep );
493 SO_DG_CATALOG_ENTRY_HEADER( minSwtch );
494 SO_DG_CATALOG_ENTRY_HEADER( minPressed );
495 SO_DG_CATALOG_ENTRY_HEADER( minReleased );
496
497
498private:
499
500 SbPlaneProjector* m_planeProj;
501 SbVec3f m_worldRestartPt; // used if SHIFT key goes down to
502 SbVec3f m_initialPos;
503 float m_mTopLevelCachedDepth;
504 SbBool m_firstMinimization;
505 static SbBool m_isSkinLoaded;
506
507 SoScale* topLevelFrameScale;
508 SoText3* topLevelLabel;
509 SoTranslation* topLevelFrameTranslation, *topLevelMinTranslation, *topLevelLabelTranslation;
510 SoTransform* topLevelFrameTransform;
511
512 void create3DTopLevelDialog();
513 void update3DTopLevelDialog();
514 void update3DChildren();
515 void update3DChildrenPosition();
516 void update3DLabel();
517
518 void minimize3DDialog();
519 void restore3DDialog();
520 void show3DChildren(SbBool show);
521
522 virtual void change3DLabel();
523 virtual void change3DPosition();
524
525 static void startCB3D( void *, SoDragger *inDragger );
526 void draggerStartCallback3D();
527 static void motionCB3D( void *, SoDragger *inDragger );
528 void draggerMotionCallback3D();
529 static void finishCB3D( void *, SoDragger *inDragger );
530 void draggerFinishCallback3D();
531
532 private:
533 virtual void getBoundingBox(SoGetBoundingBoxAction* action);
534 virtual void rayPick(SoRayPickAction *action);
535 virtual void search(SoSearchAction *action);
536 virtual void write(SoWriteAction *action);
537
539
540};
541
542#endif // _SO_TOP_LEVEL_DIALOG_
543
544
Plane 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> Dialog auditor
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Abstract base cl...
Base class for nodekits that move in response to click-drag-release mouse events.
Definition SoDragger.h:537
Computes bounding box of a scene.
Used to read Open Inventor data files.
Definition SoInput.h:363
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Menu bar node.
Definition SoMenuBar.h:77
Abstract base class for all database nodes.
Definition SoNode.h:145
friend class SoChildList
Definition SoNode.h:473
Intersects objects with a ray cast into scene.
Field containing a single Boolean value.
Definition SoSFBool.h:79
Field containing an enumerated value.
Definition SoSFEnum.h:89
Field containing a int32_t integer.
Definition SoSFInt32.h:80
Field containing a two-dimensional vector.
Definition SoSFVec2i32.h:52
Field containing a three-dimensional vector.
Definition SoSFVec3f.h:80
const SbVec3f & getValue() const
Returns this field's value.
Definition SoSFVec3f.h:82
Node representing a 3D geometric scaling.
Definition SoScale.h:96
SoSFVec3f scaleFactor
The scaling factors in the x, y, and z dimensions.
Definition SoScale.h:107
Searches for nodes in a scene graph.
Abstract base class for Open Inventor sensors.
Definition SoSensor.h:100
3D text shape node.
Definition SoText3.h:204
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Abstract Class f...
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Top Level Dialog...
virtual void removeChild(SoTopComponent *child)
Removes first instance of given child from group.
SoSFVec2i32 position
Window screen coordinates.
void applyAuditors()
Applies all DialogAuditors in the auditor list.
void close()
Destroys the dialog window.
SoSFEnum hScrollVisibility
Controls how horizontal scrollbar appears.
SoSFInt32 maxWidth
Maximum top component width.
virtual void hide()
Hides the topLevelDialog widget.
SoSFEnum vScrollVisibility
Controls how vertical scrollbar appears.
SoSFInt32 height
Preferred height of the top component.
SoSFBool windowResizedByChildren
Controls the window sizing when a child is added or removed.
SoSFInt32 maxHeight
Maximum top component height.
virtual void replaceChild(SoTopComponent *oldChild, SoTopComponent *newChild)
Replaces first instance of given child with new child.
SoSFInt32 minHeight
Minimum top component height.
virtual void addChild(SoTopComponent *child)
Adds a child as last one in group.
virtual void removeAllChildren()
Removes all children from group.
@ NEVER
Scroll bar never displayed.
@ ALWAYS
Scroll bar always visible.
@ AUTO
Automatic scroll bar: displayed when needed (default).
SoTopLevelDialog()
Constructor.
virtual void insertChild(SoTopComponent *child, int newChildIndex)
Adds a child so that it becomes the one with the given index.
void buildDialog(SoWidget parent, SbBool buildInsideParent=FALSE)
Builds the dialog window.
SoSFBool hideChildren
When rendering DialogViz as a scene, children can be hidden while the SoTopLevelDialog frame is movin...
SoSFVec3f minimized3DPosition
Window world coordinate position when rendering in 3D and minimized.
virtual int findChild(const SoTopComponent *child) const
Finds index of given child within group.
SoDialogViz * searchForAuditorId(SbString id)
Retrieves the DialogViz object from the specified auditorID field in an SoTopLevelDialog structure.
SoSFInt32 margin
Margin width.
SoSFBool modalFrame
Sets window property.
SoSFInt32 width
Preferred width of the top component.
SoSFInt32 rowSpacing
Space between each child.
SoSFBool independentMinimizedPosition
Indicates whether minimized and full size dialog have independant 3D position or not.
virtual void replaceChild(int index, SoTopComponent *newChild)
Replaces child with given index with new child.
virtual int getNumChildren() const
Returns number of children.
SoSFBool minimized
Controls and indicates whether the dialog is minimized or not.
SoSFInt32 minWidth
Minimum top component width.
virtual void show()
Shows the tolLevelDialog widget.
virtual void removeChild(int index)
Removes child with given index from group.
SoSFBool resizable
Indicates if the top component can be resized or not, Default is TRUE.
void addAuditor(SoDialogAuditor *auditor)
Adds a dialogAuditor to the current topLevelDialog component.
virtual SoNode * getChild(int index) const
Returns pointer to child node with the given index.
SoSFVec3f position3D
Window world coordinate position when rendering in 3D.
void removeAuditor(SoDialogAuditor *auditor)
Removes the defined DialogAuditor from the auditor list.
General 3D geometric transformation node.
Node representing a 3D translation.
Writes a scene graph to a file.
int SbBool
Boolean type.
Definition SbBase.h:87