]> git.saurik.com Git - wxWidgets.git/blob - include/wx/gtk/app.h
*** empty log message ***
[wxWidgets.git] / include / wx / gtk / app.h
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;
27
28 //-----------------------------------------------------------------------------
29 // global data
30 //-----------------------------------------------------------------------------
31
32 extern wxApp *wxTheApp;
33
34 //-----------------------------------------------------------------------------
35 // global functions
36 //-----------------------------------------------------------------------------
37
38 void wxExit(void);
39 bool wxYield(void);
40
41 //-----------------------------------------------------------------------------
42 // constants
43 //-----------------------------------------------------------------------------
44
45 #define wxPRINT_WINDOWS 1
46 #define wxPRINT_POSTSCRIPT 2
47
48 //-----------------------------------------------------------------------------
49 // wxApp
50 //-----------------------------------------------------------------------------
51
52 class wxApp: public wxEvtHandler
53 {
54 DECLARE_DYNAMIC_CLASS(wxApp)
55
56 public:
57
58 wxApp(void);
59 ~wxApp(void);
60
61 static void SetInitializerFunction(wxAppInitializerFunction fn) { m_appInitFn = fn; }
62 static wxAppInitializerFunction GetInitializerFunction(void) { return m_appInitFn; }
63 virtual bool OnInit(void);
64 virtual bool OnInitGui(void);
65 virtual int OnRun(void);
66 virtual bool OnIdle(void);
67 virtual int OnExit(void);
68
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);
76 void DeletePendingObjects(void);
77
78 inline wxString GetAppName(void) const {
79 if (m_appName != "")
80 return m_appName;
81 else return m_className;
82 }
83 inline void SetAppName(const wxString& name) { m_appName = name; };
84 inline wxString GetClassName(void) const { return m_className; }
85 inline void SetClassName(const wxString& name) { m_className = name; }
86
87 inline void SetExitOnFrameDelete(bool flag) { m_exitOnFrameDelete = flag; }
88 inline bool GetExitOnFrameDelete(void) const { return m_exitOnFrameDelete; }
89
90 void SetPrintMode(int WXUNUSED(mode) ) {};
91 int GetPrintMode(void) const { return wxPRINT_POSTSCRIPT; };
92
93 static void CommonInit(void);
94 static void CommonCleanUp(void);
95
96 // override this function to create default log target of arbitrary
97 // user-defined classv (default implementation creates a wxLogGui object)
98 virtual wxLog *CreateLogTarget();
99
100 bool m_initialized;
101 bool m_exitOnFrameDelete;
102 gint m_idleTag;
103 wxWindow *m_topWindow;
104 wxString m_appName;
105 wxString m_className;
106
107 int argc;
108 char **argv;
109
110 static wxAppInitializerFunction m_appInitFn;
111 };
112
113 #endif // __GTKAPPH__