Add TempHWNDSetter RAII helper to wxMSW and use it

No real changes, just replace pairs of SetHWND(hwnd)/SetHWND(0) calls
with the use of TempHWNDSetter.
This commit is contained in:
Vadim Zeitlin
2019-04-25 17:12:41 +02:00
parent 87318ec4ee
commit 2aef6570bb
4 changed files with 28 additions and 16 deletions

View File

@@ -136,7 +136,7 @@ wxMessageDialog::HookFunction(int code, WXWPARAM wParam, WXLPARAM lParam)
wnd->m_hook = NULL;
HookMap().erase(tid);
wnd->SetHWND((HWND)wParam);
TempHWNDSetter set(wnd, (WXHWND)wParam);
// replace the static text with an edit control if the message box is
// too big to fit the display
@@ -151,9 +151,6 @@ wxMessageDialog::HookFunction(int code, WXWPARAM wParam, WXLPARAM lParam)
if ( wnd->GetMessageDialogStyle() & wxCENTER )
wnd->Center(); // center on parent
//else: default behaviour, center on screen
// there seems to be no reason to leave it set
wnd->SetHWND(NULL);
}
return rc;