// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
-#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
- #pragma implementation "app.h"
-#endif
-
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
END_EVENT_TABLE()
#ifdef __WXDEBUG__
+extern "C"
+{
typedef int (*XErrorHandlerFunc)(Display *, XErrorEvent *);
+}
- XErrorHandlerFunc gs_pfnXErrorHandler = 0;
+XErrorHandlerFunc gs_pfnXErrorHandler = 0;
- static int wxXErrorHandler(Display *dpy, XErrorEvent *xevent)
- {
- // just forward to the default handler for now
- return gs_pfnXErrorHandler(dpy, xevent);
- }
+extern "C"
+{
+
+static int wxXErrorHandler(Display *dpy, XErrorEvent *xevent)
+{
+ // just forward to the default handler for now
+ return gs_pfnXErrorHandler(dpy, xevent);
+}
+
+}
#endif // __WXDEBUG__
-bool wxApp::Initialize(int& argc, wxChar **argv)
+bool wxApp::Initialize(int& argcOrig, wxChar **argvOrig)
{
- if ( !wxAppBase::Initialize(argc, argv) )
+ if ( !wxAppBase::Initialize(argcOrig, argvOrig) )
return false;
wxWidgetHashTable = new wxHashTable(wxKEY_INTEGER);
+#if wxUSE_INTL
+ wxFont::SetDefaultEncoding(wxLocale::GetSystemEncoding());
+#endif
+
return true;
}
void wxApp::CleanUp()
{
+ wxAppBase::CleanUp();
+
delete wxWidgetHashTable;
wxWidgetHashTable = NULL;
- wxAppBase::CleanUp();
+ delete m_mainLoop;
+
+ for( wxPerDisplayDataMap::iterator it = m_perDisplayData->begin(),
+ end = m_perDisplayData->end();
+ it != end; ++it )
+ {
+ delete it->second->m_visualInfo;
+ XtDestroyWidget( it->second->m_topLevelWidget );
+ delete it->second;
+ }
+
+ delete m_perDisplayData;
}
void wxApp::Exit()
wxApp::~wxApp()
{
- delete m_mainLoop;
-
- for( wxPerDisplayDataMap::iterator it = m_perDisplayData->begin(),
- end = m_perDisplayData->end();
- it != end; ++it )
- {
- delete it->second->m_visualInfo;
- XtDestroyWidget( it->second->m_topLevelWidget );
- delete it->second;
- }
-
- delete m_perDisplayData;
-
wxApp::SetInstance(NULL);
}
}
static char *fallbackResources[] = {
- "*menuBar.marginHeight: 0",
- "*menuBar.shadowThickness: 1",
- "*background: #c0c0c0",
- "*foreground: black",
+ // better defaults for CDE under Irix
+ //
+ // TODO: do something similar for the other systems, the hardcoded defaults
+ // below are ugly
+#ifdef __SGI__
+ wxMOTIF_STR("*sgiMode: True"),
+ wxMOTIF_STR("*useSchemes: all"),
+#else // !__SGI__
+ wxMOTIF_STR("*menuBar.marginHeight: 0"),
+ wxMOTIF_STR("*menuBar.shadowThickness: 1"),
+ wxMOTIF_STR("*background: #c0c0c0"),
+ wxMOTIF_STR("*foreground: black"),
+#endif // __SGI__/!__SGI__
NULL
};
if( !wxAppBase::OnInitGui() )
return false;
+ XtSetLanguageProc(NULL, NULL, NULL);
XtToolkitInitialize() ;
wxTheApp->m_appContext = (WXAppContext) XtCreateApplicationContext();
XtAppSetFallbackResources((XtAppContext) wxTheApp->m_appContext, fallbackResources);
// Add general resize proc
XtActionsRec rec;
- rec.string = "resize";
+ rec.string = wxMOTIF_STR("resize");
rec.proc = (XtActionProc)wxWidgetResizeProc;
XtAppAddActions((XtAppContext) wxTheApp->m_appContext, &rec, 1);