1 /////////////////////////////////////////////////////////////////////////////
4 // Author: Robert Roebling
6 // Copyright: (c) 1998 Robert Roebling, Julian Smart
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
18 #include "wx/window.h"
21 //-----------------------------------------------------------------------------
23 //-----------------------------------------------------------------------------
28 //-----------------------------------------------------------------------------
30 //-----------------------------------------------------------------------------
32 extern wxApp
*wxTheApp
;
34 extern GdkVisual
*wxVisualSetByExternal
;
35 extern GdkColormap
*wxColormapSetByExternal
;
37 //-----------------------------------------------------------------------------
39 //-----------------------------------------------------------------------------
44 //-----------------------------------------------------------------------------
46 //-----------------------------------------------------------------------------
48 #define wxPRINT_WINDOWS 1
49 #define wxPRINT_POSTSCRIPT 2
51 //-----------------------------------------------------------------------------
53 //-----------------------------------------------------------------------------
55 class wxApp
: public wxEvtHandler
57 DECLARE_DYNAMIC_CLASS(wxApp
)
64 static void SetInitializerFunction(wxAppInitializerFunction fn
) { m_appInitFn
= fn
; }
65 static wxAppInitializerFunction
GetInitializerFunction() { return m_appInitFn
; }
67 /* this may have to be overwritten when special, non-default visuals have
68 to be set. it is also platform dependent as only X knows about displays
69 and visuals. by standard, this routine looks at wxVisualSetByExternal
70 which might have been set in the wxModule code of the OpenGL canvas */
71 virtual bool InitVisual();
73 virtual bool OnInit();
74 virtual bool OnInitGui();
78 wxWindow
*GetTopWindow();
79 void SetTopWindow( wxWindow
*win
);
80 virtual int MainLoop();
83 virtual bool Pending();
84 virtual void Dispatch();
86 inline void SetWantDebugOutput(bool flag
) { m_wantDebugOutput
= flag
; }
87 inline bool GetWantDebugOutput() { return m_wantDebugOutput
; }
89 void OnIdle( wxIdleEvent
&event
);
90 bool SendIdleEvents();
91 bool SendIdleEvents( wxWindow
* win
);
93 inline wxString
GetAppName() const
97 else return m_className
;
100 inline void SetAppName(const wxString
& name
) { m_appName
= name
; };
101 inline wxString
GetClassName() const { return m_className
; }
102 inline void SetClassName(const wxString
& name
) { m_className
= name
; }
103 const wxString
& GetVendorName() const { return m_vendorName
; }
104 void SetVendorName(const wxString
& name
) { m_vendorName
= name
; }
106 inline void SetExitOnFrameDelete(bool flag
) { m_exitOnFrameDelete
= flag
; }
107 inline bool GetExitOnFrameDelete() const { return m_exitOnFrameDelete
; }
109 void SetPrintMode(int WXUNUSED(mode
) ) {};
110 int GetPrintMode() const { return wxPRINT_POSTSCRIPT
; };
112 // override this function to create default log target of arbitrary
113 // user-defined classv (default implementation creates a wxLogGui object)
114 virtual wxLog
*CreateLogTarget();
116 // GTK implementation
118 static void CommonInit();
119 static void CommonCleanUp();
122 void DeletePendingObjects();
125 bool m_exitOnFrameDelete
;
126 bool m_wantDebugOutput
;
127 wxWindow
*m_topWindow
;
134 static wxAppInitializerFunction m_appInitFn
;
137 wxString m_vendorName
,
141 DECLARE_EVENT_TABLE()
144 #endif // __GTKAPPH__