]> git.saurik.com Git - wxWidgets.git/blame_incremental - include/wx/app.h
code using ms_PaintDC changed a little (a couple of asserts added, the behaviour
[wxWidgets.git] / include / wx / app.h
... / ...
CommitLineData
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#ifdef __WXMSW__
16class WXDLLEXPORT wxApp;
17typedef wxApp* (*wxAppInitializerFunction) (void);
18#endif
19
20#include "wx/object.h"
21
22#ifndef __WXMSW__
23typedef wxObject* (*wxAppInitializerFunction) (void); // returning wxApp* won't work with gcc
24#endif
25
26#if defined(__WXMSW__)
27#include "wx/msw/app.h"
28#elif defined(__WXMOTIF__)
29#include "wx/xt/app.h"
30#elif defined(__WXQT__)
31#include "wx/qt/app.h"
32#elif defined(__WXGTK__)
33#include "wx/gtk/app.h"
34#endif
35
36
37// Having a global instance of this class allows
38// wxApp to be aware of the app creator function.
39// wxApp can then call this function to create a new
40// app object. Convoluted, but necessary.
41
42class WXDLLEXPORT wxAppInitializer
43{
44public:
45 wxAppInitializer(wxAppInitializerFunction fn)
46 {
47 wxApp::SetInitializerFunction(fn);
48 }
49};
50
51// Here's a macro you can use if your compiler
52// really, really wants main() to be in your main program
53// (e.g. hello.cpp).
54// Now IMPLEMENT_APP should add this code if required.
55
56#if defined(__AIX__) || defined(__HPUX__)
57#define IMPLEMENT_WXWIN_MAIN \
58extern int wxEntry( int argc, char *argv[] ); \
59int main(int argc, char *argv[]) { return wxEntry(argc, argv); }
60#else
61#define IMPLEMENT_WXWIN_MAIN
62#endif
63
64#define IMPLEMENT_APP(appname) \
65 wxApp *wxCreateApp(void) { return new appname; } \
66 wxAppInitializer wxTheAppInitializer((wxAppInitializerFunction) wxCreateApp); \
67 appname& wxGetApp(void) { return *(appname *)wxTheApp; } \
68 IMPLEMENT_WXWIN_MAIN
69
70#define DECLARE_APP(appname) \
71 extern appname& wxGetApp(void) ;
72
73
74#endif
75 // __APPH_BASE__