Open Inventor Release 2023.2.3
 
Loading...
Searching...
No Matches
SoWinFullViewer.h
Go to the documentation of this file.
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-2020 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
30
32#include <Inventor/SbPList.h>
34
35// classes used
36class SoFieldSensor;
37class SoWinBitmapButton;
39class SoStereoDialog;
40
41typedef void PushAppButtonCB( SoWidget w, int id, void* pushData, void* userData );
42typedef void RedrawAppButtonCB( LPDRAWITEMSTRUCT lpdis, void* userData ) ;
43
45//
46// Class: SoWinFullViewer
47//
48// The SoWinFullViewer component class is the abstract base class for all
49// viewers which include a decoration around the rendering area. The
50// decoration is made of thumbwheels, sliders and push/toggle buttons. There
51// is also a popup menu which includes all of the viewing options and methods.
52//
54
80{
81 public:
82
85 {
89 BUILD_NONE = 0x00,
97 BUILD_POPUP = 0x02,
101 BUILD_ALL = 0xff,
102 };
103
111 void setDecoration( SbBool onOrOff );
112
116 SbBool isDecoration() { return m_guiFullViewer->isDecoration(); }
117
148 void setPopupMenuEnabled( SbBool trueOrFalse );
149
154 SbBool isPopupMenuEnabled() { return m_guiFullViewer->isPopupMenuEnabled(); }
155
160 static void setDoButtonBar( SbBool onOrOff );
161
166 static SbBool isDoButtonBar() { return SoWinFullViewer::doButtonBar; }
167
180
189
195
201
205 SoWidget getAppPushButtonParent() const { return appButtonForm; }
206
216 void addAppPushButton( SoWidget newButton );
217
227 void insertAppPushButton( SoWidget newButton, int index );
228
232 void removeAppPushButton( SoWidget oldButton );
233
237 int findAppPushButton( SoWidget oldButton ) { return appButtonList->find( oldButton ); }
238
242 int lengthAppPushButton() { return appButtonList->getLength(); }
243
247 SoWidget getRenderAreaWidget() { return raWidget; }
248
249 // redefine these from the base class
250 virtual void setViewing( SbBool onOrOff );
251 virtual void setCamera( SoCamera* cam );
252 virtual void hide();
253
254 // Allow app, eg. 3SA, to control this if desired.
255 SoStereoDialog* getStereoDialog() { return stereoDialogBox; }
256 void setStereoDialog( SoStereoDialog *newDialog ) { stereoDialogBox = newDialog; }
257
262
267
272
277
282
290
291 /*
292 * Tracks the checkmark for "Moving" draw style.
293 */
295
296 /*
297 * Tracks the checkmark for the buffering draw style.
298 */
300
305
306 void addPushAppButtonCallback( PushAppButtonCB* cb, void* data = NULL )
307 {
308 customPushBtnCB = cb;
309 customPushBtnData = data;
310 }
311 void addRedrawAppButtonCallback( RedrawAppButtonCB* cb, void* data = NULL )
312 {
313 customRedrawBtnCB = cb;
314 customRedrawBtnData = data;
315 }
316
317 private:
318 virtual ~SoWinFullViewer();
319
320 SoGuiFullViewer* getGuiFullViewer() const;
321
322 // retro compatibilty, don't use them directly. Call their accessors.
323 float rightWheelVal, leftWheelVal, bottomWheelVal;
324 SbBool popupEnabled;
325
326 private:
327 // Constructor/Destructor
329 const char* name,
330 SbBool buildInsideParent,
331 SoWinFullViewer::BuildFlag flag, //Removed class name qualifier from enum --mmh
332 SoWinViewer::Type type,
333 SbBool buildNow,
334 SbBool sync );
335
337 const char* name,
338 SbBool buildInsideParent,
340 SoWinViewer::Type type,
341 SbBool buildNow,
342 SbBool sync,
343 SoGuiFullViewer* guiFullViewer );
344
345 // general decoration vars
346 SbBool decorationFlag;
347 SoWidget mgrWidget; // form which manages all other widgets
348 SoWidget raWidget; // render area widget
349 SoWidget leftTrimForm, bottomTrimForm, rightTrimForm;
350
351 static SbBool doButtonBar;
352
353 int SO_WHEEL_DELTA;
354
355 // zoom slider vars
356 SoWidget zoomForm, zoomField, zoomSlider;
357 SoFieldSensor* zoomSensor; // attached to camera zoom field
358
359 // thumb wheel vars
360
361 // For _WIN32 use frame window to hold instance of thumbwheel class.
362 // Note: The "extra" wheel is only used by certain viewers, eg. the
363 // Walk viewer has a "Height" wheel. It always appears above
364 // the left wheel. This is a little more complicated under
365 // Windows because there's no such thing as a "form widget". :-)
366 SoWinGDIThumbWheel* rightWheel, *bottomWheel, *leftWheel , *extraWheel;
367
368 SoWidget extraTrimForm;
369 float extraWheelVal;
370 char* extraWheelStr;
371 int extraLabelHeight;
372 SoWidget extraWheelLabel; //Handle of static control
373
374 // static control that contains all the viewer
375 // buttons on the right side
376 SoWidget vwrButtonForm;
377
378 HBRUSH backgroundBrush; //Used to paint control bkgds
379
380 char* rightWheelStr, *bottomWheelStr, *leftWheelStr;
381 SoWidget rightWheelLabel, bottomWheelLabel, leftWheelLabel;
382
383 // widget list of viewer buttons
384 SbPList* viewerButtonWidgets;
385
386 // For _WIN32 we have to use a slightly more complicated scheme to
387 // allow subclasses to add their own buttons. The viewerButtonWidgets
388 // list includes both the "standard" FullVwr buttons and the subClass
389 // buttons, so we need to remember how many are the FullVwr buttons.
390 int numFullVwrButtons;
391
392 // Subclasses should override this function (in addition to
393 // createViewerButtons), handle selection if it's a button they
394 // added and if not kick it back up to this function.
395 virtual void pushButtonCB( SoWidget w, int id, void* data );
396
397 // We need this with WINxx to transmit events when they occur on
398 // appButtonForm. Note that data contains the code (type HIWORD)
399 // of the event that can be one of BN_DBLCLK, BN_DOUBLECLICKED,
400 // BN_CLICKED, BN_PUSHED, BN_UNPUSHED
401 // An application willing not to use this callback, will need
402 // to assign another window proc to appButtonForm.
403 // For UNIX, the application only need to assign a callback to
404 // each button.
405 // The default behaviour is to call a custom callback
406 virtual void pushAppButtonCB( SoWidget w, int id, void* data )
407 {
408 if ( customPushBtnCB )
409 customPushBtnCB( w, id, data, customPushBtnData );
410 }
411
412 // subclasses should override this function or add a custom
413 // redraw callback (see addRedrawAppButtonCallback) in order to
414 // specify the redraw behaviour of the application buttons. Note
415 // that the widget concerned by the call to this callback
416 // function can be obtained with lpdis->hwndItem
417 virtual void redrawAppButtonCB( LPDRAWITEMSTRUCT lpdis )
418 {
419 if ( customRedrawBtnCB )
420 customRedrawBtnCB( lpdis, customRedrawBtnData );
421 }
422
423
424 // The button widget should be used as the parent widget
425 // when creating new buttons
426 SoWidget getButtonWidget() const { return appButtonForm; }
427
428 // popup menu vars
429 SoWidget popupWidget, *popupToggleWidgets;
430 SoWidget* drawStyleWidgets, bufferStyleWidgets[3];
431 char* popupTitle;
432
433 //
434 // Build/destroy decoration routines
435 //
436 SoWidget buildWidget( SoWidget parent );
437 void buildLeftWheel( SoWidget parent );
438
439 virtual void buildDecoration( SoWidget parent );
440 virtual SoWidget buildLeftTrim( SoWidget parent );
441 virtual SoWidget buildBottomTrim( SoWidget parent );
442 virtual SoWidget buildRightTrim( SoWidget parent );
443 virtual SoWidget buildZoomSlider( SoWidget parent );
444 SoWidget buildAppButtons( SoWidget parent );
445 SoWidget buildViewerButtons( SoWidget parent );
446 virtual void createViewerButtons( SoWidget parent );
447
448 //
449 // popup menu build routines
450 //
451 virtual void buildPopupMenu();
452 virtual void openStereoDialog();
453 virtual void openRecordDialog();
454 virtual void switchFSAAMode();
455
456 virtual void destroyPopupMenu();
457 void setPopupMenuString( const char* name );
458 SoWidget buildFunctionsSubmenu( SoWidget popup );
459 SoWidget buildDrawStyleSubmenu( SoWidget popup );
460
461 // For windows we have to explicitly make the popup visible (this
462 // gives us a chance to update all the checkmarks too).
463 virtual int displayPopupMenu( int x, int y, Hwnd owner );
464
465
466 //
467 // Preference sheet build routines
468 //
469 void setPrefSheetString( const char* name );
470 virtual void createPrefSheet();
471 void createPrefSheetShellAndForm( SoWidget& shell, SoWidget& form );
472 void createDefaultPrefSheetParts( SoWidget widgetList[], int &num, SoWidget form );
473 void layoutPartsAndMapPrefSheet( SoWidget widgetList[], int num, SoWidget form, SoWidget shell );
474 SoWidget createSeekPrefSheetGuts( SoWidget parent );
475 SoWidget createSeekDistPrefSheetGuts( SoWidget parent );
476 SoWidget createZoomPrefSheetGuts( SoWidget parent );
477 SoWidget createClippingPrefSheetGuts( SoWidget parent );
478 SoWidget createStereoPrefSheetGuts( SoWidget parent );
479
480 // Subclasses SHOULD redefine these to do viewer specific tasks
481 // since these do nothing in the base class. those routines are
482 // called by the thumb wheels whenever they rotate.
483 virtual void rightWheelMotion( float f );
484 virtual void bottomWheelMotion( float f );
485 virtual void leftWheelMotion( float f );
486
487 // Subclasses can redefine these to add viewer functionality. They
488 // by default call start and finish interactive viewing methods.
489 // (defined in the base class).
490 virtual void rightWheelStart();
491 virtual void bottomWheelStart();
492 virtual void leftWheelStart();
493 virtual void rightWheelFinish();
494 virtual void bottomWheelFinish();
495 virtual void leftWheelFinish();
496
497 // Subclasses SHOULD set those wheel string to whatever functionality
498 // name they are redefining the thumb wheels to do. Default names are
499 // "Motion X, "Motion Y" and "Motion Z" for bottom, left and right wheels.
500 void setBottomWheelString( const char* name );
501 void setLeftWheelString( const char* name );
502 void setRightWheelString( const char* name );
503
504 // Subclasses SHOULD redefine the openViewerHelpCard() routine to bring
505 // their help card (called by push button and popup menu entry).
506 // They can simply call SoWinComponent::openHelpCard() to open their
507 // specific help card.
508 virtual void openViewerHelpCard();
509
510 // redefine this to load the popup menu colormap
511 virtual void afterRealizeHook();
512
513 virtual void setSeekButton( SbBool onOff );
514
515 private:
516 void constructorCommon( SoWinFullViewer::BuildFlag buildFlag, SbBool buildNow, const char* name );
517
518 static void clientResize(HWND handle, int x, int y, int width, int height, BOOL repaint);
519
520 SbBool firstBuild; // set FALSE after buildWidget called once
521
522 SoGuiFullViewer* m_guiFullViewer; // Implementation class for SoXxFullViewer
523
524 // app button vars
525 SoWidget appButtonForm;
526 SbPList* appButtonList;
527 void doAppButtonLayout( int start );
528
529 SoStereoDialog* stereoDialogBox;
530
531 // zoom slider vars and routines
532 SbVec2f zoomSldRange;
533 void setCameraZoom( float zoom );
534 float getCameraZoom();
535 void setZoomSliderPosition( float zoom );
536 void setZoomFieldString( float zoom );
537
538 static void zoomSliderCB( SoWidget w, SoWinFullViewer* p, XtPointer* ptr );
539 static void zoomFieldCB( SoWidget w, SoWinFullViewer* v, XtPointer* ptr );
540
541 static void zoomSensorCB( void* v, SoSensor* s );
542
543 // push buttons vars and callbacks
544 SoWinBitmapButton* buttonList[10];
545
546 // pref sheet variables
547 SoWidget prefSheetShellWidget;
548 char* prefSheetStr;
549
550 // seek dist pref sheet vars and callbacks
551 int seekDistWheelVal;
552 SoWidget seekDistField;
553
554 // clipping plane pref sheet callbacks and variables
555 SoWidget clipWheelForm;
556 int clipNearWheelVal, clipFarWheelVal;
557 SoWidget clipNearField, clipFarField;
558
559 // stereo viewing pref sheet callbacks and variables
560 SoWidget stereoWheelForm, stereoField, stereoLabel;
561 int stereoWheelVal;
562
563 // zoom slider sensor activation
564 static void visibilityChangeCB( void* pt, SbBool visible );
565
566 // callback functions for thumbwheels
567 static void rightWheelCB ( SoWinFullViewer* v, XtPointer* d );
568 static void bottomWheelCB( SoWinFullViewer* v, XtPointer* d );
569 static void leftWheelCB ( SoWinFullViewer* v, XtPointer* d );
570
571 // Window proc for SoWinFullViewer "manager widget" windows
572 static LRESULT CALLBACK mgrWindowProc( Hwnd hwnd, UINT message,
573 WPARAM wParam, LPARAM lParam );
574
575 // Window proc for SoWinFullViewer "button container" windows
576 static LRESULT CALLBACK btnWindowProc( Hwnd hwnd, UINT message,
577 WPARAM wParam, LPARAM lParam );
578
579 // Window proc for SoWinFullViewer "application button container" windows
580 static LRESULT CALLBACK appBtnWindowProc( Hwnd hwnd, UINT message,
581 WPARAM wParam, LPARAM lParam );
582
583 // Window proc for SoWinFullViewer text entry window (zoomfield)
584 static LRESULT CALLBACK txtWindowProc( Hwnd hwnd, UINT message,
585 WPARAM wParam, LPARAM lParam );
586
587 PushAppButtonCB* customPushBtnCB;
588 RedrawAppButtonCB* customRedrawBtnCB;
589 void* customPushBtnData, *customRedrawBtnData;
590
591 static int s_isAttRunning;
592
593 // Save original wndProc for windows we're subclassing
594 WNDPROC origBtnWndProc;
595 WNDPROC origAppBtnWndProc;
596 WNDPROC origTxtWndProc;
597
598 // Utility function to draw the viewer decorations
599 // (Yes, we have to do this "by hand" for Windows)
600 static void drawDecorations( SoWinFullViewer* p, Hwnd hwnd, Hdc hdc );
601};
602
604#endif /* _SO_WIN_FULL_VIEWER_ */
605
void * XtPointer
Definition SoQtDef.h:118
#define SoWidget
Definition SoQtDef.h:40
void start()
#define HBRUSH
#define Hdc
Definition SoWinDef.h:84
#define Hwnd
Definition SoWinDef.h:83
#define Hmenu
Definition SoWinDef.h:86
void RedrawAppButtonCB(LPDRAWITEMSTRUCT lpdis, void *userData)
void PushAppButtonCB(SoWidget w, int id, void *pushData, void *userData)
SoWinGDIThumbWheel(SoWidget parent=NULL, const char *name=NULL, SbBool buildInsideParent=TRUE, SbBool horizontal=TRUE)
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:97
<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.
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.
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
unsigned int UINT
Definition port.h:357
#define CALLBACK
Definition port.h:345