Remove unused HWND parameter of MSWOnTypeChange()

Also simplify the hook function code a little by using OPENFILENAME
local variable directly instead of using OFNOTIFY only to always use its
OPENFILENAME member and nothing else.

No real changes.
This commit is contained in:
Vadim Zeitlin 2022-05-25 17:33:12 +01:00
parent 05fdf15c54
commit db7cf34e30
2 changed files with 6 additions and 12 deletions

View file

@ -58,7 +58,7 @@ private:
void MSWOnSelChange(WXHWND hDlg);
// called from the hook procedure on CDN_TYPECHANGE.
void MSWOnTypeChange(WXHWND hDlg, int nFilterIndex);
void MSWOnTypeChange(int nFilterIndex);
// The real implementation of ShowModal() using traditional common dialog
// functions.

View file

@ -194,12 +194,10 @@ wxFileDialogMSWData::HookFunction(HWND hDlg,
NMHDR* const pNM = reinterpret_cast<NMHDR*>(lParam);
if ( pNM->code > CDN_LAST && pNM->code <= CDN_FIRST )
{
OFNOTIFY* const
pNotifyCode = reinterpret_cast<OFNOTIFY *>(lParam);
const OPENFILENAME&
ofn = *reinterpret_cast<OFNOTIFY*>(lParam)->lpOFN;
wxFileDialog* const
dialog = reinterpret_cast<wxFileDialog *>(
pNotifyCode->lpOFN->lCustData
);
dialog = reinterpret_cast<wxFileDialog*>(ofn.lCustData);
switch ( pNM->code )
{
@ -212,11 +210,7 @@ wxFileDialogMSWData::HookFunction(HWND hDlg,
break;
case CDN_TYPECHANGE:
dialog->MSWOnTypeChange
(
(WXHWND)hDlg,
pNotifyCode->lpOFN->nFilterIndex
);
dialog->MSWOnTypeChange(ofn.nFilterIndex);
break;
}
}
@ -397,7 +391,7 @@ void wxFileDialog::MSWOnSelChange(WXHWND hDlg)
UpdateExtraControlUI();
}
void wxFileDialog::MSWOnTypeChange(WXHWND WXUNUSED(hDlg), int nFilterIndex)
void wxFileDialog::MSWOnTypeChange(int nFilterIndex)
{
// Filter indices are 1-based, while we want to use 0-based index, as
// usual. However the input index can apparently also be 0 in some