#include "wx/msw/private.h"
-#if wxUSE_THREADS
- #include "wx/thread.h"
-
- // define the array of MSG strutures
- WX_DECLARE_OBJARRAY(MSG, wxMsgArray);
-
- #include "wx/arrimpl.cpp"
-
- WX_DEFINE_OBJARRAY(wxMsgArray);
-#endif // wxUSE_THREADS
-
#if wxUSE_TOOLTIPS
#include "wx/tooltip.h"
#endif // wxUSE_TOOLTIPS
#include "wx/msw/wrapcctl.h"
+// For MB_TASKMODAL
+#ifdef __WXWINCE__
+#include "wx/msw/wince/missing.h"
+#endif
+
#if (!defined(__MINGW32__) || wxCHECK_W32API_VERSION( 2, 0 )) && \
!defined(__CYGWIN__) && !defined(__DIGITALMARS__) && !defined(__WXWINCE__) && \
(!defined(_MSC_VER) || (_MSC_VER > 1100))
#if wxUSE_OLE || wxUSE_DRAG_AND_DROP
-#ifdef __WIN16__
- // for OLE, enlarge message queue to be as large as possible
- int iMsg = 96;
- while (!SetMessageQueue(iMsg) && (iMsg -= 8))
- ;
-#endif // Win16
-
#if wxUSE_OLE
// we need to initialize OLE library
#ifdef __WXWINCE__
wxWinHandleHash = new wxWinHashTable(wxKEY_INTEGER, 100);
- // This is to foil optimizations in Visual C++ that throw out dummy.obj.
- // PLEASE DO NOT ALTER THIS.
-#if defined(__VISUALC__) && defined(__WIN16__) && !defined(WXMAKINGDLL)
- extern char wxDummyChar;
- if (wxDummyChar) wxDummyChar++;
-#endif
-
#if !defined(__WXMICROWIN__) && !defined(__WXWINCE__)
wxSetKeyboardHook(TRUE);
#endif
void wxApp::CleanUp()
{
+ // all objects pending for deletion must be deleted first, otherwise we
+ // would crash when they use wxWinHandleHash (and UnregisterWindowClasses()
+ // call wouldn't succeed as long as any windows still exist), so call the
+ // base class method first and only then do our clean up
+ wxAppBase::CleanUp();
+
#if !defined(__WXMICROWIN__) && !defined(__WXWINCE__)
wxSetKeyboardHook(FALSE);
#endif
delete wxWinHandleHash;
wxWinHandleHash = NULL;
-
- wxAppBase::CleanUp();
}
// ----------------------------------------------------------------------------
delete [] argv;
}
-bool wxApp::Initialized()
-{
-#ifndef _WINDLL
- if (GetTopWindow())
- return TRUE;
- else
- return FALSE;
-#else // Assume initialized if DLL (no way of telling)
- return TRUE;
-#endif
-}
-
-// this is a temporary hack and will be replaced by using wxEventLoop in the
-// future
-//
-// it is needed to allow other event loops (currently only one: the modal
-// dialog one) to reset the OnIdle() semaphore because otherwise OnIdle()
-// wouldn't do anything while a modal dialog shown from OnIdle() call is shown.
-bool wxIsInOnIdleFlag = FALSE;
+// ----------------------------------------------------------------------------
+// wxApp idle handling
+// ----------------------------------------------------------------------------
void wxApp::OnIdle(wxIdleEvent& event)
{
- // Avoid recursion (via ProcessEvent default case)
- if ( wxIsInOnIdleFlag )
- return;
-
- wxIsInOnIdleFlag = TRUE;
-
wxAppBase::OnIdle(event);
#if wxUSE_DC_CACHEING
if (!::GetKeyState(MK_LBUTTON) && !::GetKeyState(MK_MBUTTON) && !::GetKeyState(MK_RBUTTON))
wxDC::ClearCache();
#endif // wxUSE_DC_CACHEING
-
- wxIsInOnIdleFlag = FALSE;
}
void wxApp::WakeUpIdle()
}
}
+// ----------------------------------------------------------------------------
+// other wxApp event hanlders
+// ----------------------------------------------------------------------------
+
void wxApp::OnEndSession(wxCloseEvent& WXUNUSED(event))
{
if (GetTopWindow())
}
}
+// ----------------------------------------------------------------------------
+// miscellaneous
+// ----------------------------------------------------------------------------
+
/* static */
int wxApp::GetComCtl32Version()
{
return TRUE;
}
+#if wxUSE_EXCEPTIONS
+
+// ----------------------------------------------------------------------------
+// exception handling
+// ----------------------------------------------------------------------------
+
+bool wxApp::OnExceptionInMainLoop()
+{
+ // ask the user about what to do: use the Win32 API function here as it
+ // could be dangerous to use any wxWindows code in this state
+ switch (
+ ::MessageBox
+ (
+ NULL,
+ _T("An unhandled exception occurred. Press \"Abort\" to \
+terminate the program,\r\n\
+\"Retry\" to exit the program normally and \"Ignore\" to try to continue."),
+ _T("Unhandled exception"),
+ MB_ABORTRETRYIGNORE |
+ MB_ICONERROR|
+ MB_TASKMODAL
+ )
+ )
+ {
+ case IDABORT:
+ throw;
+
+ default:
+ wxFAIL_MSG( _T("unexpected MessageBox() return code") );
+ // fall through
+
+ case IDRETRY:
+ return false;
+
+ case IDIGNORE:
+ return true;
+ }
+}
+
+#endif // wxUSE_EXCEPTIONS