]>
git.saurik.com Git - wxWidgets.git/blob - src/mac/printdlg.cpp
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxPrintDialog, wxPageSetupDialog
8 // Copyright: (c) AUTHOR
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
13 #pragma implementation "printdlg.h"
16 #include "wx/object.h"
17 #include "wx/printdlg.h"
18 #include "wx/dcprint.h"
20 // Use generic page setup dialog: use your own native one if one exists.
22 #if !USE_SHARED_LIBRARY
23 IMPLEMENT_DYNAMIC_CLASS(wxPrintDialog
, wxDialog
)
24 IMPLEMENT_CLASS(wxPageSetupDialog
, wxDialog
)
27 wxPrintDialog::wxPrintDialog()
29 m_dialogParent
= NULL
;
34 wxPrintDialog::wxPrintDialog(wxWindow
*p
, wxPrintDialogData
* data
)
39 wxPrintDialog::wxPrintDialog(wxWindow
*p
, wxPrintData
* data
)
41 wxPrintDialogData data2
;
48 bool wxPrintDialog::Create(wxWindow
*p
, wxPrintDialogData
* data
)
55 m_printDialogData
= *data
;
60 wxPrintDialog::~wxPrintDialog()
62 if (m_destroyDC
&& m_printerDC
)
66 int wxPrintDialog::ShowModal()
68 int result
= wxID_CANCEL
;
76 m_printDialogData
.ConvertToNative() ;
77 if ( m_printDialogData
.m_macPrintInfo
&& ::PrJobDialog( m_printDialogData
.m_macPrintInfo
) )
79 m_printDialogData
.ConvertFromNative() ;
86 message
.Printf( "Print Error %d", err
) ;
87 wxMessageDialog
dialog( NULL
, message
, "", wxICON_HAND
| wxOK
) ;
94 wxDC
*wxPrintDialog::GetPrintDC()
96 return new wxPrinterDC( m_printDialogData
.GetPrintData() ) ;
103 wxPageSetupDialog::wxPageSetupDialog():
106 m_dialogParent
= NULL
;
109 wxPageSetupDialog::wxPageSetupDialog(wxWindow
*p
, wxPageSetupData
*data
):
115 bool wxPageSetupDialog::Create(wxWindow
*p
, wxPageSetupData
*data
)
120 m_pageSetupData
= (*data
);
125 wxPageSetupDialog::~wxPageSetupDialog()
129 int wxPageSetupDialog::ShowModal()
131 int result
= wxID_CANCEL
;
139 m_pageSetupData
.ConvertToNative() ;
140 if ( m_pageSetupData
.m_macPageSetupInfo
&& ::PrStlDialog( m_pageSetupData
.m_macPageSetupInfo
) )
142 m_pageSetupData
.ConvertFromNative() ;
149 message
.Printf( "Print Error %d", err
) ;
150 wxMessageDialog
dialog( NULL
, message
, "", wxICON_HAND
| wxOK
) ;