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
; }
65 virtual bool OnInit(void);
66 virtual bool OnInitGui(void);
67 virtual int OnRun(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);
78 inline void SetWantDebugOutput(bool flag
) { m_wantDebugOutput
= flag
; }
79 inline bool GetWantDebugOutput(void) { return m_wantDebugOutput
; }
81 void OnIdle( wxIdleEvent
&event
);
82 bool SendIdleEvents(void);
83 bool SendIdleEvents( wxWindow
* win
);
85 inline wxString
GetAppName(void) const {
88 else return m_className
;
90 inline void SetAppName(const wxString
& name
) { m_appName
= name
; };
91 inline wxString
GetClassName(void) const { return m_className
; }
92 inline void SetClassName(const wxString
& name
) { m_className
= name
; }
93 const wxString
& GetVendorName() const { return m_vendorName
; }
94 void SetVendorName(const wxString
& name
) { m_vendorName
= name
; }
96 inline void SetExitOnFrameDelete(bool flag
) { m_exitOnFrameDelete
= flag
; }
97 inline bool GetExitOnFrameDelete(void) const { return m_exitOnFrameDelete
; }
99 void SetPrintMode(int WXUNUSED(mode
) ) {};
100 int GetPrintMode(void) const { return wxPRINT_POSTSCRIPT
; };
102 // override this function to create default log target of arbitrary
103 // user-defined classv (default implementation creates a wxLogGui object)
104 virtual wxLog
*CreateLogTarget();
107 // override this function to create a global wxConfig object of different
108 // than default type (right now the default implementation returns NULL)
109 virtual wxConfig
*CreateConfig() { return NULL
; }
112 // GTK implementation
114 static void CommonInit(void);
115 static void CommonCleanUp(void);
117 bool ProcessIdle(void);
118 void DeletePendingObjects(void);
121 bool m_exitOnFrameDelete
;
122 bool m_wantDebugOutput
;
123 wxWindow
*m_topWindow
;
128 static wxAppInitializerFunction m_appInitFn
;
131 wxString m_vendorName
,
135 DECLARE_EVENT_TABLE()
138 #endif // __GTKAPPH__