1SoXt(3IV)()                                                        SoXt(3IV)()
2
3
4

NAME

6       SoXt — routines for Inventor/Xt compatibility.
7

INHERITS FROM

9       SoXt
10

SYNOPSIS

12       #include <Inventor/Xt/SoXt.h>
13
14          Methods from class SoXt:
15
16     static  Widget        init(const  char  *appName, const char *className =
17                               "Inventor")
18     static void          init(Widget topLevelWidget)
19     static void          mainLoop()
20     static void          nextEvent(XtAppContext appContext, XEvent *event)
21     static Boolean       dispatchEvent(XEvent *event)
22     static XtAppContext  getAppContext()
23     static Display *     getDisplay()
24     static Widget        getTopLevelWidget()
25     static void          show(Widget widget)
26     static void          hide(Widget widget)
27     static XmString      encodeString(char *s)
28     static char *        decodeString(XmString xs)
29     static void          setWidgetSize(Widget w, const SbVec2s &size)
30     static SbVec2s       getWidgetSize(Widget w)
31     static Widget        getShellWidget(Widget w)
32     static    void          createSimpleErrorDialog(Widget    widget,    char
33                               *dialogTitle,  char *errorStr1, char *errorStr2
34                               = NULL)
35     static void          getPopupArgs(Display *d, int scr, ArgList args,  int
36                               *n)
37     static void          registerColormapLoad(Widget widget, Widget shell)
38     static void          addColormapToShell(Widget widget, Widget shell)
39     static void          removeColormapFromShell(Widget widget, Widget shell)
40
41

DESCRIPTION

43       The  SoXt  class  initializes  Inventor for use with the Xt toolkit and
44       Motif. SoXt::init() must be called in order for Inventor to work  prop‐
45       erly  with  Xt.  SoXt::mainLoop() must be called in order for extension
46       device events to be passed to Inventor render areas. The other  methods
47       are convenience functions.
48
49       Refer  to  the  SoXtComponent  man pages for examples on how this class
50       should be used when using Inventor Xt components.
51

METHODS

53     static Widget        init(const char *appName, const  char  *className  =
54                               "Inventor")
55          This is called to initialize Inventor and Xt, and bind Inventor with
56          Xt event handling so that Inventor sensors will work correctly. This
57          returns   the   top  level  shell  widget.  This  method  will  call
58          SoDB::init(), SoNodeKit::init(), SoInteraction::init() and XtAppIni‐
59          tialize().
60
61     static void          init(Widget topLevelWidget)
62          This alternate form of init allows the application to initialize Xt.
63          The passed widget should be the top level shell widget returned from
64          the  Xt  initializiation.  This  method will call SoDB::init(), SoN‐
65          odeKit::init(), SoInteraction::init() and XtAppInitialize().
66
67     static void          mainLoop()
68          This retrieves and dispatches  events  (loops  forever).  Unlike  Xt
69          which  ignores  extension devices (i.e. any device besides mouse and
70          keyboard), this main loop will dispatch events from input  extension
71          devices   like   the   spaceball.  It  calls  SoXt::nextEvent()  and
72          SoXt::dispatchEvent() to do this. If only  the  mouse  and  keyboard
73          devices are used, this is equivalent to calling XtAppMainLoop().
74
75     static void          nextEvent(XtAppContext appContext, XEvent *event)
76          Get the nextEvent by calling XtAppNextEvent(). The appContext can be
77          had by calling SoXt::getAppContext().
78
79     static Boolean       dispatchEvent(XEvent *event)
80          Dispatch the passed event to a handler. Mouse  and  keyboard  events
81          are  dispatched  by  calling  XtDispatchEvent().  Events  from input
82          extension devices are dispatched by code implemented  in  this  rou‐
83          tine.  This  returns  True  if  a handler was found, else it returns
84          False.
85
86     static XtAppContext  getAppContext()
87     static Display *     getDisplay()
88     static Widget        getTopLevelWidget()
89          These return information based on the top level widget  returned  by
90          or passed to init.
91
92     static void          show(Widget widget)
93     static void          hide(Widget widget)
94          Convenience routines to show and hide the passed widget.
95
96          For  a shell widget, this is equivalent to calling RealizeWidget() +
97          XMapWindow() or XMapRaised() if window already exists (raise and de-
98          iconify). hide() will then call XUnmapWindow().
99
100          For  a  subwidget,  those  simply calls XtManageChild() and XtUnman‐
101          ageChild().
102
103     static XmString      encodeString(char *s)
104     static char *        decodeString(XmString xs)
105          These are convenience routines for encoding a character string as an
106          XmString,  and  decoding  an  XmString  back  to a character string.
107          (XmString is a Motif string). The  application  is  responsible  for
108          freeing  up  the  memory  pointed  to  by  these  return values. Use
109          XmStringFree() to free an XmString, and free() to free  a  character
110          pointer.
111
112     static void          setWidgetSize(Widget w, const SbVec2s &size)
113     static SbVec2s       getWidgetSize(Widget w)
114          Convenience  routines to set/get the size of the given widget. Those
115          are  equivalent  to  calling  XtSetValues()  and  XtGetValues()   on
116          XtNheight and XtNwidth widget resources.
117
118     static Widget        getShellWidget(Widget w)
119          Convenience routine which will return the ShellWidget containing the
120          given widget. The widget tree is traversed up until a  shell  widget
121          is found using XtIsShell().
122
123     static    void          createSimpleErrorDialog(Widget    widget,    char
124                               *dialogTitle, char *errorStr1, char  *errorStr2
125                               = NULL)
126          Convenience  routine  which  brings  a simple motif error dialog box
127          displaying the given error string(s) and window title. The  OK  but‐
128          ton,  which  destroys  the dialog, is the only button displayed. The
129          widget argument is used to create and  center  the  dialog  (  using
130          XmCreateErrorDialog()).
131
132     static  void          getPopupArgs(Display *d, int scr, ArgList args, int
133                               *n)
134          Convenience routine which gets visual args  for  the  popup  planes.
135          These args can then be passed in to XmCreatePulldownMenu() or XmCre‐
136          atePopupMenu() to create menus in  the  popup  planes.  registerCol‐
137          ormapLoad()  must  be  called  for  each  pulldown  menu to properly
138          load/unload the overlay color map on the shell when needed.
139
140     static void          registerColormapLoad(Widget widget, Widget shell)
141          Convenience routine which will register map/unmap callbacks to  load
142          and  unload  the  pulldown  menu  color map right before the menu is
143          about to be posted. This should be called when creating pulldown  or
144          popup  menus  in  the  overlays.  This will make sure that the right
145          color map is loaded  into  the  shell  widget  (to  make  the  pull‐
146          down/popup  look right) and remove it when no longer needed (to make
147          sure the OpenGL overlay widget color map is correctly loaded  for  8
148          bit machines).
149
150     static void          addColormapToShell(Widget widget, Widget shell)
151     static void          removeColormapFromShell(Widget widget, Widget shell)
152          Convenience  routine to insert/remove the given widget colormap onto
153          the supplied shell  widget.  This  will  not  replace  the  existing
154          installed colormaps (or list of windows), but instead insert the new
155          colormap first into the existing list using  XGetWMColormapWindows()
156          and XSetWMColormapWindows().
157
158

SEE ALSO

160       SoXtComponent
161
162
163
164
165                                                                   SoXt(3IV)()
Impressum