Open Inventor Release 2024.2.1
 
Loading...
Searching...
No Matches
SoWinFullViewer.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-2024 BY FEI S.A.S, ***
17 *** BORDEAUX, FRANCE ***
18 *** ALL RIGHTS RESERVED ***
19**=======================================================================*/
20/*=======================================================================
21** Author : VSG (MMM YYYY)
22**=======================================================================*/
23
24
25
26#ifndef _SO_WIN_FULL_VIEWER_
27#define _SO_WIN_FULL_VIEWER_
28
29#include <Inventor/Win/SoWinBeginStrict.h>
30
31#include <Inventor/Win/viewers/SoWinViewer.h>
32#include <Inventor/SbPList.h>
33#include <Inventor/Gui/viewers/SoGuiFullViewer.h>
34
35// classes used
36class SoFieldSensor;
37class SoWinBitmapButton;
38class SoWinGDIThumbWheel;
39class SoStereoDialog;
40
42typedef void PushAppButtonCB( SoWidget w, int id, void* pushData, void* userData );
44typedef void RedrawAppButtonCB( LPDRAWITEMSTRUCT lpdis, void* userData ) ;
45
47//
48// Class: SoWinFullViewer
49//
50// The SoWinFullViewer component class is the abstract base class for all
51// viewers which include a decoration around the rendering area. The
52// decoration is made of thumbwheels, sliders and push/toggle buttons. There
53// is also a popup menu which includes all of the viewing options and methods.
54//
56
82{
83 public:
84
87 {
91 BUILD_NONE = 0x00,
99 BUILD_POPUP = 0x02,
103 BUILD_ALL = 0xff,
104 };
105
113 void setDecoration( SbBool onOrOff );
114
118 SbBool isDecoration() { return m_guiFullViewer->isDecoration(); }
119
150 void setPopupMenuEnabled( SbBool trueOrFalse );
151
156 SbBool isPopupMenuEnabled() { return m_guiFullViewer->isPopupMenuEnabled(); }
157
162 static void setDoButtonBar( SbBool onOrOff );
163
168 static SbBool isDoButtonBar() { return SoWinFullViewer::doButtonBar; }
169
182
191
196 void setClientPopupMenu( Hmenu hmenu );
197
203
207 SoWidget getAppPushButtonParent() const { return appButtonForm; }
208
218 void addAppPushButton( SoWidget newButton );
219
229 void insertAppPushButton( SoWidget newButton, int index );
230
234 void removeAppPushButton( SoWidget oldButton );
235
239 int findAppPushButton( SoWidget oldButton ) { return appButtonList->find( oldButton ); }
240
244 int lengthAppPushButton() { return appButtonList->getLength(); }
245
249 SoWidget getRenderAreaWidget() { return raWidget; }
250
251 // redefine these from the base class
252 virtual void setViewing( SbBool onOrOff );
253 virtual void setCamera( SoCamera* cam );
254 virtual void hide();
255
256 // Allow app, eg. 3SA, to control this if desired.
257 SoStereoDialog* getStereoDialog() { return stereoDialogBox; }
258 void setStereoDialog( SoStereoDialog *newDialog ) { stereoDialogBox = newDialog; }
259
263 Hmenu rootPopup;
264
268 Hmenu mainPopup;
269
274
279
284
292
293 /*
294 * Tracks the checkmark for "Moving" draw style.
295 */
297
298 /*
299 * Tracks the checkmark for the buffering draw style.
300 */
302
307
308 void addPushAppButtonCallback( PushAppButtonCB* cb, void* data = NULL )
309 {
310 customPushBtnCB = cb;
311 customPushBtnData = data;
312 }
313 void addRedrawAppButtonCallback( RedrawAppButtonCB* cb, void* data = NULL )
314 {
315 customRedrawBtnCB = cb;
316 customRedrawBtnData = data;
317 }
318
319 private:
320 virtual ~SoWinFullViewer();
321
322 SoGuiFullViewer* getGuiFullViewer() const;
323
324 // retro compatibilty, don't use them directly. Call their accessors.
325 float rightWheelVal, leftWheelVal, bottomWheelVal;
326 SbBool popupEnabled;
327
328 private:
329 // Constructor/Destructor
330 SoWinFullViewer( SoWidget parent,
331 const char* name,
332 SbBool buildInsideParent,
333 SoWinFullViewer::BuildFlag flag, //Removed class name qualifier from enum --mmh
334 SoWinViewer::Type type,
335 SbBool buildNow,
336 SbBool sync );
337
338 SoWinFullViewer( SoWidget parent,
339 const char* name,
340 SbBool buildInsideParent,
342 SoWinViewer::Type type,
343 SbBool buildNow,
344 SbBool sync,
345 SoGuiFullViewer* guiFullViewer );
346
347 // general decoration vars
348 SbBool decorationFlag;
349 SoWidget mgrWidget; // form which manages all other widgets
350 SoWidget raWidget; // render area widget
351 SoWidget leftTrimForm, bottomTrimForm, rightTrimForm;
352
353 static SbBool doButtonBar;
354
355 int SO_WHEEL_DELTA;
356
357 // zoom slider vars
358 SoWidget zoomForm, zoomField, zoomSlider;
359 SoFieldSensor* zoomSensor; // attached to camera zoom field
360
361 // thumb wheel vars
362
363 // For _WIN32 use frame window to hold instance of thumbwheel class.
364 // Note: The "extra" wheel is only used by certain viewers, eg. the
365 // Walk viewer has a "Height" wheel. It always appears above
366 // the left wheel. This is a little more complicated under
367 // Windows because there's no such thing as a "form widget". :-)
368 SoWinGDIThumbWheel* rightWheel, *bottomWheel, *leftWheel , *extraWheel;
369
370 SoWidget extraTrimForm;
371 float extraWheelVal;
372 char* extraWheelStr;
373 int extraLabelHeight;
374 SoWidget extraWheelLabel; //Handle of static control
375
376 // static control that contains all the viewer
377 // buttons on the right side
378 SoWidget vwrButtonForm;
379
380 HBRUSH backgroundBrush; //Used to paint control bkgds
381
382 char* rightWheelStr, *bottomWheelStr, *leftWheelStr;
383 SoWidget rightWheelLabel, bottomWheelLabel, leftWheelLabel;
384
385 // widget list of viewer buttons
386 SbPList* viewerButtonWidgets;
387
388 // For _WIN32 we have to use a slightly more complicated scheme to
389 // allow subclasses to add their own buttons. The viewerButtonWidgets
390 // list includes both the "standard" FullVwr buttons and the subClass
391 // buttons, so we need to remember how many are the FullVwr buttons.
392 int numFullVwrButtons;
393
394 // Subclasses should override this function (in addition to
395 // createViewerButtons), handle selection if it's a button they
396 // added and if not kick it back up to this function.
397 virtual void pushButtonCB( SoWidget w, int id, void* data );
398
399 // We need this with WINxx to transmit events when they occur on
400 // appButtonForm. Note that data contains the code (type HIWORD)
401 // of the event that can be one of BN_DBLCLK, BN_DOUBLECLICKED,
402 // BN_CLICKED, BN_PUSHED, BN_UNPUSHED
403 // An application willing not to use this callback, will need
404 // to assign another window proc to appButtonForm.
405 // For UNIX, the application only need to assign a callback to
406 // each button.
407 // The default behaviour is to call a custom callback
408 virtual void pushAppButtonCB( SoWidget w, int id, void* data )
409 {
410 if ( customPushBtnCB )
411 customPushBtnCB( w, id, data, customPushBtnData );
412 }
413
414 // subclasses should override this function or add a custom
415 // redraw callback (see addRedrawAppButtonCallback) in order to
416 // specify the redraw behaviour of the application buttons. Note
417 // that the widget concerned by the call to this callback
418 // function can be obtained with lpdis->hwndItem
419 virtual void redrawAppButtonCB( LPDRAWITEMSTRUCT lpdis )
420 {
421 if ( customRedrawBtnCB )
422 customRedrawBtnCB( lpdis, customRedrawBtnData );
423 }
424
425
426 // The button widget should be used as the parent widget
427 // when creating new buttons
428 SoWidget getButtonWidget() const { return appButtonForm; }
429
430 // popup menu vars
431 SoWidget popupWidget, *popupToggleWidgets;
432 SoWidget* drawStyleWidgets, bufferStyleWidgets[3];
433 char* popupTitle;
434
435 //
436 // Build/destroy decoration routines
437 //
438 SoWidget buildWidget( SoWidget parent );
439 void buildLeftWheel( SoWidget parent );
440
441 virtual void buildDecoration( SoWidget parent );
442 virtual SoWidget buildLeftTrim( SoWidget parent );
443 virtual SoWidget buildBottomTrim( SoWidget parent );
444 virtual SoWidget buildRightTrim( SoWidget parent );
445 virtual SoWidget buildZoomSlider( SoWidget parent );
446 SoWidget buildAppButtons( SoWidget parent );
447 SoWidget buildViewerButtons( SoWidget parent );
448 virtual void createViewerButtons( SoWidget parent );
449
450 //
451 // popup menu build routines
452 //
453 virtual void buildPopupMenu();
454 virtual void openStereoDialog();
455 virtual void openRecordDialog();
456 virtual void switchFSAAMode();
457
458 virtual void destroyPopupMenu();
459 void setPopupMenuString( const char* name );
460 SoWidget buildFunctionsSubmenu( SoWidget popup );
461 SoWidget buildDrawStyleSubmenu( SoWidget popup );
462
463 // For windows we have to explicitly make the popup visible (this
464 // gives us a chance to update all the checkmarks too).
465 virtual int displayPopupMenu( int x, int y, Hwnd owner );
466
467
468 //
469 // Preference sheet build routines
470 //
471 void setPrefSheetString( const char* name );
472 virtual void createPrefSheet();
473 void createPrefSheetShellAndForm( SoWidget& shell, SoWidget& form );
474 void createDefaultPrefSheetParts( SoWidget widgetList[], int &num, SoWidget form );
475 void layoutPartsAndMapPrefSheet( SoWidget widgetList[], int num, SoWidget form, SoWidget shell );
476 SoWidget createSeekPrefSheetGuts( SoWidget parent );
477 SoWidget createSeekDistPrefSheetGuts( SoWidget parent );
478 SoWidget createZoomPrefSheetGuts( SoWidget parent );
479 SoWidget createClippingPrefSheetGuts( SoWidget parent );
480 SoWidget createStereoPrefSheetGuts( SoWidget parent );
481
482 // Subclasses SHOULD redefine these to do viewer specific tasks
483 // since these do nothing in the base class. those routines are
484 // called by the thumb wheels whenever they rotate.
485 virtual void rightWheelMotion( float f );
486 virtual void bottomWheelMotion( float f );
487 virtual void leftWheelMotion( float f );
488
489 // Subclasses can redefine these to add viewer functionality. They
490 // by default call start and finish interactive viewing methods.
491 // (defined in the base class).
492 virtual void rightWheelStart();
493 virtual void bottomWheelStart();
494 virtual void leftWheelStart();
495 virtual void rightWheelFinish();
496 virtual void bottomWheelFinish();
497 virtual void leftWheelFinish();
498
499 // Subclasses SHOULD set those wheel string to whatever functionality
500 // name they are redefining the thumb wheels to do. Default names are
501 // "Motion X, "Motion Y" and "Motion Z" for bottom, left and right wheels.
502 void setBottomWheelString( const char* name );
503 void setLeftWheelString( const char* name );
504 void setRightWheelString( const char* name );
505
506 // Subclasses SHOULD redefine the openViewerHelpCard() routine to bring
507 // their help card (called by push button and popup menu entry).
508 // They can simply call SoWinComponent::openHelpCard() to open their
509 // specific help card.
510 virtual void openViewerHelpCard();
511
512 // redefine this to load the popup menu colormap
513 virtual void afterRealizeHook();
514
515 virtual void setSeekButton( SbBool onOff );
516
517 private:
518 void constructorCommon( SoWinFullViewer::BuildFlag buildFlag, SbBool buildNow, const char* name );
519
520 static void clientResize(HWND handle, int x, int y, int width, int height, BOOL repaint);
521
522 SbBool firstBuild; // set FALSE after buildWidget called once
523
524 SoGuiFullViewer* m_guiFullViewer; // Implementation class for SoXxFullViewer
525
526 // app button vars
527 SoWidget appButtonForm;
528 SbPList* appButtonList;
529 void doAppButtonLayout( int start );
530
531 SoStereoDialog* stereoDialogBox;
532
533 // zoom slider vars and routines
534 SbVec2f zoomSldRange;
535 void setCameraZoom( float zoom );
536 float getCameraZoom();
537 void setZoomSliderPosition( float zoom );
538 void setZoomFieldString( float zoom );
539
540 static void zoomSliderCB( SoWidget w, SoWinFullViewer* p, XtPointer* ptr );
541 static void zoomFieldCB( SoWidget w, SoWinFullViewer* v, XtPointer* ptr );
542
543 static void zoomSensorCB( void* v, SoSensor* s );
544
545 // push buttons vars and callbacks
546 SoWinBitmapButton* buttonList[10];
547
548 // pref sheet variables
549 SoWidget prefSheetShellWidget;
550 char* prefSheetStr;
551
552 // seek dist pref sheet vars and callbacks
553 int seekDistWheelVal;
554 SoWidget seekDistField;
555
556 // clipping plane pref sheet callbacks and variables
557 SoWidget clipWheelForm;
558 int clipNearWheelVal, clipFarWheelVal;
559 SoWidget clipNearField, clipFarField;
560
561 // stereo viewing pref sheet callbacks and variables
562 SoWidget stereoWheelForm, stereoField, stereoLabel;
563 int stereoWheelVal;
564
565 // zoom slider sensor activation
566 static void visibilityChangeCB( void* pt, SbBool visible );
567
568 // callback functions for thumbwheels
569 static void rightWheelCB ( SoWinFullViewer* v, XtPointer* d );
570 static void bottomWheelCB( SoWinFullViewer* v, XtPointer* d );
571 static void leftWheelCB ( SoWinFullViewer* v, XtPointer* d );
572
573 // Window proc for SoWinFullViewer "manager widget" windows
574 static LRESULT CALLBACK mgrWindowProc( Hwnd hwnd, UINT message,
575 WPARAM wParam, LPARAM lParam );
576
577 // Window proc for SoWinFullViewer "button container" windows
578 static LRESULT CALLBACK btnWindowProc( Hwnd hwnd, UINT message,
579 WPARAM wParam, LPARAM lParam );
580
581 // Window proc for SoWinFullViewer "application button container" windows
582 static LRESULT CALLBACK appBtnWindowProc( Hwnd hwnd, UINT message,
583 WPARAM wParam, LPARAM lParam );
584
585 // Window proc for SoWinFullViewer text entry window (zoomfield)
586 static LRESULT CALLBACK txtWindowProc( Hwnd hwnd, UINT message,
587 WPARAM wParam, LPARAM lParam );
588
589 PushAppButtonCB* customPushBtnCB;
590 RedrawAppButtonCB* customRedrawBtnCB;
591 void* customPushBtnData, *customRedrawBtnData;
592
593 static int s_isAttRunning;
594
595 // Save original wndProc for windows we're subclassing
596 WNDPROC origBtnWndProc;
597 WNDPROC origAppBtnWndProc;
598 WNDPROC origTxtWndProc;
599
600 // Utility function to draw the viewer decorations
601 // (Yes, we have to do this "by hand" for Windows)
602 static void drawDecorations( SoWinFullViewer* p, Hwnd hwnd, Hdc hdc );
603};
604
605#include <Inventor/Win/SoWinEndStrict.h>
606#endif /* _SO_WIN_FULL_VIEWER_ */
607
List of generic (void *) pointers.
Definition SbPList.h:77
int find(const void *ptr) const
Returns index of given pointer in list, or -1 if not found.
int getLength() const
Returns number of pointers in list.
Definition SbPList.h:125
2D vector class.
Definition SbVec.h:76
Manages a list of callbacks and associated data.
Abstract base class for camera nodes.
Definition SoCamera.h:188
Sensor class that can be attached to Open Inventor fields.
Abstract base class for Open Inventor sensors.
Definition SoSensor.h:100
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Component that l...
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Base viewer clas...
void setClientPopupMenu(Hmenu hmenu)
Enables application-specific popup menu.
void removeAppPushButton(SoWidget oldButton)
Removes specified application push button.
SbBool isDecoration()
Returns whether the viewer component trim is on or off.
UINT curPopupDrawItem
In this version we track the currently "check marked" menu item in the Draw Style submenu (only one c...
Hmenu drawPopup
Pointer to the Draw Style submenu.
Hmenu mainPopup
Pointer to the root of the popup menu.
Hmenu hClientPopup
Popup menu provided by a client (i.e.
virtual void hide()
This hides the component.
SoCallbackList popupPreCallback
The callbacks in this list are invoked immediately prior to display of the popup menu,...
SoWidget getAppPushButtonParent() const
Returns application push button parent.
int lengthAppPushButton()
Returns number of application push buttons.
SoStereoDialog * getStereoDialog()
SbBool isClientPopupMenuInstalled()
Returns TRUE if an application-specific popup menu is installed.
virtual void setCamera(SoCamera *cam)
Sets the camera that will be controlled by the viewer.
SoWidget getRenderAreaWidget()
Returns the render area window handle.
void addAppPushButton(SoWidget newButton)
Adds application push button, which will be placed in the left hand side decoration trim.
Hmenu funcPopup
Pointer to the Functions submenu.
void setStereoDialog(SoStereoDialog *newDialog)
void setPopupMenuEnabled(SbBool trueOrFalse)
Enables/disables the viewer popup menu (default enabled).
int findAppPushButton(SoWidget oldButton)
Returns index of specified push button.
virtual void setViewing(SbBool onOrOff)
Sets whether the viewer is turned on or off.
static SbBool isDoButtonBar()
Returns whether the buttonbar is enabled or disabled.
BuildFlag
This specifies what should be build by default in the constructor.
@ BUILD_POPUP
Build the popup menu only.
@ BUILD_DECORATION
Build the decoration only.
@ BUILD_NONE
Doesn't build anything extra.
@ BUILD_ALL
Build everything by default.
void RedrawAppButtonCB(LPDRAWITEMSTRUCT lpdis, void *userData)
SoCallbackList popupPostCallback
The callbacks in this list will be invoked after the action selected from the viewer popup has been p...
SbBool isPopupMenuEnabled()
Returns whether the viewer popup menu is enabled or disabled.
void insertAppPushButton(SoWidget newButton, int index)
Adds application push button, which will be placed in the left hand side decoration trim.
static void setDoButtonBar(SbBool onOrOff)
Create the next instance of fullviewer w/wo the buttonbar.
Hmenu rootPopup
Pointer to the popup menu container.
void PushAppButtonCB(SoWidget w, int id, void *pushData, void *userData)
Hmenu prefPopup
Pointer to the Preferences submenu.
void addRedrawAppButtonCallback(RedrawAppButtonCB *cb, void *data=NULL)
void addPushAppButtonCallback(PushAppButtonCB *cb, void *data=NULL)
void setDecoration(SbBool onOrOff)
Shows/hides the viewer component trim (default on).
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Viewer component...
Type
An EDITOR viewer will create a camera under the user supplied scene graph (specified in setSceneGraph...
int SbBool
Boolean type.
Definition SbBase.h:87
void * XtPointer
Definition SoQtDef.h:122