]>
Commit | Line | Data |
---|---|---|
c801d85f KB |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: app.h | |
3 | // Purpose: | |
4 | // Author: Robert Roebling | |
5 | // Created: 01/02/97 | |
6 | // Id: | |
7 | // Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem | |
8 | // Licence: wxWindows licence | |
9 | ///////////////////////////////////////////////////////////////////////////// | |
10 | ||
11 | #ifndef __GTKAPPH__ | |
12 | #define __GTKAPPH__ | |
13 | ||
14 | #ifdef __GNUG__ | |
15 | #pragma interface | |
16 | #endif | |
17 | ||
18 | #include "wx/window.h" | |
19 | #include "wx/frame.h" | |
20 | ||
21 | //----------------------------------------------------------------------------- | |
22 | // classes | |
23 | //----------------------------------------------------------------------------- | |
24 | ||
25 | class wxApp; | |
26 | class wxLog; | |
6a06dd8d | 27 | class wxConfig; // it's not used #if !USE_WXCONFIG, but fwd decl doesn't harm |
c801d85f KB |
28 | |
29 | //----------------------------------------------------------------------------- | |
30 | // global data | |
31 | //----------------------------------------------------------------------------- | |
32 | ||
33 | extern wxApp *wxTheApp; | |
34 | ||
35 | //----------------------------------------------------------------------------- | |
36 | // global functions | |
37 | //----------------------------------------------------------------------------- | |
38 | ||
39 | void wxExit(void); | |
40 | bool wxYield(void); | |
41 | ||
42 | //----------------------------------------------------------------------------- | |
43 | // constants | |
44 | //----------------------------------------------------------------------------- | |
45 | ||
46 | #define wxPRINT_WINDOWS 1 | |
47 | #define wxPRINT_POSTSCRIPT 2 | |
48 | ||
49 | //----------------------------------------------------------------------------- | |
50 | // wxApp | |
51 | //----------------------------------------------------------------------------- | |
52 | ||
53 | class wxApp: public wxEvtHandler | |
54 | { | |
55 | DECLARE_DYNAMIC_CLASS(wxApp) | |
56 | ||
57 | public: | |
58 | ||
59 | wxApp(void); | |
60 | ~wxApp(void); | |
61 | ||
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); | |
69 | ||
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); | |
78 | ||
79 | inline wxString GetAppName(void) const { | |
80 | if (m_appName != "") | |
81 | return m_appName; | |
82 | else return m_className; | |
83 | } | |
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; } | |
87 | ||
88 | inline void SetExitOnFrameDelete(bool flag) { m_exitOnFrameDelete = flag; } | |
89 | inline bool GetExitOnFrameDelete(void) const { return m_exitOnFrameDelete; } | |
90 | ||
91 | void SetPrintMode(int WXUNUSED(mode) ) {}; | |
92 | int GetPrintMode(void) const { return wxPRINT_POSTSCRIPT; }; | |
93 | ||
94 | static void CommonInit(void); | |
95 | static void CommonCleanUp(void); | |
96 | ||
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(); | |
100 | ||
6a06dd8d VZ |
101 | #if USE_WXCONFIG |
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; } | |
105 | #endif | |
106 | ||
c801d85f KB |
107 | bool m_initialized; |
108 | bool m_exitOnFrameDelete; | |
109 | gint m_idleTag; | |
110 | wxWindow *m_topWindow; | |
111 | wxString m_appName; | |
112 | wxString m_className; | |
113 | ||
114 | int argc; | |
115 | char **argv; | |
116 | ||
117 | static wxAppInitializerFunction m_appInitFn; | |
118 | }; | |
119 | ||
120 | #endif // __GTKAPPH__ |