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"
23 typedef wxObject
* (*wxAppInitializerFunction
) (void); // returning wxApp* won't work with gcc
26 #if defined(__WINDOWS__)
27 #include "wx/msw/app.h"
28 #elif defined(__MOTIF__)
29 #include "wx/xt/app.h"
30 #elif defined(__GTK__)
31 #include "wx/gtk/app.h"
35 // Having a global instance of this class allows
36 // wxApp to be aware of the app creator function.
37 // wxApp can then call this function to create a new
38 // app object. Convoluted, but necessary.
40 class WXDLLEXPORT wxAppInitializer
43 wxAppInitializer(wxAppInitializerFunction fn
)
45 wxApp::SetInitializerFunction(fn
);
49 // Here's a macro you can use if your compiler
50 // really, really wants main() to be in your main program
52 // Now IMPLEMENT_APP should add this code if required.
54 #if defined(AIX) || defined(AIX4) /* || defined(____HPUX__) */
55 #define IMPLEMENT_WXWIN_MAIN int main(int argc, char *argv[]) { return wxEntry(argc, argv); }
57 #define IMPLEMENT_WXWIN_MAIN
60 #define IMPLEMENT_APP(appname) \
61 wxApp *wxCreateApp(void) { return new appname; } \
62 wxAppInitializer wxTheAppInitializer((wxAppInitializerFunction) wxCreateApp); \
63 appname& wxGetApp(void) { return *(appname *)wxTheApp; } \
66 #define DECLARE_APP(appname) \
67 extern appname& wxGetApp(void) ;