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