]> git.saurik.com Git - wxWidgets.git/blobdiff - src/mac/printdlg.cpp
wxBitmap::LoadFile and SaveFile now uses wxImage's methods in case there is no wxBitm...
[wxWidgets.git] / src / mac / printdlg.cpp
index 18c7a8427e244c53973cb4c1a70e6d3882ec41ba..5f914ddbfd90632dd3091071bfd7831794f984a0 100644 (file)
@@ -14,7 +14,7 @@
 #endif
 
 #include "wx/object.h"
-#include "wx/mac/printdlg.h"
+#include "wx/printdlg.h"
 #include "wx/dcprint.h"
 
 // Use generic page setup dialog: use your own native one if one exists.
@@ -24,30 +24,43 @@ IMPLEMENT_DYNAMIC_CLASS(wxPrintDialog, wxDialog)
 IMPLEMENT_CLASS(wxPageSetupDialog, wxDialog)
 #endif
 
-wxPrintDialog::wxPrintDialog():
- wxDialog()
+wxPrintDialog::wxPrintDialog()
 {
     m_dialogParent = NULL;
+    m_printerDC = NULL;
+    m_destroyDC = TRUE;
 }
 
-wxPrintDialog::wxPrintDialog(wxWindow *p, wxPrintData* data):
- wxDialog()
+wxPrintDialog::wxPrintDialog(wxWindow *p, wxPrintDialogData* data)
 {
     Create(p, data);
 }
 
-bool wxPrintDialog::Create(wxWindow *p, wxPrintData* data)
+wxPrintDialog::wxPrintDialog(wxWindow *p, wxPrintData* data)
+{
+    wxPrintDialogData data2;
+    if ( data )
+        data2 = *data;
+
+    Create(p, &data2);
+}
+
+bool wxPrintDialog::Create(wxWindow *p, wxPrintDialogData* data)
 {
     m_dialogParent = p;
+    m_printerDC = NULL;
+    m_destroyDC = TRUE;
 
     if ( data )
-        m_printData = *data;
+        m_printDialogData = *data;
 
     return TRUE;
 }
 
 wxPrintDialog::~wxPrintDialog()
 {
+    if (m_destroyDC && m_printerDC)
+        delete m_printerDC;
 }
 
 int wxPrintDialog::ShowModal()
@@ -60,10 +73,10 @@ int wxPrintDialog::ShowModal()
        
        if ( !err )
        {
-               m_printData.ConvertToNative() ;
-               if  ( m_printData.macPrintInfo && ::PrJobDialog( m_printData.macPrintInfo ) )
+               m_printDialogData.ConvertToNative() ;
+               if  ( m_printDialogData.m_macPrintInfo && ::PrJobDialog( m_printDialogData.m_macPrintInfo ) )
                {
-                       m_printData.ConvertFromNative() ;
+                       m_printDialogData.ConvertFromNative() ;
                        result = wxID_OK ;
                }
 
@@ -80,7 +93,7 @@ int wxPrintDialog::ShowModal()
 
 wxDC *wxPrintDialog::GetPrintDC()
 {
-    return new wxPrinterDC( m_printData ) ;
+    return new wxPrinterDC( m_printDialogData.GetPrintData() ) ;
 }
 
 /*