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_TOP_LEVEL_DIALOG_
00024 #define _SO_TOP_LEVEL_DIALOG_
00025
00026 #include <DialogViz/dialog/SoDialogViz.h>
00027 #include <DialogViz/dialog/SoTopComponent.h>
00028 #include <Inventor/fields/SoSFInt32.h>
00029 #include <Inventor/fields/SoSFVec2i32.h>
00030 #include <Inventor/fields/SoSFBool.h>
00031 #include <Inventor/fields/SoSFEnum.h>
00032
00033 class SbPlaneProjector;
00034 class SoDialogAuditor;
00035 class SoText3;
00036 class SoTranslation;
00037 class SoTransform;
00038 class SoScale;
00039
00040 class SoMenuBar;
00041
00110 class SoTopLevelDialog : public SoDialogViz
00111 {
00112 SO_DG_HEADER(SoTopLevelDialog);
00113
00114 public:
00115
00121 SoSFInt32 width;
00122
00128 SoSFInt32 height;
00129
00130
00134 SoSFVec2i32 position;
00135
00139 SoSFVec3f position3D;
00140
00144 SoSFVec3f minimized3DPosition;
00145
00149 SoSFBool resizable;
00150
00155 SoSFBool minimized;
00156
00161 SoSFBool independentMinimizedPosition;
00162
00167 SoSFInt32 minWidth;
00168
00173 SoSFInt32 maxWidth;
00174
00179 SoSFInt32 minHeight;
00180
00185 SoSFInt32 maxHeight;
00186
00190 SoSFInt32 margin;
00191
00195 SoSFInt32 rowSpacing;
00196
00197 enum ScrollVisibility {
00199 NEVER,
00201 ALWAYS,
00203 AUTO
00204 };
00205
00209 SoSFEnum vScrollVisibility;
00210
00214 SoSFEnum hScrollVisibility;
00215
00220 SoSFBool windowResizedByChildren;
00221
00226 SoSFBool modalFrame;
00227
00235 SoSFBool hideChildren;
00236
00240 SoTopLevelDialog();
00241
00248 void buildDialog(SoWidget parent, SbBool buildInsideParent = FALSE);
00249
00253 void close();
00254
00258 virtual void show();
00259
00263 virtual void hide();
00264
00268 void addAuditor(SoDialogAuditor* auditor);
00269
00273 void removeAuditor(SoDialogAuditor* auditor);
00274
00278 void applyAuditors();
00279
00284 SoDialogViz* searchForAuditorId(SbString id);
00285
00289 virtual void addChild(SoTopComponent *child);
00290
00294 virtual void insertChild(SoTopComponent *child, int newChildIndex);
00295
00299 virtual SoNode *getChild(int index) const;
00300
00304 virtual int getNumChildren() const;
00305
00309 virtual int findChild(const SoTopComponent *child) const;
00310
00314 virtual void removeChild(int index);
00315
00319 virtual void removeChild(SoTopComponent *child);
00320
00324 virtual void removeAllChildren();
00325
00329 virtual void replaceChild(int index, SoTopComponent *newChild);
00330
00334 virtual void replaceChild(SoTopComponent *oldChild, SoTopComponent *newChild);
00335
00336
00337 private:
00338
00339
00340 void updateMinimizedState();
00341
00342
00343 SbVec3f getTopLevelSize(){ return topLevelFrameScale->scaleFactor.getValue();}
00344
00345 void buildWidget(SoWidget parent, SbVec2i32 &, SbVec2i32 &, SbBool isActive2d);
00346 void updateDialogBuild(SbBool is2dRender);
00347 void fixSizeWithBorder(SbVec2i32 &size, int revert = 1);
00348 SoWidget getBaseWidget() {return m_baseWidget;};
00349 SoWidget getWidget();
00350
00351 static void initClass();
00352 static void exitClass();
00353
00354 void setCurrentFocusedWidget(SoWidget widget);
00355 void setCurrentScrolledWidget(SoWidget widget);
00356 SoWidget getCurrentScrolledWidget();
00357 SoWidget getCurrentFocusedWidget();
00358
00359 SbBool destroyDialog();
00360 void setScrollProperties();
00361 void setPosition(SbVec2i32& pos);
00362 void setSize(int32_t sw, int32_t sh, int32_t smw, int32_t smh, int32_t smmw, int32_t smmh);
00363 void updateTopLevelWidgetScrollPosition();
00364 void updateAfterSceneGraphChange();
00365 virtual void resetSize();
00366
00367 void setDefaultState();
00368 void getDefaultState(SbVec2i32 &size, SbVec2i32 &min, SbVec2i32 &max);
00369
00370 SoMenuBar* widgetHasMenuBar();
00371 void* getLayout();
00372 void updateChildren();
00373 void updateTopLevelWidget(SbVec2i32 &rSize);
00374
00375
00376 virtual void internalRemoveChild( int index ) { removeChild(index); }
00377 virtual void internalRemoveChild( SoNode *child ) { removeChild(findChild(dynamic_cast<SoTopComponent*>(child))); }
00378 virtual void internalRemoveAllChildren() { removeAllChildren(); }
00379 virtual void internalAddChild( SoNode *child );
00380 virtual int internalFindChild( const SoNode *child ) const;
00381 virtual void internalInsertChild( SoNode *child, int newChildIndex );
00382 virtual SoNode *internalGetChild( int index) const { return getChild(index); }
00383 virtual void internalReplaceChild( int index, SoNode *newChild);
00384 virtual void internalReplaceChild( SoNode *oldChild, SoNode *newChild) { replaceChild(dynamic_cast<SoTopComponent*>(oldChild),dynamic_cast<SoTopComponent*>(newChild)); }
00385
00386 private:
00387
00388 virtual SoChildList *getChildren() const;
00389
00390
00391 virtual SbBool readInstance(SoInput *in, unsigned short flags);
00392
00393
00394 virtual SbBool readChildren(SoInput *in);
00395
00396 SoWidget m_baseWidget;
00397 SbBool m_buildInside;
00398 SoWidget m_topLevelWidget;
00399 SoWidget m_topLevelWidgetXt;
00400 SoWidget m_topForm;
00401
00402 virtual ~SoTopLevelDialog();
00403 void getDefaultSize(SbVec2i32 &size, SbVec2i32 &min, SbVec2i32 &max);
00404 void getSize(SbVec2i32 &size, SbVec2i32 &min, SbVec2i32 &max);
00405
00406 private:
00407 FIELD_SENSOR(minimized);
00408 FIELD_SENSOR(margin);
00409 FIELD_SENSOR(modalFrame);
00410 FIELD_SENSOR(resizable);
00411 FIELD_SENSOR(rowSpacing);
00412 FIELD_SENSOR(position);
00413 FIELD_SENSOR(position3D);
00414 FIELD_SENSOR(minimized3DPosition);
00415 FIELD_SENSOR(independentMinimizedPosition);
00416 FIELD_SENSOR(width);
00417 FIELD_SENSOR(height);
00418 FIELD_SENSOR(minWidth);
00419 FIELD_SENSOR(minHeight);
00420 FIELD_SENSOR(maxWidth);
00421 FIELD_SENSOR(maxHeight);
00422
00423 int m_numberOfChildren;
00424 SbBool m_firstBuild;
00425 SoWidget m_currentFocusedWidget;
00426 SoWidget m_currentScrolledWidget;
00427 SoWidget m_menu;
00428 void* m_layout;
00429 SbBool m_isFirstBuild;
00430 int m_arrayNumChildren;
00431 SbVec2i32* m_childrenMax;
00432 SbVec2i32* m_childrenMin;
00433 SbVec2i32* m_childrenSize;
00434 int m_cptToResize;
00435 SbBool m_hScrollVisible;
00436 SbBool m_vScrollVisible;
00437 SoWidget m_clipWindowXt;
00438 SoWidget m_vertSBXt;
00439 SoWidget m_horzSBXt;
00440 int m_borderWidth;
00441 int m_borderHeight;
00442 int m_menuHeight;
00443 int m_titleHeight;
00444
00445 SbVec2i32 m_initSize;
00446 SbVec2i32 m_initMinSize;
00447 SbVec2i32 m_initMaxSize;
00448
00449 void computeNewChildrenHeight(SbVec2i32 &rSize);
00450 void createBaseWidget(SoWidget parent);
00451 int m_scrollWidth;
00452 void createTopLevelWidget();
00453 void initWidgetConstant();
00454 void setChildrenComponentSize();
00455 void setChildrenLabelSize();
00456 void updateBaseWidget();
00457 void updateChildrenSizeDB();
00458 void computeSize(SbVec2i32 &rSize, SbVec2i32 & pos);
00459
00460 void changeRowSpacing();
00461 void changeResizable();
00462 void changeModalFrame();
00463 void changePosition();
00464 void changeMinMaxSize();
00465
00466 virtual void changeEnable();
00467 virtual void changeLabel();
00468 virtual void changeWidth();
00469 virtual void changeHeight();
00470
00471 virtual void applyAuditor(SoDialogViz* dlgCpt);
00472
00473 virtual void updateFromSensor(SoSensor* sensor);
00474 SoDialogAuditor* m_defaultAuditor;
00475
00477
00478 private:
00479 static char* TopLevelDialog;
00480 static void change3DSkin();
00481 static SbBool isSkinLoaded();
00482 static void setSkinLoaded(SbBool loaded);
00483
00484 virtual void show3D(SbBool show);
00485
00486 private:
00487
00488 SO_DG_CATALOG_ENTRY_HEADER( frameSep );
00489 SO_DG_CATALOG_ENTRY_HEADER( frame );
00490 SO_DG_CATALOG_ENTRY_HEADER( labelSep );
00491 SO_DG_CATALOG_ENTRY_HEADER( labelProp );
00492 SO_DG_CATALOG_ENTRY_HEADER( minSep );
00493 SO_DG_CATALOG_ENTRY_HEADER( minSwtch );
00494 SO_DG_CATALOG_ENTRY_HEADER( minPressed );
00495 SO_DG_CATALOG_ENTRY_HEADER( minReleased );
00496
00497
00498 private:
00499
00500 SbPlaneProjector* m_planeProj;
00501 SbVec3f m_worldRestartPt;
00502 SbVec3f m_initialPos;
00503 float m_mTopLevelCachedDepth;
00504 SbBool m_firstMinimization;
00505 static SbBool m_isSkinLoaded;
00506
00507 SoScale* topLevelFrameScale;
00508 SoText3* topLevelLabel;
00509 SoTranslation* topLevelFrameTranslation, *topLevelMinTranslation, *topLevelLabelTranslation;
00510 SoTransform* topLevelFrameTransform;
00511
00512 void create3DTopLevelDialog();
00513 void update3DTopLevelDialog();
00514 void update3DChildren();
00515 void update3DChildrenPosition();
00516 void update3DLabel();
00517
00518 void minimize3DDialog();
00519 void restore3DDialog();
00520 void show3DChildren(SbBool show);
00521
00522 virtual void change3DLabel();
00523 virtual void change3DPosition();
00524
00525 static void startCB3D( void *, SoDragger *inDragger );
00526 void draggerStartCallback3D();
00527 static void motionCB3D( void *, SoDragger *inDragger );
00528 void draggerMotionCallback3D();
00529 static void finishCB3D( void *, SoDragger *inDragger );
00530 void draggerFinishCallback3D();
00531
00532 private:
00533 virtual void getBoundingBox(SoGetBoundingBoxAction* action);
00534 virtual void rayPick(SoRayPickAction *action);
00535 virtual void search(SoSearchAction *action);
00536 virtual void write(SoWriteAction *action);
00537
00539
00540 };
00541
00542 #endif // _SO_TOP_LEVEL_DIALOG_
00543
00544
00545