1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxApp inclusion
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart and Markus Holzem
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
16 class WXDLLEXPORT wxApp;
17 typedef wxApp* (*wxAppInitializerFunction) (void);
20 #include "wx/object.h"
22 typedef wxObject
* (*wxAppInitializerFunction
) (void); // returning wxApp* won't work with gcc
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"
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.
38 class WXDLLEXPORT wxAppInitializer
41 wxAppInitializer(wxAppInitializerFunction fn
)
43 wxApp::SetInitializerFunction(fn
);
47 #define IMPLEMENT_APP(appname) \
48 wxApp *wxCreateApp(void) { return new appname; } \
49 wxAppInitializer wxTheAppInitializer((wxAppInitializerFunction) wxCreateApp); \
50 appname& wxGetApp(void) { return *(appname *)wxTheApp; } \
52 extern int wxEntry( int argc, char *argv[] ); \
53 int main(int argc, char *argv[]) { return wxEntry(argc, argv); }
56 #define DECLARE_APP(appname) \
57 extern appname& wxGetApp(void) ;