/////////////////////////////////////////////////////////////////////////////
// Name: src/common/appcmn.cpp
-// Purpose: wxAppConsole and wxAppBase methods common to all platforms
+// Purpose: wxAppBase methods common to all platforms
// Author: Vadim Zeitlin
// Modified by:
// Created: 18.10.99
#include "wx/msgout.h"
#include "wx/thread.h"
#include "wx/vidmode.h"
-
-#ifdef __WXDEBUG__
- #if wxUSE_STACKWALKER
- #include "wx/stackwalk.h"
- #endif // wxUSE_STACKWALKER
-#endif // __WXDEBUG__
-
-#if defined(__WXMSW__)
- #include "wx/msw/private.h" // includes windows.h for LOGFONT
-#endif
+#include "wx/evtloop.h"
#if wxUSE_FONTMAP
#include "wx/fontmap.h"
wxAppBase::wxAppBase()
{
- m_topWindow = (wxWindow *)NULL;
+ m_topWindow = NULL;
m_useBestVisual = false;
m_forceTrueColour = false;
wxBitmap::InitStandardHandlers();
+ // for compatibility call the old initialization function too
+ if ( !OnInitGui() )
+ return false;
+
return true;
}
(void)ProcessEvent(event);
}
+bool wxAppBase::SafeYield(wxWindow *win, bool onlyIfNeeded)
+{
+ wxWindowDisabler wd(win);
+
+ wxEventLoopBase * const loop = wxEventLoopBase::GetActive();
+
+ return loop && loop->Yield(onlyIfNeeded);
+}
+
+bool wxAppBase::SafeYieldFor(wxWindow *win, long eventsToProcess)
+{
+ wxWindowDisabler wd(win);
+
+ wxEventLoopBase * const loop = wxEventLoopBase::GetActive();
+
+ return loop && loop->YieldFor(eventsToProcess);
+}
+
+
// ----------------------------------------------------------------------------
// idle handling
// ----------------------------------------------------------------------------
// Returns true if more time is needed.
bool wxAppBase::ProcessIdle()
{
- // process pending wx events before sending idle events
- ProcessPendingEvents();
-
+ // call the base class version first, it will process the pending events
+ // (which should be done before the idle events generation) and send the
+ // idle event to wxTheApp itself
+ bool needMore = wxAppConsoleBase::ProcessIdle();
wxIdleEvent event;
- bool needMore = false;
wxWindowList::compatibility_iterator node = wxTopLevelWindows.GetFirst();
while (node)
{
node = node->GetNext();
}
- if (wxAppConsole::ProcessIdle())
- needMore = true;
-
// 'Garbage' collection of windows deleted with Close().
DeletePendingObjects();
wxLog *wxGUIAppTraitsBase::CreateLogTarget()
{
-// DE: One day I'll remove this but right now the generic dialog used for this
-// just doesn't work right at all on wxCocoa.
-#if wxUSE_LOGGUI && !defined(__WXCOCOA__)
+#if wxUSE_LOGGUI
return new wxLogGui;
#else
// we must have something!
return NULL;
}
-#ifdef __WXDEBUG__
-
bool wxGUIAppTraitsBase::ShowAssertDialog(const wxString& msg)
{
// under MSW we prefer to use the base class version using ::MessageBox()
#if defined(__WXMSW__) || defined(__WXDFB__) || !wxUSE_MSGDLG
return wxAppTraitsBase::ShowAssertDialog(msg);
#else // wxUSE_MSGDLG
+#if wxDEBUG_LEVEL
wxString msgDlg = msg;
#if wxUSE_STACKWALKER
//case wxNO: nothing to do
}
+#else // !wxDEBUG_LEVEL
+ // this function always exists (for ABI compatibility) but is never called
+ // if debug level is 0 and so can simply do nothing then
+ wxUnusedVar(msg);
+#endif // wxDEBUG_LEVEL/!wxDEBUG_LEVEL
return false;
#endif // !wxUSE_MSGDLG/wxUSE_MSGDLG
}
-#endif // __WXDEBUG__
-
bool wxGUIAppTraitsBase::HasStderr()
{
// we consider that under Unix stderr always goes somewhere, even if the