SoXt Class Reference
[Xt]

Routines for Open Inventor/Xt compatibility. More...

#include <Inventor/Xt/SoXt.h>

List of all members.

Static Public Member Functions

static SoWidget init (const char *appName, const char *className="Inventor")
static void init (SoWidget topLevelWidget)
static bool isInitialized ()
static void finish ()
static void mainLoop ()
static void nextEvent (XtAppContext appContext, XEvent *event)
static Boolean dispatchEvent (XEvent *event)
static XtAppContext getAppContext ()
static Display * getDisplay ()
static SoWidget getTopLevelWidget ()
static void show (SoWidget widget)
static void hide (SoWidget widget)
static XmString encodeString (char *s)
static char * decodeString (XmString xs)
static void setWidgetSize (SoWidget w, const SbVec2s &size)
static SbVec2s getWidgetSize (SoWidget w)
static SoWidget getShellWidget (SoWidget w)
static void createSimpleErrorDialog (SoWidget widget, char *dialogTitle, char *errorStr1, char *errorStr2=NULL)
static void getPopupArgs (Display *d, int scr, ArgList args, int *n)
static void registerColormapLoad (SoWidget widget, SoWidget shell)
static void addColormapToShell (SoWidget widget, SoWidget shell)
static void removeColormapFromShell (SoWidget widget, SoWidget shell)

Deprecated



static SoDEPRECATED SoWidget threadInit (const char *appName, const char *className="Inventor")
static SoDEPRECATED void threadInit (SoWidget topLevelWidget)

Detailed Description

Routines for Open Inventor/Xt compatibility.

The SoXt class initializes Open Inventor for use with the Xt toolkit and Motif. SoXt::init() must be called in order for Open Inventor to work properly with Xt SoXt::finish() should be called to clean up static memory allocations.

SoXt::mainLoop() must be called in order for extension device events to be passed to Open Inventor render areas. The other methods are convenience functions.

Refer to the SoXtComponent reference pages for examples on how this class should be used when using Open Inventor Xt components.

SEE ALSO

SoXtComponent


Member Function Documentation

static void SoXt::addColormapToShell ( SoWidget  widget,
SoWidget  shell 
) [static]

Convenience routine to insert the given widget colormap onto the supplied shell widget.

This will not replace the existing installed colormaps (or list of windows), but instead insert the new colormap first into the existing list using XGetWMColormapWindows () and XSetWMColormapWindows ().

static void SoXt::createSimpleErrorDialog ( SoWidget  widget,
char *  dialogTitle,
char *  errorStr1,
char *  errorStr2 = NULL 
) [static]

Convenience routine which brings a simple Xt error dialog box displaying the given error string(s) and window title.

The OK button, which destroys the dialog, is the only button displayed.

static char* SoXt::decodeString ( XmString  xs  )  [static]

Convenience routine for decoding an XmString back to a character string.

encodeString() is used for encoding a character string as an XmString . ( XmString is a Motif string). The application is responsible for freeing up the memory pointed to by the return value. Use free () to free a character pointer.

static Boolean SoXt::dispatchEvent ( XEvent event  )  [static]

Dispatches the passed event to a handler.

This returns TRUE if a handler was found, else it returns FALSE.

static XmString SoXt::encodeString ( char *  s  )  [static]

Convenience routine for encoding a character string as an XmString .

decodeString() is used for decoding an XmString back to a character string. ( XmString is a Motif string). The application is responsible for freeing up the memory pointed to by the return value. Use XmStringFree () to free an XmString .

static void SoXt::finish (  )  [static]

Frees Open Inventor's internal static memory allocations.

This avoids false positives from memory leak checking software. We recommend calling this method and it should be the last Open Inventor method called by the application. This method calls SoDB::finish(), SoNodeKit::finish(), and SoInteraction::finish().

Note: Open Inventor objects should be destroyed before you call this method.

For example:

Wrong Open Inventor Ending Safe Open Inventor Endings
 void main() {
   SoWidget myW = SoXt::init("");
   SoXtExaminerViewer viewer(myW);
   ....
   ....
   SoXt::mainLoop();
   SoXt::finish();
 }
 void runApp() {
   SoXtExaminerViewer viewer(myW);
   ....
   ....
   SoXt::mainLoop();
 }

 void main () {
   SoWidget myW = SoXt::init("");
   runApp();
   SoXt::finish();
 }
 void main () {
   SoWidget myW = SoXt::init("");
   SoXtExaminerViewer* viewer
          = new SoXtExaminerViewer(myW);
   ....
   ....
   SoXt::mainLoop();
   delete viewer;
   SoXt::finish();
  }
