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