X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e2478fde622a16d25c66690af353dfdc37e7b582..a095505c96a4ffbbfa559d9239bc8a6f75698da1:/src/common/appbase.cpp diff --git a/src/common/appbase.cpp b/src/common/appbase.cpp index 1d63e99672..261fd0fa23 100644 --- a/src/common/appbase.cpp +++ b/src/common/appbase.cpp @@ -25,17 +25,19 @@ #endif #ifndef WX_PRECOMP + #include "wx/app.h" + #include "wx/intl.h" + #include "wx/list.h" #if wxUSE_LOG #include "wx/log.h" #endif // wxUSE_LOG #endif //WX_PRECOMP +#include "wx/utils.h" #include "wx/apptrait.h" #include "wx/cmdline.h" #include "wx/confbase.h" -#if wxUSE_FONTMAP - #include "wx/fontmap.h" -#endif // wxUSE_FONTMAP +#include "wx/filename.h" #include "wx/msgout.h" #include "wx/tokenzr.h" @@ -47,9 +49,20 @@ #include "wx/msw/private.h" // includes windows.h for MessageBox() #endif +#if wxUSE_FONTMAP + #include "wx/fontmap.h" +#endif // wxUSE_FONTMAP + #if defined(__WXMAC__) - #include "wx/mac/private.h" // includes mac headers -#endif + // VZ: MacTypes.h is enough under Mac OS X (where I could test it) but + // I don't know which headers are needed under earlier systems so + // include everything when in doubt + #ifdef __DARWIN__ + #include "MacTypes.h" + #else + #include "wx/mac/private.h" // includes mac headers + #endif +#endif // __WXMAC__ // ---------------------------------------------------------------------------- // private functions prototypes @@ -104,6 +117,29 @@ wxAppConsole::~wxAppConsole() delete m_traits; } +// ---------------------------------------------------------------------------- +// initilization/cleanup +// ---------------------------------------------------------------------------- + +bool wxAppConsole::Initialize(int& argc, wxChar **argv) +{ + // remember the command line arguments + this->argc = argc; + this->argv = argv; + + if ( m_appName.empty() && argv ) + { + // the application name is, by default, the name of its executable file + wxFileName::SplitPath(argv[0], NULL, &m_appName, NULL); + } + + return true; +} + +void wxAppConsole::CleanUp() +{ +} + // ---------------------------------------------------------------------------- // OnXXX() callbacks // ---------------------------------------------------------------------------- @@ -168,7 +204,7 @@ void wxAppConsole::Exit() wxAppTraits *wxAppConsole::CreateTraits() { - return wxAppTraits::CreateConsole(); + return new wxConsoleAppTraits; } wxAppTraits *wxAppConsole::GetTraits() @@ -221,11 +257,11 @@ void wxAppConsole::ProcessPendingEvents() } // iterate until the list becomes empty - wxNode *node = wxPendingEvents->GetFirst(); + wxList::compatibility_iterator node = wxPendingEvents->GetFirst(); while (node) { wxEvtHandler *handler = (wxEvtHandler *)node->GetData(); - delete node; + wxPendingEvents->Erase(node); // In ProcessPendingEvents(), new handlers might be add // and we can safely leave the critical section here. @@ -470,10 +506,12 @@ wxFontMapper *wxConsoleAppTraitsBase::CreateFontMapper() #endif // wxUSE_FONTMAP +#ifdef __WXDEBUG__ bool wxConsoleAppTraitsBase::ShowAssertDialog(const wxString& msg) { return wxAppTraitsBase::ShowAssertDialog(msg); } +#endif bool wxConsoleAppTraitsBase::HasStderr() { @@ -504,11 +542,6 @@ bool wxAppTraitsBase::ShowAssertDialog(const wxString& msg) #endif // __WXDEBUG__ -wxAppTraits *wxAppTraitsBase::CreateConsole() -{ - return new wxConsoleAppTraits; -} - // ============================================================================ // global functions implementation // ============================================================================ @@ -716,7 +749,7 @@ void ShowAssertDialog(const wxChar *szFile, if ( !s_bNoAsserts ) { // send it to the normal log destination - wxLogDebug(_T("%s"), msg); + wxLogDebug(_T("%s"), msg.c_str()); if ( traits ) {