| 1 |
NAME SoXt "" "" { |
| 2 |
routines for Inventor/Xt compatibility. |
| 3 |
} |
| 4 |
|
| 5 |
INCLUDE Xt/SoXt.h |
| 6 |
|
| 7 |
DESC { |
| 8 |
The SoXt class initializes Inventor for use with the Xt toolkit and |
| 9 |
Motif. |
| 10 |
\m\+SoXt::init()\.\-SoXtInit()\.\. |
| 11 |
must be called in order for Inventor to work properly with Xt. |
| 12 |
\m\+SoXt::mainLoop()\.\-SoXtMainLoop()\.\. |
| 13 |
must be called in order for extension |
| 14 |
device events to be passed to Inventor render areas. The other methods are |
| 15 |
convenience functions. |
| 16 |
|
| 17 |
\p |
| 18 |
Refer to the |
| 19 |
\cSoXtComponent\. |
| 20 |
man pages for examples on how this class should be used when using Inventor |
| 21 |
Xt components. |
| 22 |
} |
| 23 |
|
| 24 |
METHOD "" static Widget init(const char *appName, |
| 25 |
const char *className = "Inventor") |
| 26 |
{ |
| 27 |
This is called to initialize Inventor and Xt, and bind Inventor with Xt |
| 28 |
event handling so that Inventor sensors will work correctly. This returns |
| 29 |
the top level shell widget. This method will call |
| 30 |
\+\mSoDB::init()\., \mSoNodeKit::init()\., |
| 31 |
\mSoInteraction::init()\.\.\-\mSoDBInit()\., |
| 32 |
\mSoNodeKitInit()\., \mSoInteractionInit()\.\. |
| 33 |
and \xXtAppInitialize()\.. |
| 34 |
} |
| 35 |
|
| 36 |
METHOD initWithWidget static void init(Widget topLevelWidget) |
| 37 |
{ |
| 38 |
This alternate form of init allows the application to initialize Xt. The |
| 39 |
passed widget should be the top level shell widget returned from the Xt |
| 40 |
initializiation. This method will call |
| 41 |
\+\mSoDB::init()\., \mSoNodeKit::init()\., |
| 42 |
\mSoInteraction::init()\.\.\-\mSoDBInit()\., |
| 43 |
\mSoNodeKitInit()\., \mSoInteractionInit()\.\. |
| 44 |
and \xXtAppInitialize()\.. |
| 45 |
} |
| 46 |
|
| 47 |
METHOD "" static void mainLoop() |
| 48 |
{ |
| 49 |
This retrieves and dispatches events (loops forever). |
| 50 |
Unlike Xt which ignores extension devices (i.e. any device besides |
| 51 |
mouse and keyboard), this main loop will dispatch events |
| 52 |
from input extension devices like the spaceball. |
| 53 |
It calls \+\mSoXt::nextEvent()\. and |
| 54 |
\mSoXt::dispatchEvent()\.\.\-\mSoXtNextEvent()\. and |
| 55 |
\mSoXtDispatchEvent()\.\. |
| 56 |
to do this. |
| 57 |
If only the mouse and keyboard devices are used, this is equivalent to calling |
| 58 |
\xXtAppMainLoop()\.. |
| 59 |
} |
| 60 |
|
| 61 |
METHOD "" static void nextEvent(XtAppContext appContext, XEvent *event) { |
| 62 |
Get the nextEvent by calling \xXtAppNextEvent()\.. |
| 63 |
The \vappContext\. can be had by calling |
| 64 |
\+\mSoXt::getAppContext()\..\.\-\mSoXtGetAppContext()\..\. |
| 65 |
} |
| 66 |
|
| 67 |
METHOD "" static Boolean dispatchEvent(XEvent *event) { |
| 68 |
Dispatch the passed event to a handler. Mouse and keyboard events are dispatched |
| 69 |
by calling \xXtDispatchEvent()\.. Events from input extension devices |
| 70 |
are dispatched by code implemented in this routine. |
| 71 |
This returns True if a handler was found, else it returns False. |
| 72 |
} |
| 73 |
|
| 74 |
METHOD "" static XtAppContext getAppContext() {} |
| 75 |
METHOD "" static Display * getDisplay() {} |
| 76 |
METHOD "" static Widget getTopLevelWidget() |
| 77 |
{ |
| 78 |
These return information based on the top level widget returned by or |
| 79 |
passed to init. |
| 80 |
} |
| 81 |
|
| 82 |
METHOD "" static void show(Widget widget) {} |
| 83 |
METHOD "" static void hide(Widget widget) |
| 84 |
{ |
| 85 |
Convenience routines to show and hide the passed widget. |
| 86 |
\p |
| 87 |
For a shell widget, this is equivalent to calling |
| 88 |
\xRealizeWidget()\. + \xXMapWindow()\. or \xXMapRaised()\. |
| 89 |
if window already exists (raise and de-iconify). \mhide()\. will then |
| 90 |
call \xXUnmapWindow()\.. |
| 91 |
\p |
| 92 |
For a subwidget, those simply calls |
| 93 |
\xXtManageChild()\. and \xXtUnmanageChild()\.. |
| 94 |
} |
| 95 |
|
| 96 |
METHOD encodeStr static XmString encodeString(char *s) {} |
| 97 |
METHOD decodeStr static char * decodeString(XmString xs) |
| 98 |
{ |
| 99 |
These are convenience routines for encoding a character string |
| 100 |
as an |
| 101 |
\cXmString\., |
| 102 |
and decoding an |
| 103 |
\cXmString\. |
| 104 |
back to a character string. (\cXmString\. is a Motif string). |
| 105 |
The application is responsible for freeing up the memory pointed |
| 106 |
to by these return values. Use |
| 107 |
\xXmStringFree()\. |
| 108 |
to free an \cXmString\., and |
| 109 |
\xfree()\. |
| 110 |
to free a character pointer. |
| 111 |
} |
| 112 |
|
| 113 |
METHOD "" static void setWidgetSize(Widget w, const SbVec2s &size) {} |
| 114 |
METHOD "" static SbVec2s getWidgetSize(Widget w) |
| 115 |
{ |
| 116 |
Convenience routines to set/get the size of the given widget. Those |
| 117 |
are equivalent to calling |
| 118 |
\xXtSetValues()\. and \xXtGetValues()\. |
| 119 |
on \xXtNheight\. and \xXtNwidth\. widget resources. |
| 120 |
} |
| 121 |
|
| 122 |
METHOD "" static Widget getShellWidget(Widget w) |
| 123 |
{ |
| 124 |
Convenience routine which will return the ShellWidget |
| 125 |
containing the given widget. The widget tree is traversed up until |
| 126 |
a shell widget is found using |
| 127 |
\xXtIsShell()\.. |
| 128 |
} |
| 129 |
|
| 130 |
METHOD createSimpleErrDlg static void createSimpleErrorDialog( |
| 131 |
Widget widget, char *dialogTitle, char *errorStr1, char *errorStr2 = NULL) |
| 132 |
{ |
| 133 |
Convenience routine which brings a simple motif error dialog |
| 134 |
box displaying the given error string(s) and window title. The OK |
| 135 |
button, which destroys the dialog, is the only button displayed. |
| 136 |
The widget argument is used to create and center the dialog ( |
| 137 |
using \xXmCreateErrorDialog()\.). |
| 138 |
} |
| 139 |
|
| 140 |
METHOD "" static void getPopupArgs(Display *d, int scr, ArgList args, int *n) |
| 141 |
{ |
| 142 |
Convenience routine which gets visual args for the popup planes. |
| 143 |
These args can then be passed in to \xXmCreatePulldownMenu()\. or |
| 144 |
\xXmCreatePopupMenu()\. to create menus in the popup planes. |
| 145 |
\mregisterColormapLoad()\. must be called for each pulldown menu to |
| 146 |
properly load/unload the overlay color map on the shell when needed. |
| 147 |
} |
| 148 |
|
| 149 |
METHOD regColMapLoad static void registerColormapLoad(Widget widget, |
| 150 |
Widget shell) |
| 151 |
{ |
| 152 |
Convenience routine which will register map/unmap callbacks to |
| 153 |
load and unload the pulldown menu color map right before the menu |
| 154 |
is about to be posted. This should be called when creating |
| 155 |
pulldown or popup menus in the overlays. This will make sure that |
| 156 |
the right color map is loaded into the shell widget (to make |
| 157 |
the pulldown/popup look right) and remove it when no longer needed |
| 158 |
(to make sure the OpenGL overlay widget color map is correctly loaded |
| 159 |
for 8 bit machines). |
| 160 |
} |
| 161 |
|
| 162 |
METHOD "" static void addColormapToShell(Widget widget, Widget shell) {} |
| 163 |
METHOD remColMapFromShell static void removeColormapFromShell(Widget widget, |
| 164 |
Widget shell) |
| 165 |
{ |
| 166 |
Convenience routine to insert/remove the given widget colormap onto the |
| 167 |
supplied shell widget. This will not replace the existing |
| 168 |
installed colormaps (or list of windows), but instead insert |
| 169 |
the new colormap first into the existing list using \xXGetWMColormapWindows()\. |
| 170 |
and \xXSetWMColormapWindows()\.. |
| 171 |
} |
| 172 |
|
| 173 |
|
| 174 |
|
| 175 |
|
| 176 |
ALSO { SoXtComponent } |