Routines for Open Inventor/Xt compatibility. More...
#include <Inventor/Xt/SoXt.h>
Static Public Member Functions | |
static SoWidget | init (const char *appName, const char *className="Inventor") |
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. | |
static void | init (SoWidget topLevelWidget) |
This alternate form of init allows the application to initialize Xt. | |
static bool | isInitialized () |
Returns TRUE if SoXt module is currently initialized. | |
static void | finish () |
Frees Open Inventor's internal static memory allocations. | |
static int | mainLoop () |
Enters the main event loop and waits until exit() is called. | |
static void | exit (int returnCode=0) |
Tells the main event loop to exit with a return code. | |
static void | nextEvent (XtAppContext appContext, XEvent *event) |
Gets the nextEvent by calling XtAppNextEvent(). | |
static Boolean | dispatchEvent (XEvent *event) |
Dispatches the passed event to a handler. | |
static XtAppContext | getAppContext () |
This method is included for portability only. | |
static Display * | getDisplay () |
This method is included for portability only. | |
static SoWidget | getTopLevelWidget () |
Returns information based on the initial widget returned by or passed to init. | |
static void | show (SoWidget widget) |
Convenience routine to show the passed widget. | |
static void | hide (SoWidget widget) |
Convenience routine to hide the passed widget. | |
static XmString | encodeString (char *s) |
Convenience routine for encoding a character string as an XmString . | |
static char * | decodeString (XmString xs) |
Convenience routine for decoding an XmString back to a character string. | |
static void | setWidgetSize (SoWidget w, const SbVec2s &size) |
Convenience routine to set the size of the given window. | |
static SbVec2s | getWidgetSize (SoWidget w) |
Convenience routine to get the size of the given window. | |
static SoWidget | getShellWidget (SoWidget w) |
Convenience routine which will return the topmost window containing the given widget. | |
static void | createSimpleErrorDialog (SoWidget widget, char *dialogTitle, char *errorStr1, char *errorStr2=NULL) |
Convenience routine which brings a simple Xt error dialog box displaying the given error string(s) and window title. | |
static void | getPopupArgs (Display *d, int scr, ArgList args, int *n) |
Convenience routine which gets visual args for the popup planes. | |
static void | registerColormapLoad (SoWidget widget, SoWidget shell) |
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. | |
static void | addColormapToShell (SoWidget widget, SoWidget shell) |
Convenience routine to insert the given widget colormap onto the supplied shell widget. | |
static void | removeColormapFromShell (SoWidget widget, SoWidget shell) |
Convenience routine to remove the given widget colormap from the supplied shell widget. | |
Deprecated | |
static SoDEPRECATED SoWidget | threadInit (const char *appName, const char *className="Inventor") |
static SoDEPRECATED void | threadInit (SoWidget topLevelWidget) |
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.
|
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 |
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 |
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.
Dispatches the passed event to a handler.
This returns TRUE if a handler was found, else it returns FALSE.
|
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 |
Tells the main event loop to exit with a return code.
After this function has been called, the mainLoop() function returns returnCode. If the event loop is not running, this function does nothing.
By convention, a returnCode of 0 means success, and any non-zero value indicates an error.
|
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::finish();
}
Viewer component which uses a virtual trackball to view the data. Definition SoXtExaminerViewer.h:219 static SoWidget init(const char *appName, const char *className="Inventor") This is called to initialize Open Inventor and Xt, and bind Open Inventor with X events handling so t...
|
| ||
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 |
This method is included for portability only.
|
static |
This method is included for portability only.
|
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 |
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 |
Returns information based on the initial widget returned by or passed to init.
|
static |
Convenience routine to get the size of the given window.
|
static |
Convenience routine to hide the passed widget.
This includes any children the window may have.
|
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 |
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 |
Returns TRUE if SoXt module is currently initialized.
|
static |
Enters the main event loop and waits until exit() is called.
Returns the value that was passed to exit().
It calls nextEvent() and dispatchEvent() to retrieve and dispatch events.
|
inlinestatic |
|
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 |
Convenience routine to remove the given widget colormap from the supplied shell widget.
|
static |
Convenience routine to set the size of the given window.
|
static |
Convenience routine to show the passed widget.
This includes any children the window may have.
|
static |
|
static |