1998-05-20 10:01:55 -04: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
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef __APPH_BASE__
|
|
|
|
#define __APPH_BASE__
|
|
|
|
|
1998-05-21 11:02:02 -04:00
|
|
|
#ifndef __GTK__
|
1998-05-20 10:01:55 -04:00
|
|
|
class WXDLLEXPORT wxApp;
|
|
|
|
typedef wxApp* (*wxAppInitializerFunction) (void);
|
1998-05-21 11:02:02 -04:00
|
|
|
#endif
|
1998-05-20 10:01:55 -04:00
|
|
|
|
|
|
|
#include "wx/object.h"
|
|
|
|
|
1998-05-26 10:58:05 -04:00
|
|
|
#ifdef __GTK__
|
1998-05-20 10:01:55 -04:00
|
|
|
typedef wxObject* (*wxAppInitializerFunction) (void); // returning wxApp* won't work with gcc
|
1998-05-21 11:02:02 -04:00
|
|
|
#endif
|
1998-05-20 10:01:55 -04:00
|
|
|
|
|
|
|
#if defined(__WINDOWS__)
|
|
|
|
#include "wx/msw/app.h"
|
|
|
|
#elif defined(__MOTIF__)
|
|
|
|
#include "wx/xt/app.h"
|
|
|
|
#elif defined(__GTK__)
|
|
|
|
#include "wx/gtk/app.h"
|
|
|
|
#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 15:39:05 -04: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-05-28 15:54:07 -04:00
|
|
|
#if defined(__AIX__) || defined(__SUN__) || defined(__HPUX__)
|
|
|
|
#define IMPLEMENT_WXWIN_MAIN \
|
|
|
|
extern int wxEntry( int argc, char *argv[] ); \
|
|
|
|
int main(int argc, char *argv[]) { return wxEntry(argc, argv); }
|
1998-05-21 15:39:05 -04:00
|
|
|
#else
|
|
|
|
#define IMPLEMENT_WXWIN_MAIN
|
|
|
|
#endif
|
|
|
|
|
1998-05-20 10:01:55 -04:00
|
|
|
#define IMPLEMENT_APP(appname) \
|
|
|
|
wxApp *wxCreateApp(void) { return new appname; } \
|
|
|
|
wxAppInitializer wxTheAppInitializer((wxAppInitializerFunction) wxCreateApp); \
|
|
|
|
appname& wxGetApp(void) { return *(appname *)wxTheApp; } \
|
1998-05-21 15:39:05 -04:00
|
|
|
IMPLEMENT_WXWIN_MAIN
|
1998-05-20 10:01:55 -04:00
|
|
|
|
|
|
|
#define DECLARE_APP(appname) \
|
|
|
|
extern appname& wxGetApp(void) ;
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
// __APPH_BASE__
|