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