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