Open Inventor Release 2024.1.2
 
Loading...
Searching...
No Matches
SoXt.h
1/*=======================================================================
2 * Copyright 1991-1996, Silicon Graphics, Inc.
3 * ALL RIGHTS RESERVED
4 *
5 * UNPUBLISHED -- Rights reserved under the copyright laws of the United
6 * States. Use of a copyright notice is precautionary only and does not
7 * imply publication or disclosure.
8 *
9 * U.S. GOVERNMENT RESTRICTED RIGHTS LEGEND:
10 * Use, duplication or disclosure by the Government is subject to restrictions
11 * as set forth in FAR 52.227.19(c)(2) or subparagraph (c)(1)(ii) of the Rights
12 * in Technical Data and Computer Software clause at DFARS 252.227-7013 and/or
13 * in similar or successor clauses in the FAR, or the DOD or NASA FAR
14 * Supplement. Contractor/manufacturer is Silicon Graphics, Inc.,
15 * 2011 N. Shoreline Blvd. Mountain View, CA 94039-7311.
16 *
17 * THE CONTENT OF THIS WORK CONTAINS CONFIDENTIAL AND PROPRIETARY
18 * INFORMATION OF SILICON GRAPHICS, INC. ANY DUPLICATION, MODIFICATION,
19 * DISTRIBUTION, OR DISCLOSURE IN ANY FORM, IN WHOLE, OR IN PART, IS STRICTLY
20 * PROHIBITED WITHOUT THE PRIOR EXPRESS WRITTEN PERMISSION OF SILICON
21 * GRAPHICS, INC.
22**=======================================================================*/
23/*=======================================================================
24** Author : Nick Thompson (MMM yyyy)
25** Modified by : Paul Isaacs (MMM yyyy)
26** Modified by : David Mott (MMM yyyy)
27** Modified by : Gavin Bell (MMM yyyy)
28**=======================================================================*/
29/*=======================================================================
30 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), ***
31 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. ***
32 *** ***
33 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS ***
34 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR ***
35 *** WRITTEN AUTHORIZATION OF FEI S.A.S. ***
36 *** ***
37 *** RESTRICTED RIGHTS LEGEND ***
38 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS ***
39 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN ***
40 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT ***
41 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN ***
42 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. ***
43 *** ***
44 *** COPYRIGHT (C) 1996-2023 BY FEI S.A.S, ***
45 *** BORDEAUX, FRANCE ***
46 *** ALL RIGHTS RESERVED ***
47**=======================================================================*/
48/*=======================================================================
49** Modified by : VSG (MMM YYYY)
50**=======================================================================*/
51
52#ifdef SOQT
53# include <Inventor/Qt/SoQt.h>
54#elif defined(_WIN32)
55# include <Inventor/Win/SoXt2SoWin.h>
56# include <Inventor/Win/SoWin.h>
57#else
58
59#ifndef _SO_XT_
60#define _SO_XT_
61
62#include <SbTypes.h>
63#include <Xm/Xm.h>
64#include <Inventor/SbBasic.h>
65#include <Inventor/SbLinear.h>
66#include <Inventor/Xt/SoXtDef.h>
67#include <Inventor/Xt/SoXtLocalisation.h>
68#include <Inventor/Xt/SoInventorXtLibName.h>
69
70#include <Inventor/SoModule.h>
71SO_MODULE_HEADER(SoInventorXt, __INVENTORXTDLL)
72
73class SbPList;
74class SoXtEventHandler;
75class SoAction;
76
99class SoXt {
100
101 public:
109 static SoWidget init(const char *appName,
110 const char *className = "Inventor");
111
118 static void init(SoWidget topLevelWidget);
119
120#if 1
121 /*
122 * @UNICODE_WARNING
123 */SoDEPRECATED
125 static SoWidget threadInit(const char *appName,
126 const char *className = "Inventor");
127SoDEPRECATED
129 static void threadInit(SoWidget topLevelWidget);
130#endif
135 static bool isInitialized();
136
196 static void finish();
197
204 static int mainLoop();
205
214 static void exit(int returnCode = 0);
215
220 static void nextEvent(XtAppContext appContext, XEvent *event)
221 { XtAppNextEvent(appContext, event); }
222
228
233
237 static Display *getDisplay();
238
242 static SoWidget getTopLevelWidget();
243
244 //
245 // Convenience routines
246 //
247
252 static void show(SoWidget widget);
253
258 static void hide(SoWidget widget);
259
268 static XmString encodeString(char *s);
269
278 static char *decodeString(XmString xs);
279
283 static void setWidgetSize(SoWidget w, const SbVec2s &size);
284
288 static SbVec2s getWidgetSize(SoWidget w);
289
295 static SoWidget getShellWidget(SoWidget w);
296
302 static void createSimpleErrorDialog(SoWidget widget, char *dialogTitle,
303 char *errorStr1, char *errorStr2 = NULL);
304
311 static void getPopupArgs(Display *d, int scr, ArgList args, int *n);
312
321 static void registerColormapLoad(SoWidget widget, SoWidget shell);
322
329 static void addColormapToShell(SoWidget widget, SoWidget shell);
330
335 static void removeColormapFromShell(SoWidget widget, SoWidget shell);
336
337 private:
338 // Add/remove the passed event handler for X extension device events
339 // (Xt does not handle extension events.)
340 // Extension event types are queried from the server at runtime.
341 static void addExtensionEventHandler(SoWidget w,
342 int extensionEventType,
343 XtEventHandler proc,
344 XtPointer clientData);
345 static void removeExtensionEventHandler(SoWidget w,
346 int extensionEventType,
347 XtEventHandler proc,
348 XtPointer clientData);
349
350 // This method is an acces method to label (Widgets).
351
352 // This method is an acces method to label ( Widgets ).
353 // Begin
354 static SoWidget getwidget( unsigned int whatisit );
355 // End
356
357 static void canExit(SbBool ce);
358
359 static void setEventHandler();
360
361 static SoXtEventHandler *eventHandler;
362
363 private:
364 static void getExtensionEventHandler(
365 XEvent *event,
366 SoWidget &w,
367 XtEventHandler &proc,
368 XtPointer &clientData);
369
370 private:
375 static void activeLoop();
376
377 static int s_returnCode;
378
379 static SoWidget mainWidget;
380 static bool m_internalApp;
381 static SbBool m_canExit;
382
383 static SbPList *handlerList;
384
385 // Begin
386 // Widgets for localisation.
387 static SoWidget label[155];
388
389 static void localisationlabel(SoWidget parent);
390 // End
391
392 // setup display in Inventor for GL extensions check
393 static void setupInventorGLDisplay();
394
395 static int s_initRefCount;
396 static const char *s_versionString;
397};
398
399#endif /* _SO_XT_ */
400
401#endif // SOQT
402
List of generic (void *) pointers.
Definition SbPList.h:77
2D vector class.
Definition SbVec.h:700
Abstract base class for all actions.
Definition SoAction.h:132
Routines for Open Inventor/Xt compatibility.
Definition SoXt.h:99
static void registerColormapLoad(SoWidget widget, SoWidget shell)
Convenience routine which will register map/unmap callbacks to load and unload the pulldown menu colo...
static void getPopupArgs(Display *d, int scr, ArgList args, int *n)
Convenience routine which gets visual args for the popup planes.
static void exit(int returnCode=0)
Tells the main event loop to exit with a return code.
static Boolean dispatchEvent(XEvent *event)
Dispatches the passed event to a handler.
static int mainLoop()
Enters the main event loop and waits until exit() is called.
static void nextEvent(XtAppContext appContext, XEvent *event)
Gets the nextEvent by calling XtAppNextEvent().
Definition SoXt.h:220
static XtAppContext getAppContext()
This method is included for portability only.
static void removeColormapFromShell(SoWidget widget, SoWidget shell)
Convenience routine to remove the given widget colormap from the supplied shell 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) an...
static XmString encodeString(char *s)
Convenience routine for encoding a character string as an XmString .
static void show(SoWidget widget)
Convenience routine to show the passed widget.
static bool isInitialized()
Returns TRUE if SoXt module is currently initialized.
static SoWidget getShellWidget(SoWidget w)
Convenience routine which will return the topmost window containing the given widget.
static void hide(SoWidget widget)
Convenience routine to hide the passed widget.
static SoDEPRECATED SoWidget threadInit(const char *appName, const char *className="Inventor")
static void finish()
Frees Open Inventor's internal static memory allocations.
static void init(SoWidget topLevelWidget)
This alternate form of init allows the application to initialize Xt.
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...
static SbVec2s getWidgetSize(SoWidget w)
Convenience routine to get the size of the given window.
static void setWidgetSize(SoWidget w, const SbVec2s &size)
Convenience routine to set the size of the given window.
static void addColormapToShell(SoWidget widget, SoWidget shell)
Convenience routine to insert the given widget colormap onto the supplied shell widget.
static SoWidget getTopLevelWidget()
Returns information based on the initial widget returned by or passed to init.
static Display * getDisplay()
This method is included for portability only.
static SoDEPRECATED void threadInit(SoWidget topLevelWidget)
static char * decodeString(XmString xs)
Convenience routine for decoding an XmString back to a character string.
int SbBool
Boolean type.
Definition SbBase.h:87
union _XEvent XEvent
Definition SoQtDef.h:126
char Boolean
Definition SoQtDef.h:124
struct _XtAppStruct * XtAppContext
Definition SoQtDef.h:130
void * XtPointer
Definition SoQtDef.h:122