]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/printdlg.cpp
Also allow key events for Shift-Tab when wxWANTS_CHARS style is used
[wxWidgets.git] / src / msw / printdlg.cpp
index 17f7a55d2bee2371e8a87de63d5589b5546e348a..d7387012f2889df4a6db5dcfeb02af5660044e84 100644 (file)
@@ -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
 
     #pragma hdrstop
 #endif
 
+// 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)
+
+#ifndef WX_PRECOMP
+    #include "wx/app.h"
+#endif
+
 #include "wx/printdlg.h"
 #include "wx/dcprint.h"
 
@@ -106,7 +114,18 @@ int wxPrintDialog::ShowModal()
 {
     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)
     {
         wxPrinterDC *pdc = new wxPrinterDC((WXHDC) ((PRINTDLG *)m_printDialogData.GetNativeData())->hDC);
@@ -166,7 +185,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;
@@ -182,3 +210,5 @@ int wxPageSetupDialog::ShowModal()
 #endif
 }
 
+#endif
+    // wxUSE_PRINTING_ARCHITECTURE