Gizmo3D

gzApplication.h

Go to the documentation of this file.
00001 //*****************************************************************************
00002 // File         : gzApplication.h
00003 // Module       : 
00004 // Description  : Class definition of the gzApplication class
00005 // Author       : Anders Modén      
00006 // Product      : Gizmo3D 2.1.1
00007 //      
00008 // Copyright © 2003- Saab Training Systems AB, Sweden   
00009 //          
00010 // NOTE:    Gizmo3D is a high performance 3D Scene Graph and effect visualisation 
00011 //          C++ toolkit for Linux, Mac OS X, Windows (Win32) and IRIX® for  
00012 //          usage in Game or VisSim development.
00013 //
00014 //
00015 // Revision History...                          
00016 //                                  
00017 // Who  Date    Description                     
00018 //                                  
00019 // AMO  981027  Created file    
00020 //
00021 //******************************************************************************
00022 #ifndef __GZ_APPLICATION_H__
00023 #define __GZ_APPLICATION_H__
00024 
00030 #include "gzBase.h"
00031 #include "gzThread.h"
00032 #include "gzNotify.h"
00033 #include "gzGraphicsAbstractionLayer.h"
00034 
00035 #ifdef GZ_WIN32 
00036 // ------------------------  GZ_WIN32 ---------------------------------
00037 
00038 class gzAppContext
00039 {
00040 public:
00041     HINSTANCE       instance;
00042     gzDeviceContext display;
00043 };
00044 
00045 #elif defined GZ_GLX
00046 // ------------------------ UNIX ----------------------------------- 
00047 
00048 #include "X11/Intrinsic.h"
00049 #include "X11/Xlib.h"
00050 
00051 class gzAppContext
00052 {
00053 public:
00054     gzDeviceContext display;
00055     XtAppContext    context;
00056 };
00057 
00058 #elif defined GZ_MAC
00059 // ------------------------ Mac OS X ------------------------------ 
00060 
00061 class gzAppContext
00062 {
00063 public:
00064     gzDeviceContext display;
00065     gzULong         context;
00066 };
00067 
00068 #endif // ------------------------ COMMON ---------------------------------
00069 
00070 
00071 //******************************************************************************
00072 // Class    : gzApplication
00073 //                                  
00074 // Purpose  : -
00075 //                                  
00076 // Notes    : - 
00077 //                                  
00078 // Revision History...                          
00079 //                                  
00080 // Who  Date    Description                     
00081 //                                  
00082 // AMO  981027  Created 
00083 //                                  
00084 //******************************************************************************
00085 class gzApplication : public gzNotifyManager , public gzReference , public gzProgramExecution
00086 {
00087 public:
00088 
00089     GZ_SYSTEM_EXPORT gzApplication(const gzString & name="GIZMO APPLICATION" , int argc=0 , char **argv=NULL ,gzDeviceContext dc=NULL);
00090 
00091     GZ_SYSTEM_EXPORT virtual ~gzApplication();
00092 
00094     GZ_SYSTEM_EXPORT gzVoid run();
00095 
00097     GZ_SYSTEM_EXPORT gzVoid stop();
00098 
00100 
00101     GZ_SYSTEM_EXPORT gzInt  poll(gzBool forceExecNotifications=TRUE);
00102 
00103 
00104     GZ_SYSTEM_EXPORT virtual gzVoid onIdle();
00105 
00106     GZ_SYSTEM_EXPORT virtual gzVoid onTick();
00107 
00108     GZ_SYSTEM_EXPORT gzVoid setTickInterval( gzDouble seconds );
00109 
00110     GZ_SYSTEM_EXPORT gzAppContext getAppContext();
00111     
00112     GZ_SYSTEM_EXPORT static gzApplication *getGizmoApplication();
00113 
00114 #if defined GZ_GLX 
00115 // -------------------------------  UNIX ---------------------------------
00116 
00117     gzInt   getWMProtocolLength()   { return 1; }
00118     Atom *  getWMProtocol()         { return &m_wm_delete_window; }
00119     
00120 #endif // ------------------------ COMMON ---------------------------------
00121 
00122 
00123 private:
00124 
00125     GZ_SYSTEM_EXPORT virtual gzVoid onProgramExecution();
00126         
00127     friend class gzWindow;
00128 
00129     gzString    m_appName;
00130 
00131     gzDouble    m_tickIntervalTime;
00132 
00133     gzDouble    m_nextTickTime;
00134 
00135     gzBool      m_isRunning;
00136     
00137     gzAppContext m_appContext;
00138     
00139 #if defined GZ_GLX
00140 // ------------------  UNIX ---------------------------------
00141 
00142     static Boolean workproc( XtPointer clientData);
00143 
00144     Atom m_wm_protocols;
00145     Atom m_wm_delete_window;
00146     
00147 #elif defined GZ_MAC
00148 
00149     EventLoopTimerUPP m_timerUPP;
00150 
00151     static void AppTimer(EventLoopTimerRef theTimer,void *userData);
00152 
00153 #endif // ------------------------ COMMON ---------------------------------
00154 
00155     static gzRefPointer<gzApplication>  s_gizmoApplication;
00156 
00157 };
00158 
00159 
00160 
00161 #endif // __GZ_APPLICATION_H__

Documentation for Gizmo3D generated at Wed Feb 20 11:54:02 2008 by   Saab Training Systems AB, ¸ (c) 2003-and beyond