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
00027 #ifndef _SO_WIN_MP_FULL_VIEWER_
00028 #define _SO_WIN_MP_FULL_VIEWER_
00029
00030 #if defined(_WIN32)
00031 # include <Inventor/Win/SoWinBeginStrict.h>
00032 #endif
00033 #include <Inventor/MP/Win/viewers/SoWinMPViewer.h>
00034 #include <Inventor/SbPList.h>
00035
00036
00037 class SoFieldSensor;
00038 class SoWinBitmapButton;
00039
00040 #if defined(_WIN32)
00041 class SoWinGDIThumbWheel;
00042 #else
00043 class SoWinResource;
00044 #endif
00045
00046 # if defined(_WIN32)
00047 class SoStereoDialog;
00048 # endif
00049
00050 typedef void PushAppButtonCB(SoWidget w, int id, void *pushData, void *userData);
00051 typedef void RedrawAppButtonCB(LPDRAWITEMSTRUCT lpdis, void *userData) ;
00052
00054
00055
00056
00057
00058
00059
00060
00061
00063
00080 class SoWinMPFullViewer : public SoWinMPViewer {
00081 public:
00083 enum BuildFlag {
00087 BUILD_NONE = 0x00,
00091 BUILD_DECORATION = 0x01,
00095 BUILD_POPUP = 0x02,
00099 BUILD_ALL = 0xff,
00100 };
00101
00102
00103
00104
00105 void setDecoration(SbBool onOrOff);
00106 SbBool isDecoration() { return decorationFlag; }
00107
00138 void setPopupMenuEnabled(SbBool trueOrFalse);
00139 SbBool isPopupMenuEnabled() { return popupEnabled; }
00140
00141
00142
00143
00144
00145 static void setDoButtonBar(SbBool onOrOff);
00146 static SbBool isDoButtonBar() { return SoWinMPFullViewer::doButtonBar; }
00147
00159 SoCallbackList popupPostCallback;
00160
00168 SoCallbackList popupPreCallback;
00169
00170
00171
00172 void setClientPopupMenu(Hmenu hmenu);
00173
00174
00175 SbBool isClientPopupMenuInstalled() {return (hClientPopup!= NULL);};
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194 SoWidget getAppPushButtonParent() const { return appButtonForm; }
00195 void addAppPushButton(SoWidget newButton);
00196 void insertAppPushButton(SoWidget newButton, int index);
00197 void removeAppPushButton(SoWidget oldButton);
00198 int findAppPushButton(SoWidget oldButton)
00199 { return appButtonList->find(oldButton); }
00200 int lengthAppPushButton()
00201 { return appButtonList->getLength(); }
00202
00203 SoWidget getRenderAreaWidget() { return raWidget; }
00204
00205
00206 virtual void setViewing(SbBool onOrOff);
00207 virtual void setCamera(SoCamera *cam);
00208 virtual void hide();
00209 virtual void setHeadlight(SbBool onOrOff);
00210 virtual void setDrawStyle(SoWinMPViewer::DrawType type,
00211 SoWinMPViewer::DrawStyle style);
00212 virtual void setBufferingType(SoWinMPViewer::BufferType type);
00213
00214
00215 SoStereoDialog *getStereoDialog()
00216 { return stereoDialogBox; }
00217 void setStereoDialog( SoStereoDialog *newDialog )
00218 { stereoDialogBox = newDialog; }
00219
00223 Hmenu rootPopup, mainPopup, funcPopup, drawPopup, prefPopup;
00224
00229 UINT curPopupDrawItem, curPopupMoveItem, curPopupBufferItem;
00230
00234 Hmenu hClientPopup;
00235
00236 void addPushAppButtonCallback(PushAppButtonCB *cb, void * data = NULL) {
00237 customPushBtnCB = cb;
00238 customPushBtnData = data;
00239 }
00240 void addRedrawAppButtonCallback(RedrawAppButtonCB *cb, void * data = NULL) {
00241 customRedrawBtnCB = cb;
00242 customRedrawBtnData = data;
00243 }
00244
00245 private:
00246 virtual ~SoWinMPFullViewer();
00247
00248 private:
00249
00250 SoWinMPFullViewer(SoWidget parent,
00251 const char *name,
00252 SbBool buildInsideParent,
00253 BuildFlag flag,
00254 SoWinMPViewer::Type type,
00255 SbBool buildNow);
00256
00257
00258 SbBool decorationFlag;
00259 SoWidget mgrWidget;
00260 SoWidget raWidget;
00261 SoWidget leftTrimForm, bottomTrimForm, rightTrimForm;
00262
00263 static SbBool doButtonBar;
00264
00265
00266 SoWidget zoomForm, zoomField, zoomSlider;
00267 SoFieldSensor *zoomSensor;
00268
00269
00270 #if defined(_WIN32)
00271
00272
00273
00274
00275
00276 SoWinGDIThumbWheel *rightWheel, *bottomWheel,
00277 *leftWheel , *extraWheel;
00278
00279 SoWidget extraTrimForm;
00280 float extraWheelVal;
00281 char *extraWheelStr;
00282 int extraLabelHeight;
00283 SoWidget extraWheelLabel;
00284
00285
00286
00287 SoWidget vwrButtonForm;
00288
00289 HBRUSH backgroundBrush;
00290 #else
00291 SoWidget rightWheel, bottomWheel, leftWheel;
00292 #endif // _WIN32
00293 char *rightWheelStr, *bottomWheelStr, *leftWheelStr;
00294 float rightWheelVal, bottomWheelVal, leftWheelVal;
00295 SoWidget rightWheelLabel, bottomWheelLabel, leftWheelLabel;
00296
00297
00298 SbPList *viewerButtonWidgets;
00299 #if defined(_WIN32)
00300
00301
00302
00303
00304 int numFullVwrButtons;
00305
00306
00307
00308
00309 virtual void pushButtonCB(SoWidget, int id, void *);
00310
00311
00312
00313
00314
00315
00316
00317
00318
00319
00320 virtual void pushAppButtonCB(SoWidget w, int id, void *data) {
00321 if (customPushBtnCB)
00322 customPushBtnCB(w, id, data, customPushBtnData);
00323 }
00324
00325
00326
00327
00328
00329
00330 virtual void redrawAppButtonCB(LPDRAWITEMSTRUCT lpdis) {
00331 if (customRedrawBtnCB)
00332 customRedrawBtnCB(lpdis, customRedrawBtnData) ;
00333 }
00334
00335 #endif
00336
00337
00338
00339 SoWidget getButtonWidget() const { return appButtonForm; }
00340
00341
00342 SbBool popupEnabled;
00343 SoWidget popupWidget, *popupToggleWidgets;
00344 SoWidget *drawStyleWidgets, bufferStyleWidgets[3];
00345 char *popupTitle;
00346
00347
00348
00349
00350 SoWidget buildWidget(SoWidget parent);
00351 void buildLeftWheel(SoWidget parent);
00352
00353 virtual void buildDecoration(SoWidget parent);
00354 virtual SoWidget buildLeftTrim(SoWidget parent);
00355 virtual SoWidget buildBottomTrim(SoWidget parent);
00356 virtual SoWidget buildRightTrim(SoWidget parent);
00357 virtual SoWidget buildZoomSlider(SoWidget parent);
00358 SoWidget buildAppButtons(SoWidget parent);
00359 SoWidget buildViewerButtons(SoWidget parent);
00360 virtual void createViewerButtons(SoWidget parent);
00361
00362
00363
00364
00365 virtual void buildPopupMenu();
00366 virtual void openStereoDialog();
00367
00368 virtual void destroyPopupMenu();
00369 void setPopupMenuString(const char *name);
00370 SoWidget buildFunctionsSubmenu(SoWidget popup);
00371 SoWidget buildDrawStyleSubmenu(SoWidget popup);
00372 #if defined(_WIN32)
00373
00374
00375 virtual int displayPopupMenu( int x, int y, Hwnd owner );
00376 #endif
00377
00378
00379
00380
00381 void setPrefSheetString(const char *name);
00382 virtual void createPrefSheet();
00383 void createPrefSheetShellAndForm(SoWidget &shell, SoWidget &form);
00384 void createDefaultPrefSheetParts(SoWidget widgetList[],
00385 int &num, SoWidget form);
00386 void layoutPartsAndMapPrefSheet(SoWidget widgetList[],
00387 int num, SoWidget form, SoWidget shell);
00388 SoWidget createSeekPrefSheetGuts(SoWidget parent);
00389 SoWidget createSeekDistPrefSheetGuts(SoWidget parent);
00390 SoWidget createZoomPrefSheetGuts(SoWidget parent);
00391 SoWidget createClippingPrefSheetGuts(SoWidget parent);
00392 SoWidget createStereoPrefSheetGuts(SoWidget parent);
00393
00394
00395
00396
00397 virtual void rightWheelMotion(float);
00398 virtual void bottomWheelMotion(float);
00399 virtual void leftWheelMotion(float);
00400
00401
00402
00403
00404 virtual void rightWheelStart();
00405 virtual void bottomWheelStart();
00406 virtual void leftWheelStart();
00407 virtual void rightWheelFinish();
00408 virtual void bottomWheelFinish();
00409 virtual void leftWheelFinish();
00410
00411
00412
00413
00414 void setBottomWheelString(const char *name);
00415 void setLeftWheelString(const char *name);
00416 void setRightWheelString(const char *name);
00417
00418
00419
00420
00421
00422 virtual void openViewerHelpCard();
00423
00424
00425 virtual void afterRealizeHook();
00426
00427 virtual void setSeekButton(SbBool onOff);
00428
00429 private:
00430 SbBool firstBuild;
00431
00432
00433 SoWidget appButtonForm;
00434 SbPList *appButtonList;
00435 void doAppButtonLayout(int start);
00436
00437 SoStereoDialog *stereoDialogBox;
00438
00439
00440 SbVec2f zoomSldRange;
00441 void setCameraZoom(float zoom);
00442 float getCameraZoom();
00443 void setZoomSliderPosition(float zoom);
00444 void setZoomFieldString(float zoom);
00445
00446 static void zoomSliderCB(SoWidget, SoWinMPFullViewer *, XtPointer *);
00447 static void zoomFieldCB(SoWidget, SoWinMPFullViewer *, XtPointer *);
00448
00449 static void zoomSensorCB(void *, SoSensor *);
00450
00451
00452 SoWinBitmapButton *buttonList[10];
00453
00454
00455 SoWidget prefSheetShellWidget;
00456 char *prefSheetStr;
00457
00458
00459 int seekDistWheelVal;
00460 SoWidget seekDistField;
00461
00462
00463 SoWidget clipWheelForm;
00464 int clipNearWheelVal, clipFarWheelVal;
00465 SoWidget clipNearField, clipFarField;
00466
00467
00468 SoWidget stereoWheelForm, stereoField, stereoLabel;
00469 int stereoWheelVal;
00470
00471
00472
00473 static void visibilityChangeCB(void *pt, SbBool visible);
00474
00475
00476 static void rightWheelCB ( SoWinMPFullViewer *v, XtPointer *d );
00477 static void bottomWheelCB( SoWinMPFullViewer *v, XtPointer *d );
00478 static void leftWheelCB ( SoWinMPFullViewer *v, XtPointer *d );
00479
00480
00481 static LRESULT CALLBACK mgrWindowProc( Hwnd hwnd, UINT message,
00482 WPARAM wParam, LPARAM lParam );
00483
00484
00485 static LRESULT CALLBACK btnWindowProc( Hwnd hwnd, UINT message,
00486 WPARAM wParam, LPARAM lParam );
00487
00488
00489 static LRESULT CALLBACK appBtnWindowProc( Hwnd hwnd, UINT message,
00490 WPARAM wParam, LPARAM lParam );
00491
00492
00493 static LRESULT CALLBACK txtWindowProc( Hwnd hwnd, UINT message,
00494 WPARAM wParam, LPARAM lParam );
00495
00496 PushAppButtonCB *customPushBtnCB;
00497 RedrawAppButtonCB *customRedrawBtnCB;
00498 void *customPushBtnData, *customRedrawBtnData;
00499
00500
00501 WNDPROC origBtnWndProc;
00502 WNDPROC origAppBtnWndProc;
00503 WNDPROC origTxtWndProc;
00504
00505
00506
00507 static void drawDecorations( SoWinMPFullViewer *p, Hwnd hwnd, Hdc hdc );
00508
00509 };
00510
00511 #include <Inventor/Win/SoWinEndStrict.h>
00512
00513
00514 #endif
00515
00516