]> git.saurik.com Git - wxWidgets.git/blame_incremental - src/mac/classic/printdlg.cpp
replace use of deprecated GtkPixmap
[wxWidgets.git] / src / mac / classic / printdlg.cpp
... / ...
CommitLineData
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
27IMPLEMENT_DYNAMIC_CLASS(wxPrintDialog, wxDialog)
28IMPLEMENT_CLASS(wxPageSetupDialog, wxDialog)
29
30wxPrintDialog::wxPrintDialog()
31{
32 m_dialogParent = NULL;
33 m_printerDC = NULL;
34 m_destroyDC = true;
35}
36
37wxPrintDialog::wxPrintDialog(wxWindow *p, wxPrintDialogData* data)
38{
39 Create(p, data);
40}
41
42wxPrintDialog::wxPrintDialog(wxWindow *p, wxPrintData* data)
43{
44 wxPrintDialogData data2;
45 if ( data )
46 data2 = *data;
47
48 Create(p, &data2);
49}
50
51bool 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
63wxPrintDialog::~wxPrintDialog()
64{
65 if (m_destroyDC && m_printerDC) {
66 delete m_printerDC;
67 m_printerDC = NULL;
68 }
69}
70
71int 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
81wxDC *wxPrintDialog::GetPrintDC()
82{
83 return new wxPrinterDC( m_printDialogData.GetPrintData() ) ;
84}
85
86/*
87* wxPageSetupDialog
88*/
89
90wxPageSetupDialog::wxPageSetupDialog():
91wxDialog()
92{
93 m_dialogParent = NULL;
94}
95
96wxPageSetupDialog::wxPageSetupDialog(wxWindow *p, wxPageSetupData *data):
97wxDialog()
98{
99 Create(p, data);
100}
101
102bool 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
112wxPageSetupDialog::~wxPageSetupDialog()
113{
114}
115
116int 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}