]> git.saurik.com Git - wxWidgets.git/blob - src/mac/carbon/printdlg.cpp
adapting to bitmaprefdata changes
[wxWidgets.git] / src / mac / carbon / printdlg.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: printdlg.cpp
3 // Purpose: wxPrintDialog, wxPageSetupDialog
4 // Author: Stefan Csomor
5 // Modified by:
6 // Created: 1998-01-01
7 // RCS-ID: $Id$
8 // Copyright: (c) Stefan Csomor
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
13 #pragma implementation "printdlg.h"
14 #endif
15
16 #include "wx/wxprec.h"
17
18 #if wxUSE_PRINTING_ARCHITECTURE
19
20 #include "wx/object.h"
21 #include "wx/printdlg.h"
22 #include "wx/mac/printdlg.h"
23 #include "wx/dcprint.h"
24 #include "wx/msgdlg.h"
25 #include "wx/mac/private/print.h"
26
27 // Use generic page setup dialog: use your own native one if one exists.
28
29 IMPLEMENT_DYNAMIC_CLASS(wxMacPrintDialog, wxPrintDialogBase)
30
31 wxMacPrintDialog::wxMacPrintDialog()
32 {
33 m_dialogParent = NULL;
34 m_printerDC = NULL;
35 m_destroyDC = TRUE;
36 }
37
38 wxMacPrintDialog::wxMacPrintDialog(wxWindow *p, wxPrintDialogData* data)
39 {
40 Create(p, data);
41 }
42
43 wxMacPrintDialog::wxMacPrintDialog(wxWindow *p, wxPrintData* data)
44 {
45 wxPrintDialogData data2;
46 if ( data )
47 data2 = *data;
48
49 Create(p, &data2);
50 }
51
52 bool wxMacPrintDialog::Create(wxWindow *p, wxPrintDialogData* data)
53 {
54 m_dialogParent = p;
55 m_printerDC = NULL;
56 m_destroyDC = TRUE;
57
58 if ( data )
59 m_printDialogData = *data;
60
61 return TRUE;
62 }
63
64 wxMacPrintDialog::~wxMacPrintDialog()
65 {
66 if (m_destroyDC && m_printerDC) {
67 delete m_printerDC;
68 m_printerDC = NULL;
69 }
70 }
71
72 int wxMacPrintDialog::ShowModal()
73 {
74 m_printDialogData.ConvertToNative() ;
75 int result = m_printDialogData.GetPrintData().m_nativePrintData->ShowPrintDialog() ;
76 if ( result == wxID_OK )
77 m_printDialogData.ConvertFromNative() ;
78
79 return result ;
80 }
81
82 wxDC *wxMacPrintDialog::GetPrintDC()
83 {
84 return new wxPrinterDC( m_printDialogData.GetPrintData() ) ;
85 }
86
87 /*
88 * wxMacPageSetupDialog
89 */
90
91 IMPLEMENT_CLASS(wxMacPageSetupDialog, wxPageSetupDialogBase)
92
93 wxMacPageSetupDialog::wxMacPageSetupDialog(wxWindow *p, wxPageSetupDialogData *data) :
94 wxPageSetupDialogBase()
95 {
96 Create(p, data);
97 }
98
99 bool wxMacPageSetupDialog::Create(wxWindow *p, wxPageSetupDialogData *data)
100 {
101 m_dialogParent = p;
102
103 if (data)
104 m_pageSetupData = (*data);
105
106 return TRUE;
107 }
108
109 wxMacPageSetupDialog::~wxMacPageSetupDialog()
110 {
111 }
112
113 wxPageSetupData& wxMacPageSetupDialog::GetPageSetupDialogData()
114 {
115 return m_pageSetupData;
116 }
117
118 int wxMacPageSetupDialog::ShowModal()
119 {
120 m_pageSetupData.ConvertToNative();
121
122 int result = m_pageSetupData.GetPrintData().m_nativePrintData->ShowPageSetupDialog();
123
124 if (result == wxID_OK )
125 m_pageSetupData.ConvertFromNative();
126
127 return result;
128 }
129
130 #endif
131