#endif
#include "wx/object.h"
-#include "wx/mac/printdlg.h"
+#include "wx/printdlg.h"
#include "wx/dcprint.h"
+#include "wx/mac/uma.h"
// Use generic page setup dialog: use your own native one if one exists.
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()
{
int result = wxID_CANCEL ;
+#if !TARGET_CARBON
+
OSErr err ;
wxString message ;
- ::PrOpen() ;
+ ::UMAPrOpen() ;
err = PrError() ;
if ( !err )
{
- m_printData.ConvertToNative() ;
- if ( m_printData.macPrintInfo && ::PrJobDialog( m_printData.macPrintInfo ) )
+ m_printDialogData.ConvertToNative() ;
+ if ( ::PrJobDialog( m_printDialogData.GetPrintData().m_macPrintInfo ) )
{
- m_printData.ConvertFromNative() ;
+ m_printDialogData.ConvertFromNative() ;
result = wxID_OK ;
}
message.Printf( "Print Error %d", err ) ;
wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
}
- ::PrClose() ;
-
+ ::UMAPrClose() ;
+#else
+ #if __UNIX__
+ #warning "TODO:Printing for carbon"
+ #else
+ #pragma warning "TODO:Printing for carbon"
+ #endif
+#endif
return result ;
}
wxDC *wxPrintDialog::GetPrintDC()
{
- return new wxPrinterDC( m_printData ) ;
+ return new wxPrinterDC( m_printDialogData.GetPrintData() ) ;
}
/*
int wxPageSetupDialog::ShowModal()
{
int result = wxID_CANCEL ;
+#if !TARGET_CARBON
+
OSErr err ;
wxString message ;
- ::PrOpen() ;
+ ::UMAPrOpen() ;
err = PrError() ;
if ( !err )
{
m_pageSetupData.ConvertToNative() ;
- if ( m_pageSetupData.m_macPageSetupInfo && ::PrStlDialog( m_pageSetupData.m_macPageSetupInfo ) )
+ if ( ::PrStlDialog( m_pageSetupData.GetPrintData().m_macPrintInfo ) )
{
m_pageSetupData.ConvertFromNative() ;
result = wxID_OK ;
message.Printf( "Print Error %d", err ) ;
wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
}
- ::PrClose() ;
-
+ ::UMAPrClose() ;
+#else
+ #if __UNIX__
+ #warning "TODO:Printing for carbon"
+ #else
+ #pragma warning "TODO:Printing for carbon"
+ #endif
+#endif
return result ;
}