1998-05-20 14:01:55 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: app.h
|
|
|
|
// Purpose: wxApp inclusion
|
|
|
|
// Author: Julian Smart
|
|
|
|
// Modified by:
|
|
|
|
// Created: 01/02/97
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
// Copyright: (c) Julian Smart and Markus Holzem
|
|
|
|
// Licence: wxWindows licence
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
1998-08-15 00:23:28 +00:00
|
|
|
#ifndef _WX_APP_H_BASE_
|
|
|
|
#define _WX_APP_H_BASE_
|
1998-05-20 14:01:55 +00:00
|
|
|
|
1998-08-07 21:32:13 +00:00
|
|
|
#ifdef __WXMSW__
|
1998-05-20 14:01:55 +00:00
|
|
|
class WXDLLEXPORT wxApp;
|
|
|
|
typedef wxApp* (*wxAppInitializerFunction) (void);
|
1998-05-21 15:02:02 +00:00
|
|
|
#endif
|
1998-05-20 14:01:55 +00:00
|
|
|
|
|
|
|
#include "wx/object.h"
|
|
|
|
|
1998-08-07 21:32:13 +00:00
|
|
|
#ifndef __WXMSW__
|
1998-05-20 14:01:55 +00:00
|
|
|
typedef wxObject* (*wxAppInitializerFunction) (void); // returning wxApp* won't work with gcc
|
1998-05-21 15:02:02 +00:00
|
|
|
#endif
|
1998-05-20 14:01:55 +00:00
|
|
|
|
1998-07-10 14:15:17 +00:00
|
|
|
#if defined(__WXMSW__)
|
1998-05-20 14:01:55 +00:00
|
|
|
#include "wx/msw/app.h"
|
1998-07-10 14:15:17 +00:00
|
|
|
#elif defined(__WXMOTIF__)
|
1998-08-15 00:23:28 +00:00
|
|
|
#include "wx/motif/app.h"
|
1998-08-07 20:23:17 +00:00
|
|
|
#elif defined(__WXQT__)
|
|
|
|
#include "wx/qt/app.h"
|
1998-07-10 14:15:17 +00:00
|
|
|
#elif defined(__WXGTK__)
|
1998-05-20 14:01:55 +00:00
|
|
|
#include "wx/gtk/app.h"
|
1998-08-15 00:23:28 +00:00
|
|
|
#elif defined(__WXMAC__)
|
|
|
|
#include "wx/mac/app.h"
|
|
|
|
#elif defined(__WXSTUBS__)
|
|
|
|
#include "wx/stubs/app.h"
|
1998-05-20 14:01:55 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
// Having a global instance of this class allows
|
|
|
|
// wxApp to be aware of the app creator function.
|
|
|
|
// wxApp can then call this function to create a new
|
|
|
|
// app object. Convoluted, but necessary.
|
|
|
|
|
|
|
|
class WXDLLEXPORT wxAppInitializer
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
wxAppInitializer(wxAppInitializerFunction fn)
|
|
|
|
{
|
|
|
|
wxApp::SetInitializerFunction(fn);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
1998-05-21 19:39:05 +00:00
|
|
|
// Here's a macro you can use if your compiler
|
|
|
|
// really, really wants main() to be in your main program
|
|
|
|
// (e.g. hello.cpp).
|
|
|
|
// Now IMPLEMENT_APP should add this code if required.
|
|
|
|
|
1998-07-07 15:59:37 +00:00
|
|
|
#if defined(__AIX__) || defined(__HPUX__)
|
1998-05-28 19:54:07 +00:00
|
|
|
#define IMPLEMENT_WXWIN_MAIN \
|
|
|
|
extern int wxEntry( int argc, char *argv[] ); \
|
|
|
|
int main(int argc, char *argv[]) { return wxEntry(argc, argv); }
|
1998-05-21 19:39:05 +00:00
|
|
|
#else
|
|
|
|
#define IMPLEMENT_WXWIN_MAIN
|
|
|
|
#endif
|
|
|
|
|
1998-05-20 14:01:55 +00:00
|
|
|
#define IMPLEMENT_APP(appname) \
|
|
|
|
wxApp *wxCreateApp(void) { return new appname; } \
|
|
|
|
wxAppInitializer wxTheAppInitializer((wxAppInitializerFunction) wxCreateApp); \
|
|
|
|
appname& wxGetApp(void) { return *(appname *)wxTheApp; } \
|
1998-05-21 19:39:05 +00:00
|
|
|
IMPLEMENT_WXWIN_MAIN
|
1998-05-20 14:01:55 +00:00
|
|
|
|
|
|
|
#define DECLARE_APP(appname) \
|
|
|
|
extern appname& wxGetApp(void) ;
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|
1998-08-15 00:23:28 +00:00
|
|
|
// _WX_APP_H_BASE_
|