]> git.saurik.com Git - wxWidgets.git/blob - src/mac/carbon/printdlg.cpp
dll fixes for media lib
[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 #ifdef __GNUG__
13 #pragma implementation "printdlg.h"
14 #endif
15
16 #include "wx/object.h"
17 #include "wx/printdlg.h"
18 #include "wx/mac/printdlg.h"
19 #include "wx/dcprint.h"
20 #include "wx/msgdlg.h"
21 #include "wx/mac/private/print.h"
22
23 // Use generic page setup dialog: use your own native one if one exists.
24
25 IMPLEMENT_DYNAMIC_CLASS(wxMacPrintDialog, wxPrintDialogBase)
26
27 wxMacPrintDialog::wxMacPrintDialog()
28 {
29 m_dialogParent = NULL;
30 m_printerDC = NULL;
31 m_destroyDC = TRUE;
32 }
33
34 wxMacPrintDialog::wxMacPrintDialog(wxWindow *p, wxPrintDialogData* data)
35 {
36 Create(p, data);
37 }
38
39 wxMacPrintDialog::wxMacPrintDialog(wxWindow *p, wxPrintData* data)
40 {
41 wxPrintDialogData data2;
42 if ( data )
43 data2 = *data;
44
45 Create(p, &data2);
46 }
47
48 bool wxMacPrintDialog::Create(wxWindow *p, wxPrintDialogData* data)
49 {
50 m_dialogParent = p;
51 m_printerDC = NULL;
52 m_destroyDC = TRUE;
53
54 if ( data )
55 m_printDialogData = *data;
56
57 return TRUE;
58 }
59
60 wxMacPrintDialog::~wxMacPrintDialog()
61 {
62 if (m_destroyDC && m_printerDC) {
63 delete m_printerDC;
64 m_printerDC = NULL;
65 }
66 }
67
68 int wxMacPrintDialog::ShowModal()
69 {
70 m_printDialogData.ConvertToNative() ;
71 int result = m_printDialogData.GetPrintData().m_nativePrintData->ShowPrintDialog() ;
72 if ( result == wxID_OK )
73 m_printDialogData.ConvertFromNative() ;
74
75 return result ;
76 }
77
78 wxDC *wxMacPrintDialog::GetPrintDC()
79 {
80 return new wxPrinterDC( m_printDialogData.GetPrintData() ) ;
81 }
82
83 /*
84 * wxMacPageSetupDialog
85 */
86
87 IMPLEMENT_CLASS(wxMacPageSetupDialog, wxPageSetupDialogBase)
88
89 wxMacPageSetupDialog::wxMacPageSetupDialog(wxWindow *p, wxPageSetupDialogData *data) :
90 wxPageSetupDialogBase()
91 {
92 Create(p, data);
93 }
94
95 bool wxMacPageSetupDialog::Create(wxWindow *p, wxPageSetupDialogData *data)
96 {
97 m_dialogParent = p;
98
99 if (data)
100 m_pageSetupData = (*data);
101
102 return TRUE;
103 }
104
105 wxMacPageSetupDialog::~wxMacPageSetupDialog()
106 {
107 }
108
109 wxPageSetupData& wxMacPageSetupDialog::GetPageSetupDialogData()
110 {
111 return m_pageSetupData;
112 }
113
114 int wxMacPageSetupDialog::ShowModal()
115 {
116 m_pageSetupData.ConvertToNative();
117
118 int result = m_pageSetupData.GetPrintData().m_nativePrintData->ShowPageSetupDialog();
119
120 if (result == wxID_OK )
121 m_pageSetupData.ConvertFromNative();
122
123 return result;
124 }
125