1 /////////////////////////////////////////////////////////////////////////////
4 // Author: Robert Roebling
7 // Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
18 #include "wx/window.h"
21 //-----------------------------------------------------------------------------
23 //-----------------------------------------------------------------------------
27 class wxConfig
; // it's not used #if !USE_WXCONFIG, but fwd decl doesn't harm
29 //-----------------------------------------------------------------------------
31 //-----------------------------------------------------------------------------
33 extern wxApp
*wxTheApp
;
35 //-----------------------------------------------------------------------------
37 //-----------------------------------------------------------------------------
42 //-----------------------------------------------------------------------------
44 //-----------------------------------------------------------------------------
46 #define wxPRINT_WINDOWS 1
47 #define wxPRINT_POSTSCRIPT 2
49 //-----------------------------------------------------------------------------
51 //-----------------------------------------------------------------------------
53 class wxApp
: public wxEvtHandler
55 DECLARE_DYNAMIC_CLASS(wxApp
)
62 static void SetInitializerFunction(wxAppInitializerFunction fn
) { m_appInitFn
= fn
; }
63 static wxAppInitializerFunction
GetInitializerFunction(void) { return m_appInitFn
; }
64 virtual bool OnInit(void);
65 virtual bool OnInitGui(void);
66 virtual int OnRun(void);
67 virtual bool OnIdle(void);
68 virtual int OnExit(void);
70 wxWindow
*GetTopWindow(void);
71 void SetTopWindow( wxWindow
*win
);
72 virtual int MainLoop(void);
73 void ExitMainLoop(void);
74 bool Initialized(void);
75 virtual bool Pending(void);
76 virtual void Dispatch(void);
77 void DeletePendingObjects(void);
79 inline wxString
GetAppName(void) const {
82 else return m_className
;
84 inline void SetAppName(const wxString
& name
) { m_appName
= name
; };
85 inline wxString
GetClassName(void) const { return m_className
; }
86 inline void SetClassName(const wxString
& name
) { m_className
= name
; }
88 inline void SetExitOnFrameDelete(bool flag
) { m_exitOnFrameDelete
= flag
; }
89 inline bool GetExitOnFrameDelete(void) const { return m_exitOnFrameDelete
; }
91 void SetPrintMode(int WXUNUSED(mode
) ) {};
92 int GetPrintMode(void) const { return wxPRINT_POSTSCRIPT
; };
94 static void CommonInit(void);
95 static void CommonCleanUp(void);
97 // override this function to create default log target of arbitrary
98 // user-defined classv (default implementation creates a wxLogGui object)
99 virtual wxLog
*CreateLogTarget();
102 // override this function to create a global wxConfig object of different
103 // than default type (right now the default implementation returns NULL)
104 virtual wxConfig
*CreateConfig() { return NULL
; }
108 bool m_exitOnFrameDelete
;
110 wxWindow
*m_topWindow
;
112 wxString m_className
;
117 static wxAppInitializerFunction m_appInitFn
;
120 #endif // __GTKAPPH__