]> git.saurik.com Git - wxWidgets.git/blob - include/wx/app.h
*** empty log message ***
[wxWidgets.git] / include / wx / app.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: app.h
3 // Purpose: wxApp inclusion
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 01/02/97
7 // RCS-ID: $Id$
8 // Copyright: (c) Julian Smart and Markus Holzem
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef __APPH_BASE__
13 #define __APPH_BASE__
14
15 /*
16 class WXDLLEXPORT wxApp;
17 typedef wxApp* (*wxAppInitializerFunction) (void);
18 */
19
20 #include "wx/object.h"
21
22 typedef wxObject* (*wxAppInitializerFunction) (void); // returning wxApp* won't work with gcc
23
24 #if defined(__WINDOWS__)
25 #include "wx/msw/app.h"
26 #elif defined(__MOTIF__)
27 #include "wx/xt/app.h"
28 #elif defined(__GTK__)
29 #include "wx/gtk/app.h"
30 #endif
31
32
33 // Having a global instance of this class allows
34 // wxApp to be aware of the app creator function.
35 // wxApp can then call this function to create a new
36 // app object. Convoluted, but necessary.
37
38 class WXDLLEXPORT wxAppInitializer
39 {
40 public:
41 wxAppInitializer(wxAppInitializerFunction fn)
42 {
43 wxApp::SetInitializerFunction(fn);
44 }
45 };
46
47 #define IMPLEMENT_APP(appname) \
48 wxApp *wxCreateApp(void) { return new appname; } \
49 wxAppInitializer wxTheAppInitializer((wxAppInitializerFunction) wxCreateApp); \
50 appname& wxGetApp(void) { return *(appname *)wxTheApp; } \
51 \
52 extern int wxEntry( int argc, char *argv[] ); \
53 int main(int argc, char *argv[]) { return wxEntry(argc, argv); }
54
55
56 #define DECLARE_APP(appname) \
57 extern appname& wxGetApp(void) ;
58
59
60 #endif
61 // __APPH_BASE__