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