SoXt doesn't end properly: SoXtExaminerViewer is destroyed after the finish() method has been called. The SoXtExaminerViewer (that uses OpenInventor) is destroyed before calling the finish() method.
static XtAppContext SoXt::getAppContext (  )  [static]

This method is included for portability only.

static Display* SoXt::getDisplay (  )  [static]

This method is included for portability only.

static void SoXt::getPopupArgs ( Display *  d,
int  scr,
ArgList  args,
int *  n 
) [static]

Convenience routine which gets visual args for the popup planes.

These args can then be passed in to XmCreatePulldownMenu () or XmCreatePopupMenu () to create menus in the popup planes. addColormapToShell() has to be called on the main popup window to set the proper color map.

static SoWidget SoXt::getShellWidget ( SoWidget  w  )  [static]

Convenience routine which will return the topmost window containing the given widget.

The widget tree is traversed up until the last widget is found using GetParent .

static SoWidget SoXt::getTopLevelWidget (  )  [static]

Returns information based on the initial widget returned by or passed to init.

static SbVec2s SoXt::getWidgetSize ( SoWidget  w  )  [static]

Convenience routine to get the size of the given window.

static void SoXt::hide ( SoWidget  widget  )  [static]

Convenience routine to hide the passed widget.

This includes any children the window may have.

static void SoXt::init ( SoWidget  topLevelWidget  )  [static]

This alternate form of init allows the application to initialize Xt.

The passed widget should be the top level widget returned from the Xt initialization. This method will call SoDB::init(), SoNodeKit::init(), and SoInteraction::init().

static SoWidget SoXt::init ( const char *  appName,
const char *  className = "Inventor" 
) [static]

This is called to initialize Open Inventor and Xt, and bind Open Inventor with X events handling so that Open Inventor sensors will work correctly.

This returns the top level shell widget. This method calls SoDB::init(), SoNodeKit::init(), and SoInteraction::init() and creates an initial window.

static bool SoXt::isInitialized (  )  [static]

Returns TRUE if SoXt module is currently initialized.

static void SoXt::mainLoop (  )  [static]

This retrieves and dispatches events (loops forever).

It calls SoXt::nextEvent() and SoXt::dispatchEvent() to do this.

static void SoXt::nextEvent ( XtAppContext  appContext,
XEvent event 
) [inline, static]

Gets the nextEvent by calling XtAppNextEvent().

The appContext can be had by calling SoXt::getAppContext().

static void SoXt::registerColormapLoad ( SoWidget  widget,
SoWidget  shell 
) [static]

Convenience routine which will register map/unmap callbacks to load and unload the pulldown menu color map right before the menu is about to be posted.

This should be called when creating pulldown or popup menus in the overlays. This will make sure that the right color map is loaded into the shell widget (to make the pulldown/popup look right) and remove it when no longer needed (to make sure the OpenGL overlay widget color map is correctly loaded for 8 bit machines).

static void SoXt::removeColormapFromShell ( SoWidget  widget,
SoWidget  shell 
) [static]

Convenience routine to remove the given widget colormap from the supplied shell widget.

static void SoXt::setWidgetSize ( SoWidget  w,
const SbVec2s size 
) [static]

Convenience routine to set the size of the given window.

static void SoXt::show ( SoWidget  widget  )  [static]

Convenience routine to show the passed widget.

This includes any children the window may have.

static SoDEPRECATED void SoXt::threadInit ( SoWidget  topLevelWidget  )  [static]
Deprecated:

Deprecated since Open Inventor 10000
Use SoXt::init( topLevelWidget ) instead.
static SoDEPRECATED SoWidget SoXt::threadInit ( const char *  appName,
const char *  className = "Inventor" 
) [static]
Deprecated:

Deprecated since Open Inventor 10000
Use SoXt::init( appName, className ) instead.

The documentation for this class was generated from the following file:

Open Inventor Toolkit reference manual, generated on 15 Mar 2023
Copyright © Thermo Fisher Scientific All rights reserved.
http://www.openinventor.com/