]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/printdlg.cpp
better learn the operators...
[wxWidgets.git] / src / msw / printdlg.cpp
index 57ae304e130041e794ee601e2a7c5bf301396815..712b0d374a9466a0045d7040c67b87fe126684fa 100644 (file)
     #pragma hdrstop
 #endif
 
+#if wxUSE_PRINTING_ARCHITECTURE
+
+#ifndef WX_PRECOMP
+    #include "wx/app.h"
+#endif
+
 #include "wx/printdlg.h"
 #include "wx/dcprint.h"
 
 #endif
 
 #include <stdlib.h>
-#include <windows.h>
+
+#include "wx/msw/private.h"
+
 #include <commdlg.h>
 
 #ifndef __WIN32__
     #include <print.h>
 #endif
 
-// Clash with Windows header files
-#ifdef StartDoc
-#undef StartDoc
-#endif
-
 // ---------------------------------------------------------------------------
 // wxWin macros
 // ---------------------------------------------------------------------------
 
-#if !USE_SHARED_LIBRARY
     IMPLEMENT_DYNAMIC_CLASS(wxPrintDialog, wxDialog)
     IMPLEMENT_CLASS(wxPageSetupDialog, wxDialog)
-#endif
 
 // ===========================================================================
 // implementation
@@ -111,7 +112,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);
@@ -171,7 +183,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;
@@ -187,3 +208,5 @@ int wxPageSetupDialog::ShowModal()
 #endif
 }
 
+#endif
+    // wxUSE_PRINTING_ARCHITECTURE