+ wxString name(wxFileNameFromPath(argv[0]));
+ wxStripExtension( name );
+ wxTheApp->SetAppName( name );
+
+ int retValue;
+ retValue = wxEntryInitGui();
+
+ // Here frames insert themselves automatically into wxTopLevelWindows by
+ // getting created in OnInit().
+ if ( retValue == 0 )
+ {
+ if ( !wxTheApp->OnInit() )
+ retValue = -1;
+ }
+
+ if ( retValue == 0 )
+ {
+ /* delete pending toplevel windows (typically a single
+ dialog) so that, if there isn't any left, we don't
+ call OnRun() */
+ wxTheApp->DeletePendingObjects();
+
+ wxTheApp->m_initialized = wxTopLevelWindows.GetCount() != 0;
+
+ if (wxTheApp->Initialized())
+ {
+ wxTheApp->OnRun();
+
+ wxWindow *topWindow = wxTheApp->GetTopWindow();
+ if (topWindow)
+ {
+ /* Forcibly delete the window. */
+ if (topWindow->IsKindOf(CLASSINFO(wxFrame)) ||
+ topWindow->IsKindOf(CLASSINFO(wxDialog)) )
+ {
+ topWindow->Close( TRUE );
+ wxTheApp->DeletePendingObjects();
+ }
+ else
+ {
+ delete topWindow;
+ wxTheApp->SetTopWindow( (wxWindow*) NULL );
+ }
+ }
+
+ retValue = wxTheApp->OnExit();
+ }
+ }
+
+ wxEntryCleanup();
+
+ return retValue;
+}
+
+#ifndef __WXUNIVERSAL__
+
+// XPM hack: make the arrays const
+#define static static const
+
+#include "wx/gtk/info.xpm"
+#include "wx/gtk/error.xpm"
+#include "wx/gtk/question.xpm"
+#include "wx/gtk/warning.xpm"
+
+#undef static
+
+wxIcon wxApp::GetStdIcon(int which) const
+{
+ switch(which)
+ {
+ case wxICON_INFORMATION:
+ return wxIcon(info_xpm);
+
+ case wxICON_QUESTION:
+ return wxIcon(question_xpm);
+
+ case wxICON_EXCLAMATION:
+ return wxIcon(warning_xpm);
+
+ default:
+ wxFAIL_MSG(wxT("requested non existent standard icon"));
+ // still fall through
+
+ case wxICON_HAND:
+ return wxIcon(error_xpm);
+ }
+}
+#else
+wxIcon wxApp::GetStdIcon(int which) const
+{
+ return wxTheme::Get()->GetRenderer()->GetStdIcon(which);
+}
+#endif // !__WXUNIVERSAL__
+
+
+#ifdef __WXDEBUG__
+
+void wxApp::OnAssert(const wxChar *file, int line, const wxChar *msg)
+{
+ m_isInAssert = TRUE;
+
+ wxAppBase::OnAssert(file, line, msg);
+
+ m_isInAssert = FALSE;
+}
+
+#endif // __WXDEBUG__