// typedefs
// ----------------------------------------------------------------------------
-#ifdef __WXMSW__
+#if defined(__WXMSW__) || defined (__WXPM__)
class WXDLLEXPORT wxApp;
typedef wxApp* (*wxAppInitializerFunction)();
#else
public:
// the virtual functions which may/must be overridden in the derived class
// -----------------------------------------------------------------------
-
+#ifdef __WXMAC_X__
+ virtual ~wxAppBase() {} // Added min for Mac X
+#endif
// called during the program initialization, returning FALSE from here
// prevents the program from continuing - it's a good place to create
// the top level program window and return TRUE.
// return the "main" top level window (if it hadn't been set previously
// with SetTopWindow(), will return just some top level window and, if
// there are none, will return NULL)
- wxWindow *GetTopWindow() const
+ virtual wxWindow *GetTopWindow() const
{
if (m_topWindow)
return m_topWindow;
// set use of best visual flag (see below)
void SetUseBestVisual( bool flag ) { m_useBestVisual = flag; }
bool GetUseBestVisual() const { return m_useBestVisual; }
-
+
// set/get printing mode: see wxPRINT_XXX constants.
//
// default behaviour is the normal one for Unix: always use PostScript
// TRUE if the application wants to get debug output
bool m_wantDebugOutput;
-
+
// TRUE if the apps whats to use the best visual on systems where
// more than one are available (Sun, SGI, XFree86 4.0 ?)
bool m_useBestVisual;
// Yield to other apps/messages
extern void WXDLLEXPORT wxWakeUpIdle();
-#if wxUSE_GUI
-
// Post a message to the given eventhandler which will be processed during the
// next event loop iteration
inline void WXDLLEXPORT wxPostEvent(wxEvtHandler *dest, wxEvent& event)
{
wxCHECK_RET( dest, wxT("need an object to post event to in wxPostEvent") );
+#if wxUSE_GUI
dest->AddPendingEvent(event);
-}
-
+#else
+ dest->ProcessEvent(event);
#endif // wxUSE_GUI
+}
// console applications may avoid using DECLARE_APP and IMPLEMENT_APP macros
// and call these functions instead at the program startup and termination
// be in your main program (e.g. hello.cpp). Now IMPLEMENT_APP should add this
// code if required.
-#if !wxUSE_GUI || defined(__AIX__) || defined(__HPUX__) || defined( __VMS__ ) || defined(__WXPM__)
+#if !wxUSE_GUI || defined(__WXMOTIF__) || defined(__WXGTK__) || defined(__WXPM__)
#define IMPLEMENT_WXWIN_MAIN \
extern int wxEntry( int argc, char *argv[] ); \
int main(int argc, char *argv[]) { return wxEntry(argc, argv); }
+#elif defined(__WXMAC__) && defined(__UNIX__)
+ // wxMac seems to have a specific wxEntry prototype
+ #define IMPLEMENT_WXWIN_MAIN \
+ extern int wxEntry( int argc, char *argv[], bool enterLoop = 1 ); \
+ int main(int argc, char *argv[]) { return wxEntry(argc, argv); }
#elif defined(__WXMSW__) && defined(WXUSINGDLL)
// NT defines APIENTRY, 3.x not
#if !defined(WXAPIENTRY)
- #define WXAPIENTRY FAR wxSTDCALL
+ #define WXAPIENTRY WXFAR wxSTDCALL
#endif
+ #include <windows.h>
+ #include "wx/msw/winundef.h"
+
#define IMPLEMENT_WXWIN_MAIN \
- int WXAPIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,\
- LPSTR m_lpCmdLine, int nCmdShow )\
+ extern "C" int WXAPIENTRY WinMain(HINSTANCE hInstance,\
+ HINSTANCE hPrevInstance,\
+ LPSTR m_lpCmdLine, int nCmdShow)\
{\
- return wxEntry((WXHINSTANCE) hInstance, \
+ return wxEntry((WXHINSTANCE) hInstance,\
(WXHINSTANCE) hPrevInstance,\
m_lpCmdLine, nCmdShow);\
}
-
#else
#define IMPLEMENT_WXWIN_MAIN
#endif
-// use this macro exactly once, the argument is the name of the wxApp-derived
-// class which is the class of your application
-#define IMPLEMENT_APP(appname) \
- wxApp *wxCreateApp() { return new appname; } \
+// Use this macro exactly once, the argument is the name of the wxApp-derived
+// class which is the class of your application.
+#define IMPLEMENT_APP(appname) \
+ wxApp *wxCreateApp() { return new appname; } \
wxAppInitializer wxTheAppInitializer((wxAppInitializerFunction) wxCreateApp); \
appname& wxGetApp() { return *(appname *)wxTheApp; } \
IMPLEMENT_WXWIN_MAIN
+// Use this macro if you want to define your own main() or WinMain() function
+// and call wxEntry() from there.
+#define IMPLEMENT_APP_NO_MAIN(appname) \
+ wxApp *wxCreateApp() { return new appname; } \
+ wxAppInitializer wxTheAppInitializer((wxAppInitializerFunction) wxCreateApp); \
+ appname& wxGetApp() { return *(appname *)wxTheApp; }
+
#define DECLARE_APP(appname) extern appname& wxGetApp();
#endif