X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/349d19426cbefdff882fe5969e225ef01584b6f5..8a9d5e5a7321ab71ad690ec98f374bf2b28148b9:/src/common/wincmn.cpp diff --git a/src/common/wincmn.cpp b/src/common/wincmn.cpp index c6a369eb14..24158367eb 100644 --- a/src/common/wincmn.cpp +++ b/src/common/wincmn.cpp @@ -633,6 +633,41 @@ wxEvtHandler *wxWindowBase::PopEventHandler(bool deleteHandler) return handlerA; } +bool wxWindowBase::RemoveEventHandler(wxEvtHandler *handler) +{ + wxCHECK_MSG( handler, FALSE, _T("RemoveEventHandler(NULL) called") ); + + wxEvtHandler *handlerPrev = NULL, + *handlerCur = GetEventHandler(); + while ( handlerCur ) + { + wxEvtHandler *handlerNext = handlerCur->GetNextHandler(); + + if ( handlerCur == handler ) + { + if ( handlerPrev ) + { + handlerPrev->SetNextHandler(handlerNext); + } + else + { + SetEventHandler(handlerNext); + } + + handler->SetNextHandler(NULL); + + return TRUE; + } + + handlerPrev = handlerCur; + handlerCur = handlerNext; + } + + wxFAIL_MSG( _T("where has the event handler gone?") ); + + return FALSE; +} + // ---------------------------------------------------------------------------- // cursors, fonts &c // ---------------------------------------------------------------------------- @@ -1646,6 +1681,8 @@ void wxWindowBase::ReleaseMouse() { wxLogTrace(_T("mousecapture"), _T("ReleaseMouse(0x%08x)"), this); + wxASSERT_MSG( GetCapture() == this, wxT("attempt to release mouse, but this window hasn't captured it") ) + DoReleaseMouse(); if ( ms_winCaptureNext )