X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/910426ee7bbd9f5959b4d5d075b35f0e8e3b52a9..63ad74ab2d0705a987ea341106f1ca25bfee639e:/src/common/appbase.cpp diff --git a/src/common/appbase.cpp b/src/common/appbase.cpp index 40e4147114..04304f3672 100644 --- a/src/common/appbase.cpp +++ b/src/common/appbase.cpp @@ -33,9 +33,13 @@ #endif // wxUSE_LOG #endif //WX_PRECOMP +#include "wx/utils.h" #include "wx/apptrait.h" #include "wx/cmdline.h" #include "wx/confbase.h" +#if wxUSE_FILENAME + #include "wx/filename.h" +#endif // wxUSE_FILENAME #if wxUSE_FONTMAP #include "wx/fontmap.h" #endif // wxUSE_FONTMAP @@ -51,8 +55,15 @@ #endif #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 @@ -107,6 +118,33 @@ 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 +#if wxUSE_FILENAME + wxFileName::SplitPath(argv[0], NULL, &m_appName, NULL); +#else // !wxUSE_FILENAME + m_appName = argv[0]; +#endif // wxUSE_FILENAME/!wxUSE_FILENAME + } + + return true; +} + +void wxAppConsole::CleanUp() +{ +} + // ---------------------------------------------------------------------------- // OnXXX() callbacks // ---------------------------------------------------------------------------- @@ -171,7 +209,7 @@ void wxAppConsole::Exit() wxAppTraits *wxAppConsole::CreateTraits() { - return wxAppTraits::CreateConsole(); + return new wxConsoleAppTraits; } wxAppTraits *wxAppConsole::GetTraits() @@ -224,11 +262,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. @@ -509,11 +547,6 @@ bool wxAppTraitsBase::ShowAssertDialog(const wxString& msg) #endif // __WXDEBUG__ -wxAppTraits *wxAppTraitsBase::CreateConsole() -{ - return new wxConsoleAppTraits; -} - // ============================================================================ // global functions implementation // ============================================================================ @@ -721,7 +754,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 ) {