]>
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 IMPLEMENT_DYNAMIC_CLASS(wxPrintDialog
, wxDialog
)
23 IMPLEMENT_CLASS(wxPageSetupDialog
, wxDialog
)
25 wxPrintDialog::wxPrintDialog()
27 m_dialogParent
= NULL
;
32 wxPrintDialog::wxPrintDialog(wxWindow
*p
, wxPrintDialogData
* data
)
37 wxPrintDialog::wxPrintDialog(wxWindow
*p
, wxPrintData
* data
)
39 wxPrintDialogData data2
;
46 bool wxPrintDialog::Create(wxWindow
*p
, wxPrintDialogData
* data
)
53 m_printDialogData
= *data
;
58 wxPrintDialog::~wxPrintDialog()
60 if (m_destroyDC
&& m_printerDC
)
64 int wxPrintDialog::ShowModal()
66 int result
= wxID_CANCEL
;
74 m_printDialogData
.ConvertToNative() ;
75 if ( m_printDialogData
.m_macPrintInfo
&& ::PrJobDialog( m_printDialogData
.m_macPrintInfo
) )
77 m_printDialogData
.ConvertFromNative() ;
84 message
.Printf( "Print Error %d", err
) ;
85 wxMessageDialog
dialog( NULL
, message
, "", wxICON_HAND
| wxOK
) ;
92 wxDC
*wxPrintDialog::GetPrintDC()
94 return new wxPrinterDC( m_printDialogData
.GetPrintData() ) ;
101 wxPageSetupDialog::wxPageSetupDialog():
104 m_dialogParent
= NULL
;
107 wxPageSetupDialog::wxPageSetupDialog(wxWindow
*p
, wxPageSetupData
*data
):
113 bool wxPageSetupDialog::Create(wxWindow
*p
, wxPageSetupData
*data
)
118 m_pageSetupData
= (*data
);
123 wxPageSetupDialog::~wxPageSetupDialog()
127 int wxPageSetupDialog::ShowModal()
129 int result
= wxID_CANCEL
;
137 m_pageSetupData
.ConvertToNative() ;
138 if ( m_pageSetupData
.m_macPageSetupInfo
&& ::PrStlDialog( m_pageSetupData
.m_macPageSetupInfo
) )
140 m_pageSetupData
.ConvertFromNative() ;
147 message
.Printf( "Print Error %d", err
) ;
148 wxMessageDialog
dialog( NULL
, message
, "", wxICON_HAND
| wxOK
) ;