#include "wx/cmdline.h"
#include "wx/thread.h"
#include "wx/confbase.h"
+#include "wx/tokenzr.h"
+#include "wx/utils.h"
+
+#if wxUSE_GUI
+ #include "wx/artprov.h"
+#endif // wxUSE_GUI
#if !defined(__WXMSW__) || defined(__WXMICROWIN__)
#include <signal.h> // for SIGTRAP used by wxTrap()
#include "wx/mac/private.h" // includes mac headers
#endif
+// private functions prototypes
+#ifdef __WXDEBUG__
+ static void LINKAGEMODE SetTraceMasks();
+#endif // __WXDEBUG__
+
// ===========================================================================
// implementation
// ===========================================================================
{
wxTheApp = (wxApp *)this;
- // VZ: what's this? is it obsolete?
+#if WXWIN_COMPATIBILITY_2_2
m_wantDebugOutput = FALSE;
+#endif // WXWIN_COMPATIBILITY_2_2
#if wxUSE_GUI
m_topWindow = (wxWindow *)NULL;
m_exitOnFrameDelete = TRUE;
m_isActive = TRUE;
#endif // wxUSE_GUI
+
+#ifdef __WXDEBUG__
+ SetTraceMasks();
+#endif
}
wxAppBase::~wxAppBase()
#ifdef __WXUNIVERSAL__
if ( !wxTheme::Get() && !wxTheme::CreateDefault() )
return FALSE;
+ wxArtProvider *art = wxTheme::Get()->GetArtProvider();
+ if ( art )
+ wxArtProvider::PushProvider(art);
#endif // __WXUNIVERSAL__
return TRUE;
#endif // wxUSE_GUI
+int wxAppBase::FilterEvent(wxEvent& WXUNUSED(event))
+{
+ // process the events normally by default
+ return -1;
+}
+
// ----------------------------------------------------------------------------
// cmd line parsing
// ----------------------------------------------------------------------------
wxCMD_LINE_SWITCH,
_T(""),
OPTION_VERBOSE,
- gettext_noop("generate verbose log messages")
+ gettext_noop("generate verbose log messages"),
+ wxCMD_LINE_VAL_NONE,
+ 0x0
},
#endif // wxUSE_LOG
_T(""),
OPTION_THEME,
gettext_noop("specify the theme to use"),
- wxCMD_LINE_VAL_STRING
+ wxCMD_LINE_VAL_STRING,
+ 0x0
},
#endif // __WXUNIVERSAL__
_T(""),
OPTION_MODE,
gettext_noop("specify display mode to use (e.g. 640x480-16)"),
- wxCMD_LINE_VAL_STRING
+ wxCMD_LINE_VAL_STRING,
+ 0x0
},
#endif // __WXMGL__
// terminator
- { wxCMD_LINE_NONE }
+ {
+ wxCMD_LINE_NONE,
+ _T(""),
+ _T(""),
+ _T(""),
+ wxCMD_LINE_VAL_NONE,
+ 0x0
+ }
};
parser.SetDesc(cmdLineDesc);
// debugging support
// ----------------------------------------------------------------------------
+/* static */
+bool wxAppBase::CheckBuildOptions(const wxBuildOptions& opts)
+{
+#define wxCMP(what) (what == opts.m_ ## what)
+
+ bool
+#ifdef __WXDEBUG__
+ isDebug = TRUE;
+#else
+ isDebug = FALSE;
+#endif
+
+ int verMaj = wxMAJOR_VERSION,
+ verMin = wxMINOR_VERSION;
+
+ if ( !(wxCMP(isDebug) && wxCMP(verMaj) && wxCMP(verMin)) )
+ {
+ wxLogFatalError(_T("Mismatch between the program and library build ")
+ _T("versions detected."));
+
+ // normally wxLogFatalError doesn't return
+ return FALSE;
+ }
+#undef wxCMP
+
+ return TRUE;
+}
+
#ifdef __WXDEBUG__
+static void LINKAGEMODE SetTraceMasks()
+{
+ wxString mask;
+ if ( wxGetEnv(wxT("WXTRACE"), &mask) )
+ {
+ wxStringTokenizer tkn(mask, wxT(","));
+ while ( tkn.HasMoreTokens() )
+ wxLog::AddTraceMask(tkn.GetNextToken());
+ }
+}
+
// wxASSERT() helper
bool wxAssertIsEqual(int x, int y)
{