X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/42e69d6b435a4dd5415caf3750db62cf45b6f373..d1d276f23104cc30afaceb6beddcba738d5ad2d2:/src/msw/printdlg.cpp diff --git a/src/msw/printdlg.cpp b/src/msw/printdlg.cpp index c9e98a3dbf..a2c894079b 100644 --- a/src/msw/printdlg.cpp +++ b/src/msw/printdlg.cpp @@ -5,8 +5,8 @@ // Modified by: // Created: 04/01/98 // RCS-ID: $Id$ -// Copyright: (c) Julian Smart and Markus Holzem -// Licence: wxWindows license +// Copyright: (c) Julian Smart +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// // =========================================================================== @@ -17,7 +17,7 @@ // headers // --------------------------------------------------------------------------- -#ifdef __GNUG__ +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) #pragma implementation "printdlg.h" #endif @@ -28,14 +28,17 @@ #pragma hdrstop #endif -#include "wx/printdlg.h" -#include "wx/dcprint.h" +// Don't use the Windows print dialog if we're in wxUniv mode and using +// the PostScript architecture +#if wxUSE_PRINTING_ARCHITECTURE && (!defined(__WXUNIVERSAL__) || !wxUSE_POSTSCRIPT_ARCHITECTURE_IN_MSW) -// Have to emulate page setup dialog for Win16 -#if !defined(__WIN95__) - #include "wx/generic/prntdlgg.h" +#ifndef WX_PRECOMP + #include "wx/app.h" #endif +#include "wx/printdlg.h" +#include "wx/dcprint.h" + #include #include "wx/msw/private.h" @@ -50,10 +53,8 @@ // wxWin macros // --------------------------------------------------------------------------- -#if !USE_SHARED_LIBRARY IMPLEMENT_DYNAMIC_CLASS(wxPrintDialog, wxDialog) IMPLEMENT_CLASS(wxPageSetupDialog, wxDialog) -#endif // =========================================================================== // implementation @@ -67,7 +68,7 @@ wxPrintDialog::wxPrintDialog() { m_dialogParent = NULL; m_printerDC = NULL; - m_destroyDC = TRUE; + m_destroyDC = true; } wxPrintDialog::wxPrintDialog(wxWindow *p, wxPrintDialogData* data) @@ -88,14 +89,14 @@ bool wxPrintDialog::Create(wxWindow *p, wxPrintDialogData* data) { m_dialogParent = p; m_printerDC = NULL; - m_destroyDC = TRUE; + m_destroyDC = true; if ( data ) m_printDialogData = *data; m_printDialogData.SetOwnerWindow(p); - return TRUE; + return true; } wxPrintDialog::~wxPrintDialog() @@ -108,8 +109,19 @@ int wxPrintDialog::ShowModal() { m_printDialogData.ConvertToNative(); - bool ret = (PrintDlg( (PRINTDLG *)m_printDialogData.GetNativeData() ) != 0); - if ( ret != FALSE && ((PRINTDLG *)m_printDialogData.GetNativeData())->hDC) + 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) { wxPrinterDC *pdc = new wxPrinterDC((WXHDC) ((PRINTDLG *)m_printDialogData.GetNativeData())->hDC); m_printerDC = pdc; @@ -126,7 +138,7 @@ wxDC *wxPrintDialog::GetPrintDC() { if (m_printerDC) { - m_destroyDC = FALSE; + m_destroyDC = false; return m_printerDC; } else @@ -157,7 +169,7 @@ bool wxPageSetupDialog::Create(wxWindow *p, wxPageSetupData *data) #if defined(__WIN95__) m_pageSetupData.SetOwnerWindow(p); #endif - return TRUE; + return true; } wxPageSetupDialog::~wxPageSetupDialog() @@ -168,7 +180,16 @@ int wxPageSetupDialog::ShowModal() { #ifdef __WIN95__ 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(); return wxID_OK; @@ -179,8 +200,10 @@ int wxPageSetupDialog::ShowModal() wxGenericPageSetupDialog *genericPageSetupDialog = new wxGenericPageSetupDialog(GetParent(), & m_pageSetupData); int ret = genericPageSetupDialog->ShowModal(); m_pageSetupData = genericPageSetupDialog->GetPageSetupData(); - genericPageSetupDialog->Close(TRUE); + genericPageSetupDialog->Close(true); return ret; #endif } +#endif + // wxUSE_PRINTING_ARCHITECTURE