29# include <Inventor/Win/SoWinBeginStrict.h>
33# include <Inventor/Win/SoXt2SoWin.h>
34# include <Inventor/Win/SoWinDef.h>
35# include <Inventor/SbBasic.h>
36# include <SoVersion.h>
37# include <Inventor/Gui/SoGui.h>
38# define RESOURCE_DLL "Error: SoWin resources not loaded\n Cannot find InventorR.DLL"
42#include <Inventor/threads/SbThreadMutex.h>
43#include <Inventor/helpers/SbGlContextHelper.h>
45#include <Inventor/Win/SoInventorWinLibName.h>
47#include <Inventor/SoModule.h>
48SO_MODULE_HEADER(SoInventorWin, __INVENTORWINDLL)
50#ifndef InventorWin_EXPORTS
51#ifndef OIV_DISABLE_AUTOLINK
52# pragma comment(lib,__INVENTORWINLIB)
56#include <Inventor/SbBasic.h>
57#include <Inventor/SbLinear.h>
58#include <Inventor/sys/SoDynamicLibManager.h>
62class SoWinEventHandler;
63class SoOffscreenRenderer;
77class SoWinMessageHook;
81#ifndef WM_ENTERSIZEMOVE
82#define WM_ENTERSIZEMOVE 0x0231
84#ifndef WM_EXITSIZEMOVE
85#define WM_EXITSIZEMOVE 0x0232
91extern CRITICAL_SECTION SoWinGLSection;
93#define SOWIN_ENTER_GL_SECTION()\
94EnterCriticalSection(&SoWinGLSection)
96#define SOWIN_LEAVE_GL_SECTION()\
97LeaveCriticalSection(&SoWinGLSection)
99#define SOWIN_LEAVE_GL_SECTIONR()\
101LeaveCriticalSection(&SoWinGLSection);\
105#define SOWIN_LEAVE_GL_SECTIONRV(v)\
107LeaveCriticalSection(&SoWinGLSection);\
111#define SOWIN_TIMER_MSG SoWin::wmTimerMsg
112#define SOWIN_WORK_MSG SoWin::wmWorkMsg
116#define SOWIN_ENTER_GL_SECTION()
117#define SOWIN_LEAVE_GL_SECTION()
118#define SOWIN_LEAVE_GL_SECTIONR()
119#define SOWIN_LEAVE_GL_SECTIONRV(v)
156 static SoWidget
init(
const char *appName,
166 static void init( SoWidget topLevelWidget );
288 static void exit(
int returnCode = 0);
370 char *errorStr1,
char *errorStr2 = NULL);
403 static bool peekEvent(
XEvent *event);
412 static LRESULT isInventorMessage(HWND hwnd, UINT message,
413 WPARAM wParam, LPARAM lParam);
416 static void terminate(
long terminateSyncTime = 100);
420 static SbBool PreTranslateMessage(MSG *event);
422 static UINT wmTimerMsg;
423 static UINT wmWorkMsg;
428 static void addExtensionEventHandler(SoWidget w,
429 int extensionEventType,
432 static void removeExtensionEventHandler(SoWidget w,
433 int extensionEventType,
438 static ATOM registerClass(WNDCLASS *pWndClass,
char *actualClassName);
442 char *actualClassName, WNDCLASS *pClassInfo);
445 static void unregisterProcessClasses();
448 static void addMessageHook(Hwnd hwnd, UINT msg);
449 static void removeMessageHook(Hwnd hwnd, UINT msg);
455 static void setInstance(Hinst hInst);
456 static Hinst getInstance(
void);
458 static const SoDynamicLibManager::SafeLibraryHandle& getResDllSafeHandle();
460 static void setPrevInstance(Hinst hInst);
462 static void setCmdLine(LPSTR cmdLine);
464 static void setCmdShow(
int cmdShow);
469 static SoWinEventHandler *getEventHandler();
484 static void registerUIThread(uint32_t threadId = 0);
486 static void forwardQueryPalette(Window hWnd);
487 static void forwardPaletteChanged(Window hWnd);
489 static SbBool handleCtl3DMessage();
491 static void setHandleCtl3DMessage(
SbBool n);
493 static void Ctl3dColorChange();
498 static void errorHandlerCB(
const SoError *error,
void *data);
499 static void errorHandlerCBMessageBox(
const SoError *error,
void *userData);
502 static SoOffscreenRenderer *getOffscreenRenderer();
509 static SbConfig * getConfig(
void);
510 static void setConfig(SbConfig *);
511 static void setConfigFilename(
char*);
512 static char * getConfigFilename(
void);
514 static void addAccelerator(ACCEL accel);
517 static FARPROC m_procCtl3dColorChange;
518 static HINSTANCE m_hCtl3d;
519 static void getExtensionEventHandler(
XEvent *event, SoWidget &w,
520 XtEventHandler &proc,
526 static void activeLoop();
528 static int s_returnCode;
530 static bool internalMainWidget;
531 static SoWidget mainWidget;
532 static SoWinEventHandler *eventHandler;
536 static SbBool nHandleCtl3D;
542 static void loadResourceDll();
545 static Hinst hInstance;
546 static Hinst hPrevInstance;
547 static LPTSTR lpszCmdLine;
549 static SoDynamicLibManager::SafeLibraryHandle hResDll;
552 struct RegisteredClassStruct
557 static SbPList registeredClassList;
560 friend class SoWinTimerManager;
561 friend class SoWinEventHandler;
564 static HWND createThreadWindow(SoWinTimerManager *pTimerManager);
574 static LRESULT CALLBACK WindowProc(Hwnd hwnd, UINT message,
575 WPARAM wParam, LPARAM lParam);
579 static SoOffscreenRenderer *m_pRenderer;
582 static SbBool s_useOldErrorHandler;
584 static SbConfig *config;
585 static char *configFile;
587 static HACCEL m_haccel;
589 static int s_initRefCount;
590 static bool shouldExit;
601# include <Inventor/Win/SoWinEndStrict.h>
List of generic (void *) pointers.
Class for smart character strings.
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Portable mutex c...
Abstract base class for all actions.
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Creates a Win32 ...
Error handling base class.
Base class for all events.
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Routines for Ope...
static void show(SoWidget w)
Convenience routine to show the passed window handle.
static XtAppContext getAppContext()
This method is included for portability only.
static SoConsole * getErrorConsole(void)
Returns the VSG error console.
static void doIdleTasks(void)
If you use SoWin::mainLoop or SoWin::nextEvent, Inventor automatically calls this when the Windows me...
static SbBool nextEvent(XtAppContext appContext, XEvent *event)
Get the nextEvent by calling GetMessage.
static SoDEPRECATED SoWidget threadInit(const char *appName, const char *className="Inventor")
This method calls XXX::threadInit(), rather than XXX::init().
static void setWidgetSize(SoWidget w, const SbVec2s &size)
Convenience routine to set the size of the given window.
static void exit(int returnCode=0)
Tells the main event loop to exit with a return code.
static void init()
This alternate form of init does not require a top level window.
static SoWidget init(const char *appName, const char *className="Inventor")
This is called to initialize Open Inventor and Windows, and bind Open Inventor with Windows message h...
static SoWidget getTopLevelWidget()
Returns information based on the initial window handle returned by or passed to init.
static bool isInitialized()
Returns TRUE if SoWin module is currently initialized.
static SbVec2s getWidgetSize(SoWidget w)
Convenience routine to get the size of the given window.
static SoDEPRECATED void threadInit(SoWidget topLevelWidget)
This method calls XXX::threadInit(), rather than XXX::init().
static SbGlContextHelper::Display getDisplay()
This method is included for portability only.
static SoWidget getShellWidget(SoWidget w)
Convenience routine which will return the topmost window containing the given window handle.
static void getPopupArgs(UINT *d, int scr, ArgList args, int *n)
This method is included for portability only.
static char * decodeString(XmString xs)
This method is included for portability only.
static Boolean dispatchEvent(XEvent *event)
Dispatch the passed message to a handler.
static SoDEPRECATED void threadInit()
This method calls XXX::threadInit(), rather than XXX::init().
static void addColormapToShell(SoWidget widget, SoWidget shell)
This method is included for portability only.
static XmString encodeString(char *s)
This method is included for portability only.
static void finish()
Frees Open Inventor's internal static memory allocations.
static void createSimpleErrorDialog(SoWidget widget, char *dialogTitle, char *errorStr1, char *errorStr2=NULL)
Convenience routine which brings a simple Windows error dialog box displaying the given error string(...
static void init(SoWidget topLevelWidget)
This alternate form of init allows the application to initialize Windows.
static int mainLoop()
Enters the main event loop and waits until exit() is called or a WM_QUIT message is sent to the messa...
static void hide(SoWidget w)
Convenience routine to hide the passed window handle.
struct _XtAppStruct * XtAppContext