Use correct parent for more native modal dialogs in wxMSW
Ensure that the correct parent is used when no parent is explicitly specified
by calling GetParentForModalDialog().
This generalizes baff0c942b
(see #17384) to the
rest of the modal dialogs (wxMessageDialog already did this).
Closes #17146.
This commit is contained in:
parent
5a92181ac1
commit
e4fce9089e
@ -212,6 +212,7 @@ wxMSW:
|
||||
- Fix wxPrintf() and friends when using MinGW with ANSI stdio option.
|
||||
- Fix strike-through support in wxFont with GDI+ (David Vanderson).
|
||||
- Fix UTF-32 conversion for non-BMP characters (ARATA Mizuki).
|
||||
- Use correct parent for the native modal dialogs (Andreas Falkenhahn).
|
||||
|
||||
wxOSX/Cocoa:
|
||||
|
||||
|
@ -116,6 +116,9 @@ int wxColourDialog::ShowModal()
|
||||
{
|
||||
WX_HOOK_MODAL_DIALOG();
|
||||
|
||||
wxWindow* const parent = GetParentForModalDialog(m_parent, GetWindowStyle());
|
||||
WXHWND hWndParent = parent ? GetHwndOf(parent) : NULL;
|
||||
|
||||
// initialize the struct used by Windows
|
||||
CHOOSECOLOR chooseColorStruct;
|
||||
memset(&chooseColorStruct, 0, sizeof(CHOOSECOLOR));
|
||||
@ -133,8 +136,7 @@ int wxColourDialog::ShowModal()
|
||||
}
|
||||
|
||||
chooseColorStruct.lStructSize = sizeof(CHOOSECOLOR);
|
||||
if ( m_parent )
|
||||
chooseColorStruct.hwndOwner = GetHwndOf(m_parent);
|
||||
chooseColorStruct.hwndOwner = hWndParent;
|
||||
chooseColorStruct.rgbResult = wxColourToRGB(m_colourData.GetColour());
|
||||
chooseColorStruct.lpCustColors = custColours;
|
||||
|
||||
|
@ -465,10 +465,8 @@ int wxFileDialog::ShowModal()
|
||||
{
|
||||
WX_HOOK_MODAL_DIALOG();
|
||||
|
||||
HWND hWnd = 0;
|
||||
if (m_parent) hWnd = (HWND) m_parent->GetHWND();
|
||||
if (!hWnd && wxTheApp->GetTopWindow())
|
||||
hWnd = (HWND) wxTheApp->GetTopWindow()->GetHWND();
|
||||
wxWindow* const parent = GetParentForModalDialog(m_parent, GetWindowStyle());
|
||||
WXHWND hWndParent = parent ? GetHwndOf(parent) : NULL;
|
||||
|
||||
static wxChar fileNameBuffer [ wxMAXPATH ]; // the file-name
|
||||
wxChar titleBuffer [ wxMAXFILE+1+wxMAXEXT ]; // the file-name, without path
|
||||
@ -523,7 +521,7 @@ int wxFileDialog::ShowModal()
|
||||
wxZeroMemory(of);
|
||||
|
||||
of.lStructSize = gs_ofStructSize;
|
||||
of.hwndOwner = hWnd;
|
||||
of.hwndOwner = hWndParent;
|
||||
of.lpstrTitle = m_message.t_str();
|
||||
of.lpstrFileTitle = titleBuffer;
|
||||
of.nMaxFileTitle = wxMAXFILE + 1 + wxMAXEXT;
|
||||
|
@ -57,6 +57,8 @@ int wxFontDialog::ShowModal()
|
||||
{
|
||||
WX_HOOK_MODAL_DIALOG();
|
||||
|
||||
wxWindow* const parent = GetParentForModalDialog(m_parent, GetWindowStyle());
|
||||
WXHWND hWndParent = parent ? GetHwndOf(parent) : NULL;
|
||||
// It should be OK to always use GDI simulations
|
||||
DWORD flags = CF_SCREENFONTS /* | CF_NOSIMULATIONS */ ;
|
||||
|
||||
@ -66,8 +68,7 @@ int wxFontDialog::ShowModal()
|
||||
wxZeroMemory(chooseFontStruct);
|
||||
|
||||
chooseFontStruct.lStructSize = sizeof(CHOOSEFONT);
|
||||
if ( m_parent )
|
||||
chooseFontStruct.hwndOwner = GetHwndOf(m_parent);
|
||||
chooseFontStruct.hwndOwner = hWndParent;
|
||||
chooseFontStruct.lpLogFont = &logFont;
|
||||
|
||||
if ( m_fontData.m_initialFont.IsOk() )
|
||||
|
@ -743,16 +743,14 @@ int wxWindowsPrintDialog::ShowModal()
|
||||
{
|
||||
WX_HOOK_MODAL_DIALOG();
|
||||
|
||||
wxWindow* const parent = GetParentForModalDialog(m_parent, GetWindowStyle());
|
||||
WXHWND hWndParent = parent ? GetHwndOf(parent) : NULL;
|
||||
|
||||
ConvertToNative( m_printDialogData );
|
||||
|
||||
PRINTDLG *pd = (PRINTDLG*) m_printDlg;
|
||||
|
||||
if (m_dialogParent)
|
||||
pd->hwndOwner = (HWND) m_dialogParent->GetHWND();
|
||||
else if (wxTheApp->GetTopWindow())
|
||||
pd->hwndOwner = (HWND) wxTheApp->GetTopWindow()->GetHWND();
|
||||
else
|
||||
pd->hwndOwner = 0;
|
||||
pd->hwndOwner = hWndParent;
|
||||
|
||||
bool ret = (PrintDlg( pd ) != 0);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user