make it possible to use wxConsoleApp in GUI build

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@22403 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík 2003-07-31 10:11:28 +00:00
parent b6e20cff8c
commit e8e1149bd7
2 changed files with 10 additions and 9 deletions

View File

@ -26,7 +26,7 @@
#include "wx/build.h" #include "wx/build.h"
#include "wx/init.h" // we must declare wxEntry() #include "wx/init.h" // we must declare wxEntry()
class WXDLLIMPEXP_CORE wxApp; class WXDLLIMPEXP_BASE wxAppConsole;
class WXDLLIMPEXP_BASE wxAppTraits; class WXDLLIMPEXP_BASE wxAppTraits;
class WXDLLIMPEXP_BASE wxCmdLineParser; class WXDLLIMPEXP_BASE wxCmdLineParser;
class WXDLLIMPEXP_BASE wxLog; class WXDLLIMPEXP_BASE wxLog;
@ -37,7 +37,7 @@ class WXDLLIMPEXP_BASE wxMessageOutput;
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// the type of the function used to create a wxApp object on program start up // the type of the function used to create a wxApp object on program start up
typedef wxApp* (*wxAppInitializerFunction)(); typedef wxAppConsole* (*wxAppInitializerFunction)();
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// constants // constants
@ -512,10 +512,7 @@ protected:
#include "wx/os2/app.h" #include "wx/os2/app.h"
#endif #endif
#else // !GUI #else // !GUI
// can't use typedef because wxApp forward declared as a class typedef wxAppConsole wxApp;
class WXDLLIMPEXP_BASE wxApp : public wxAppConsole
{
};
#endif // GUI/!GUI #endif // GUI/!GUI
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@ -600,9 +597,9 @@ public:
// Use this macro if you want to define your own main() or WinMain() function // Use this macro if you want to define your own main() or WinMain() function
// and call wxEntry() from there. // and call wxEntry() from there.
#define IMPLEMENT_APP_NO_MAIN(appname) \ #define IMPLEMENT_APP_NO_MAIN(appname) \
wxApp *wxCreateApp() \ wxAppConsole *wxCreateApp() \
{ \ { \
wxApp::CheckBuildOptions(wxBuildOptions()); \ wxAppConsole::CheckBuildOptions(wxBuildOptions()); \
return new appname; \ return new appname; \
} \ } \
wxAppInitializer \ wxAppInitializer \

View File

@ -245,7 +245,11 @@ bool wxEntryStart(int& argc, wxChar **argv)
if ( fnCreate ) if ( fnCreate )
{ {
// he did, try to create the custom wxApp object // he did, try to create the custom wxApp object
app.Set((*fnCreate)()); //
// NB: cast is needed because for the backwards-compatibility
// reasons wxTheApp is really a wxApp and not just
// wxAppConsole...
app.Set((wxApp*)(*fnCreate)());
} }
} }