From 883117d1265abfc750b1b08582feda80c932a2cf Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 17 Sep 2003 23:30:53 +0000 Subject: [PATCH] added HandleEvent() to allow handle exceptions in event handlers git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@23645 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/app.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/include/wx/app.h b/include/wx/app.h index 220c68a128..eb507ed17d 100644 --- a/include/wx/app.h +++ b/include/wx/app.h @@ -141,6 +141,14 @@ public: // crash. virtual void OnFatalException() { } +#if wxUSE_EXCEPTIONS + // Called when an unhandled C++ exception occurs inside OnRun(): note that + // the exception type is lost by now, so if you really want to handle the + // exception you should override OnRun() and put a try/catch around + // MainLoop() call there + virtual void OnUnhandledException() { } +#endif // wxUSE_EXCEPTIONS + // Called from wxExit() function, should terminate the application a.s.a.p. virtual void Exit(); @@ -239,6 +247,17 @@ public: // had been already processed or won't be processed at all, respectively virtual int FilterEvent(wxEvent& event); +#if wxUSE_EXCEPTIONS + // call the specified handler on the given object with the given event + // + // this method only exists to allow catching the exceptions thrown by any + // event handler, it would lead to an extra (useless) virtual function call + // if the exceptions were not used, so it doesn't even exist in that case + virtual void HandleEvent(wxEvtHandler *handler, + wxEventFunction func, + wxEvent& event) const; +#endif // wxUSE_EXCEPTIONS + // process all events in the wxPendingEvents list -- it is necessary to // call this function to process posted events. This happens during each // event loop iteration in GUI mode but if there is no main loop, it may be -- 2.47.2