00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #ifndef _SO_WIN_COMPONENT_H_
00027 #define _SO_WIN_COMPONENT_H_
00028
00029 #include <Inventor/Win/SoWinBeginStrict.h>
00030 #include <windows.h>
00031 #include <Inventor/Win/SoWin.h>
00032 #include <Inventor/Win/SoWinDef.h>
00033 #include <Inventor/Gui/SoGuiComponent.h>
00034
00035 #include <Inventor/SbLinear.h>
00036 #include <Inventor/SbString.h>
00037
00038 class SbDict;
00039 class SoWinComponent;
00040 class SoCallbackList;
00041 class SoWinComponentP;
00042
00043 typedef void SoWinComponentCB( void* userData, SoWinComponent* comp );
00044 typedef void SoWinComponentVisibilityCB( void* userData, SbBool visibleFlag );
00045
00113 class SoWinComponent
00114 {
00115 friend class SoWinComponentP;
00116
00117 public:
00118 SoDEPRECATED SoNONUNICODE static void displayHelp(const char* filename, UINT contextID);
00133 SoDEPRECATED static void displayHelp(const SbString& filename, UINT contextID);
00146
00153 virtual void show();
00154
00158 virtual void hide();
00159
00170 SbBool isVisible();
00171
00177 SoWidget getWidget() const { return _baseWidget; }
00178
00184 SbBool isTopLevelShell() const { return m_guiComponent->isTopLevelShell(); }
00185
00190 SoWidget getShellWidget() const { return m_guiComponent->isTopLevelShell() ? parentWidget : NULL; }
00191
00195 SoWidget getParentWidget() const { return parentWidget; }
00196
00200 void setSize( const SbVec2s& size );
00201
00205 SbVec2s getSize();
00206
00210 SbBool setFullScreen( const SbBool enable );
00211
00215 SbBool isFullScreen() const;
00216
00222 void setFullScreenEnable( const SbBool enable );
00223
00228 SbBool isFullScreenEnable( void ) const;
00229
00233 UINT* getDisplay() { return NULL; }
00234
00243 SoNONUNICODE void setTitle( const char* newTitle );
00244
00252 void setTitle( const SbString& newTitle );
00253
00257 SbString getTitle() const { return m_guiComponent->getTitle(); }
00258
00263 SoNONUNICODE void setIconTitle( const char* newIconTitle );
00264
00268 void setIconTitle( const SbString& newIconTitle );
00269
00273 SbString getIconTitle() const { return m_guiComponent->getIconTitle(); }
00274
00294 void setWindowCloseCallback( SoWinComponentCB *func, void* data = NULL )
00295 { windowCloseFunc = func; windowCloseData = data; }
00296
00301 static SoWinComponent* getComponent( SoWidget w );
00302
00307 SbString getWidgetName() const { return m_guiComponent->getWidgetName(); }
00308
00313 SbString getClassName() const { return m_guiComponent->getClassName(); }
00314
00319 SbString helpFileName;
00320
00325 UINT helpContextID;
00326
00331 SbString helpContextString;
00332
00334 virtual ~SoWinComponent();
00335
00336 private:
00337
00338
00339 SoWidget baseWidget() const { return getWidget(); }
00340
00341 static void exitClass();
00342
00343
00344 SoGuiComponent* getGuiComponent() const;
00345
00346 private:
00347
00348
00349
00350
00351
00352
00353
00354
00355
00356
00357
00358
00359
00360
00361
00362
00363
00364
00365
00366
00367
00368 SoWinComponent( SoWidget parent = NULL,
00369 const SbString& name = "",
00370 SbBool buildInsideParent = TRUE,
00371 SbBool sync = TRUE );
00372
00373 SoWinComponent( SoWidget parent,
00374 const SbString& name,
00375 SbBool buildInsideParent,
00376 SbBool sync,
00377 SoGuiComponent* guiComponent );
00378
00379
00380
00381 void setBaseWidget( SoWidget w );
00382
00383
00384
00385 void setClassName( const SbString& n ) { m_guiComponent->setClassName( n ); }
00386
00387
00388
00389
00390
00391
00392
00393 virtual void windowCloseAction();
00394
00395
00396
00397
00398 virtual void afterRealizeHook();
00399 SbBool firstRealize;
00400
00401
00402
00403
00404
00405
00406
00407 virtual SbString getDefaultWidgetName() const;
00408 virtual SbString getDefaultTitle() const;
00409 virtual SbString getDefaultIconTitle() const;
00410
00411
00412
00413
00414
00415
00416
00417
00418
00419
00420
00421
00422
00423
00424 void registerWidget( SoWidget w );
00425 void unregisterWidget( SoWidget w );
00426
00427
00428
00429
00430
00431 void addVisibilityChangeCallback( SoWinComponentVisibilityCB* func,
00432 void* userData = NULL );
00433 void removeVisibilityChangeCallback( SoWinComponentVisibilityCB* func,
00434 void* userData = NULL );
00435
00436
00437
00438
00439
00440
00441
00442
00443
00444
00446
00453 static void openHelpPage( const SbString& helpPage );
00454
00455
00457
00458 SoWidget buildFormWidget( SoWidget parent );
00459
00460 void setResize( SbBool nResize ) { m_nResizeBaseWidget = nResize; }
00461 SbBool getResize() { return m_nResizeBaseWidget ; }
00462
00463
00464 static HPALETTE _setupColorPalette( HDC );
00465
00466 void unSubclassDialog( Hwnd hWnd );
00467 void subclassDialog( Hwnd hWnd );
00468 void drawDialogIcon( Hwnd hWnd );
00469
00470 static LRESULT CALLBACK dlgWndProc( Hwnd hwnd, UINT message,
00471 WPARAM wParam, LPARAM lParam );
00472 static Hwnd getMDIAncestor( Hwnd win );
00473
00474
00475
00476 SbBool m_nParentIsMDI;
00477
00478 HICON hDlgIcon;
00479
00480 char* windowName;
00481 SbBool buildInside;
00482
00483 static void widgetStructureNotifyCB( SoWidget w, SoWinComponent* c, XEvent* e, Boolean* b );
00484 static void windowCloseActionCB(SoWidget, SoWinComponent *, void *);
00485 static int ChoosePixelFormatOIV( HDC hdc, int pixelType, int glModes, PIXELFORMATDESCRIPTOR* pfd );
00486
00487 private:
00488
00489 void constructorCommon( SoWidget parent, const SbString& name, SbBool buildInsideParent, SbBool sync );
00490
00491
00492
00493
00494
00495 virtual void widgetDestroyed();
00496
00497 SbBool createdShell;
00498 SoWidget parentWidget;
00499 SoWidget _baseWidget;
00500 SbVec2s size;
00501
00502
00503 SbBool visibleState;
00504 SbBool ShellMapped, widgetMapped;
00505 SoCallbackList *visibiltyCBList;
00506 void checkForVisibilityChange();
00507
00508
00509 SbVec2s viewerPos;
00510 SbVec2s viewerSize;
00511 long style, extStyle;
00512
00513 static void shellStructureNotifyCB( SoWidget w, SoWinComponent* c, XEvent* e, Boolean* b );
00514 static void widgetDestroyedCB( SoWidget w, XtPointer p1, XtPointer p2 );
00515
00516
00517 SoWinComponentCB* windowCloseFunc;
00518 void* windowCloseData;
00519
00520
00521
00522 static SbDict* widgetDictionary;
00523
00524
00525
00526 WNDPROC parentWndProc;
00527 WNDPROC origDlgWndProc;
00528
00529
00530
00531 SbBool m_nResizeBaseWidget;
00532
00533 static void OnWmSize( Hwnd hwnd, UINT message,
00534 WPARAM wParam, LPARAM lParam );
00535 static void OnWmPaint( Hwnd hwnd, UINT message,
00536 WPARAM wParam, LPARAM lParam );
00537 static void OnWmDestroy( Hwnd hwnd, UINT message,
00538 WPARAM wParam, LPARAM lParam );
00539
00540
00541 static LRESULT CALLBACK componentWndProc( Hwnd hwnd, UINT message,
00542 WPARAM wParam, LPARAM lParam );
00543 static LRESULT CALLBACK formWindowProc( Hwnd hwnd, UINT message,
00544 WPARAM wParam, LPARAM lParam );
00545
00546
00547 SoGuiComponent* m_guiComponent;
00548 };
00549
00550 #include <Inventor/Win/SoWinEndStrict.h>
00551
00552 #endif // _SO_WIN_COMPONENT_H_
00553
00554