Use hwndOwner in Print/page setup dialogs.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_2_BRANCH@7418 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -126,10 +126,13 @@ wxString wxFileSelector(const wxChar *title,
|
|||||||
return wxGetEmptyString();
|
return wxGetEmptyString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
# if __BORLANDC__
|
# if __BORLANDC__
|
||||||
# include <dir.h> // for MAXPATH etc. ( Borland 3.1 )
|
# include <dir.h> // for MAXPATH etc. ( Borland 3.1 )
|
||||||
# endif
|
# endif
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* These numbers are too small.
|
||||||
# ifndef MAXPATH
|
# ifndef MAXPATH
|
||||||
# define MAXPATH 400
|
# define MAXPATH 400
|
||||||
# endif
|
# endif
|
||||||
@@ -145,6 +148,17 @@ wxString wxFileSelector(const wxChar *title,
|
|||||||
# ifndef MAXEXT
|
# ifndef MAXEXT
|
||||||
# define MAXEXT 5
|
# define MAXEXT 5
|
||||||
# endif
|
# endif
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if __WIN32__
|
||||||
|
# define wxMAXPATH 4096
|
||||||
|
#else
|
||||||
|
# define wxMAXPATH 1024
|
||||||
|
#endif
|
||||||
|
|
||||||
|
# define wxMAXFILE 1024
|
||||||
|
|
||||||
|
# define wxMAXEXT 5
|
||||||
|
|
||||||
|
|
||||||
wxString wxFileSelectorEx(const wxChar *title,
|
wxString wxFileSelectorEx(const wxChar *title,
|
||||||
@@ -206,9 +220,11 @@ int wxFileDialog::ShowModal()
|
|||||||
{
|
{
|
||||||
HWND hWnd = 0;
|
HWND hWnd = 0;
|
||||||
if (m_parent) hWnd = (HWND) m_parent->GetHWND();
|
if (m_parent) hWnd = (HWND) m_parent->GetHWND();
|
||||||
|
if (!hWnd && wxTheApp->GetTopWindow())
|
||||||
|
hWnd = (HWND) wxTheApp->GetTopWindow()->GetHWND();
|
||||||
|
|
||||||
static wxChar fileNameBuffer [ MAXPATH ]; // the file-name
|
static wxChar fileNameBuffer [ wxMAXPATH ]; // the file-name
|
||||||
wxChar titleBuffer [ MAXFILE+1+MAXEXT ]; // the file-name, without path
|
wxChar titleBuffer [ wxMAXFILE+1+wxMAXEXT ]; // the file-name, without path
|
||||||
|
|
||||||
*fileNameBuffer = wxT('\0');
|
*fileNameBuffer = wxT('\0');
|
||||||
*titleBuffer = wxT('\0');
|
*titleBuffer = wxT('\0');
|
||||||
@@ -241,7 +257,7 @@ int wxFileDialog::ShowModal()
|
|||||||
|
|
||||||
|
|
||||||
of.lpstrFileTitle = titleBuffer;
|
of.lpstrFileTitle = titleBuffer;
|
||||||
of.nMaxFileTitle = MAXFILE + 1 + MAXEXT; // Windows 3.0 and 3.1
|
of.nMaxFileTitle = wxMAXFILE + 1 + wxMAXEXT; // Windows 3.0 and 3.1
|
||||||
|
|
||||||
// Convert forward slashes to backslashes (file selector doesn't like
|
// Convert forward slashes to backslashes (file selector doesn't like
|
||||||
// forward slashes)
|
// forward slashes)
|
||||||
@@ -298,11 +314,11 @@ int wxFileDialog::ShowModal()
|
|||||||
|
|
||||||
//=== Setting defaultFileName >>=========================================
|
//=== Setting defaultFileName >>=========================================
|
||||||
|
|
||||||
wxStrncpy( fileNameBuffer, (const wxChar *)m_fileName, MAXPATH-1 );
|
wxStrncpy( fileNameBuffer, (const wxChar *)m_fileName, wxMAXPATH-1 );
|
||||||
fileNameBuffer[ MAXPATH-1 ] = wxT('\0');
|
fileNameBuffer[ wxMAXPATH-1 ] = wxT('\0');
|
||||||
|
|
||||||
of.lpstrFile = fileNameBuffer; // holds returned filename
|
of.lpstrFile = fileNameBuffer; // holds returned filename
|
||||||
of.nMaxFile = MAXPATH;
|
of.nMaxFile = wxMAXPATH;
|
||||||
|
|
||||||
//== Execute FileDialog >>=================================================
|
//== Execute FileDialog >>=================================================
|
||||||
|
|
||||||
@@ -379,8 +395,8 @@ int wxFileDialog::ShowModal()
|
|||||||
m_fileName = wxString(fileNameBuffer) + extension;
|
m_fileName = wxString(fileNameBuffer) + extension;
|
||||||
|
|
||||||
int len = wxStrlen( fileNameBuffer );
|
int len = wxStrlen( fileNameBuffer );
|
||||||
wxStrncpy( fileNameBuffer + len, extension, MAXPATH - len );
|
wxStrncpy( fileNameBuffer + len, extension, wxMAXPATH - len );
|
||||||
fileNameBuffer[ MAXPATH -1 ] = wxT('\0');
|
fileNameBuffer[ wxMAXPATH -1 ] = wxT('\0');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -110,7 +110,18 @@ int wxPrintDialog::ShowModal()
|
|||||||
{
|
{
|
||||||
m_printDialogData.ConvertToNative();
|
m_printDialogData.ConvertToNative();
|
||||||
|
|
||||||
bool ret = (PrintDlg( (PRINTDLG *)m_printDialogData.GetNativeData() ) != 0);
|
PRINTDLG* p = (PRINTDLG *)m_printDialogData.GetNativeData() ;
|
||||||
|
if (m_dialogParent)
|
||||||
|
p->hwndOwner = (HWND) m_dialogParent->GetHWND();
|
||||||
|
else if (wxTheApp->GetTopWindow())
|
||||||
|
p->hwndOwner = (HWND) wxTheApp->GetTopWindow()->GetHWND();
|
||||||
|
else
|
||||||
|
p->hwndOwner = 0;
|
||||||
|
|
||||||
|
bool ret = (PrintDlg( p ) != 0);
|
||||||
|
|
||||||
|
p->hwndOwner = 0;
|
||||||
|
|
||||||
if ( ret != FALSE && ((PRINTDLG *)m_printDialogData.GetNativeData())->hDC)
|
if ( ret != FALSE && ((PRINTDLG *)m_printDialogData.GetNativeData())->hDC)
|
||||||
{
|
{
|
||||||
wxPrinterDC *pdc = new wxPrinterDC((WXHDC) ((PRINTDLG *)m_printDialogData.GetNativeData())->hDC);
|
wxPrinterDC *pdc = new wxPrinterDC((WXHDC) ((PRINTDLG *)m_printDialogData.GetNativeData())->hDC);
|
||||||
@@ -170,7 +181,16 @@ int wxPageSetupDialog::ShowModal()
|
|||||||
{
|
{
|
||||||
#ifdef __WIN95__
|
#ifdef __WIN95__
|
||||||
m_pageSetupData.ConvertToNative();
|
m_pageSetupData.ConvertToNative();
|
||||||
if (PageSetupDlg( (PAGESETUPDLG *)m_pageSetupData.GetNativeData() ))
|
PAGESETUPDLG *p = (PAGESETUPDLG *)m_pageSetupData.GetNativeData();
|
||||||
|
if (m_dialogParent)
|
||||||
|
p->hwndOwner = (HWND) m_dialogParent->GetHWND();
|
||||||
|
else if (wxTheApp->GetTopWindow())
|
||||||
|
p->hwndOwner = (HWND) wxTheApp->GetTopWindow()->GetHWND();
|
||||||
|
else
|
||||||
|
p->hwndOwner = 0;
|
||||||
|
BOOL retVal = PageSetupDlg( p ) ;
|
||||||
|
p->hwndOwner = 0;
|
||||||
|
if (retVal)
|
||||||
{
|
{
|
||||||
m_pageSetupData.ConvertFromNative();
|
m_pageSetupData.ConvertFromNative();
|
||||||
return wxID_OK;
|
return wxID_OK;
|
||||||
|
Reference in New Issue
Block a user