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 //-----------------------------------------------------------------------------
36 //-----------------------------------------------------------------------------
41 //-----------------------------------------------------------------------------
43 //-----------------------------------------------------------------------------
45 #define wxPRINT_WINDOWS 1
46 #define wxPRINT_POSTSCRIPT 2
48 //-----------------------------------------------------------------------------
50 //-----------------------------------------------------------------------------
52 class wxApp
: public wxEvtHandler
54 DECLARE_DYNAMIC_CLASS(wxApp
)
61 static void SetInitializerFunction(wxAppInitializerFunction fn
) { m_appInitFn
= fn
; }
62 static wxAppInitializerFunction
GetInitializerFunction(void) { return m_appInitFn
; }
64 virtual bool OnInit(void);
65 virtual bool OnInitGui(void);
66 virtual int OnRun(void);
67 virtual int OnExit(void);
69 wxWindow
*GetTopWindow(void);
70 void SetTopWindow( wxWindow
*win
);
71 virtual int MainLoop(void);
72 void ExitMainLoop(void);
73 bool Initialized(void);
74 virtual bool Pending(void);
75 virtual void Dispatch(void);
77 inline void SetWantDebugOutput(bool flag
) { m_wantDebugOutput
= flag
; }
78 inline bool GetWantDebugOutput(void) { return m_wantDebugOutput
; }
80 void OnIdle( wxIdleEvent
&event
);
81 bool SendIdleEvents(void);
82 bool SendIdleEvents( wxWindow
* win
);
84 inline wxString
GetAppName(void) const {
87 else return m_className
;
89 inline void SetAppName(const wxString
& name
) { m_appName
= name
; };
90 inline wxString
GetClassName(void) const { return m_className
; }
91 inline void SetClassName(const wxString
& name
) { m_className
= name
; }
92 const wxString
& GetVendorName() const { return m_vendorName
; }
93 void SetVendorName(const wxString
& name
) { m_vendorName
= name
; }
95 inline void SetExitOnFrameDelete(bool flag
) { m_exitOnFrameDelete
= flag
; }
96 inline bool GetExitOnFrameDelete(void) const { return m_exitOnFrameDelete
; }
98 void SetPrintMode(int WXUNUSED(mode
) ) {};
99 int GetPrintMode(void) const { return wxPRINT_POSTSCRIPT
; };
101 // override this function to create default log target of arbitrary
102 // user-defined classv (default implementation creates a wxLogGui object)
103 virtual wxLog
*CreateLogTarget();
105 // GTK implementation
107 static void CommonInit(void);
108 static void CommonCleanUp(void);
110 bool ProcessIdle(void);
111 void DeletePendingObjects(void);
114 bool m_exitOnFrameDelete
;
115 bool m_wantDebugOutput
;
116 wxWindow
*m_topWindow
;
123 static wxAppInitializerFunction m_appInitFn
;
126 wxString m_vendorName
,
130 DECLARE_EVENT_TABLE()
133 #endif // __GTKAPPH__