]> git.saurik.com Git - wxWidgets.git/blame - src/mac/carbon/printdlg.cpp
adding a peer pointing back to wxWindow
[wxWidgets.git] / src / mac / carbon / printdlg.cpp
CommitLineData
e9576ca5
SC
1/////////////////////////////////////////////////////////////////////////////
2// Name: printdlg.cpp
3// Purpose: wxPrintDialog, wxPageSetupDialog
a31a5f85 4// Author: Stefan Csomor
e9576ca5 5// Modified by:
a31a5f85 6// Created: 1998-01-01
e9576ca5 7// RCS-ID: $Id$
a31a5f85 8// Copyright: (c) Stefan Csomor
65571936 9// Licence: wxWindows licence
e9576ca5
SC
10/////////////////////////////////////////////////////////////////////////////
11
3d1a4878 12#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
e9576ca5
SC
13#pragma implementation "printdlg.h"
14#endif
15
3d1a4878
SC
16#include "wx/wxprec.h"
17
179e085f
RN
18#if wxUSE_PRINTING_ARCHITECTURE
19
e9576ca5 20#include "wx/object.h"
e7549107 21#include "wx/printdlg.h"
08680429 22#include "wx/mac/printdlg.h"
e9576ca5 23#include "wx/dcprint.h"
0bec761d 24#include "wx/msgdlg.h"
746d7582 25#include "wx/mac/private/print.h"
a3d3d3bf 26
e9576ca5 27// Use generic page setup dialog: use your own native one if one exists.
e9576ca5 28
c061373d 29IMPLEMENT_DYNAMIC_CLASS(wxMacPrintDialog, wxPrintDialogBase)
e9576ca5 30
c061373d 31wxMacPrintDialog::wxMacPrintDialog()
e9576ca5
SC
32{
33 m_dialogParent = NULL;
e7549107
SC
34 m_printerDC = NULL;
35 m_destroyDC = TRUE;
e9576ca5
SC
36}
37
c061373d 38wxMacPrintDialog::wxMacPrintDialog(wxWindow *p, wxPrintDialogData* data)
e9576ca5
SC
39{
40 Create(p, data);
41}
42
c061373d 43wxMacPrintDialog::wxMacPrintDialog(wxWindow *p, wxPrintData* data)
e7549107
SC
44{
45 wxPrintDialogData data2;
46 if ( data )
47 data2 = *data;
e40298d5 48
e7549107
SC
49 Create(p, &data2);
50}
51
c061373d 52bool wxMacPrintDialog::Create(wxWindow *p, wxPrintDialogData* data)
e9576ca5
SC
53{
54 m_dialogParent = p;
e7549107
SC
55 m_printerDC = NULL;
56 m_destroyDC = TRUE;
e40298d5 57
e9576ca5 58 if ( data )
e7549107 59 m_printDialogData = *data;
e40298d5 60
e9576ca5
SC
61 return TRUE;
62}
63
c061373d 64wxMacPrintDialog::~wxMacPrintDialog()
e9576ca5 65{
f5bb2251 66 if (m_destroyDC && m_printerDC) {
e7549107 67 delete m_printerDC;
f5bb2251
GD
68 m_printerDC = NULL;
69 }
e9576ca5
SC
70}
71
c061373d 72int wxMacPrintDialog::ShowModal()
e9576ca5 73{
746d7582
SC
74 m_printDialogData.ConvertToNative() ;
75 int result = m_printDialogData.GetPrintData().m_nativePrintData->ShowPrintDialog() ;
76 if ( result == wxID_OK )
77 m_printDialogData.ConvertFromNative() ;
0bec761d 78
e40298d5 79 return result ;
e9576ca5
SC
80}
81
c061373d 82wxDC *wxMacPrintDialog::GetPrintDC()
e9576ca5 83{
e7549107 84 return new wxPrinterDC( m_printDialogData.GetPrintData() ) ;
e9576ca5
SC
85}
86
87/*
08680429 88* wxMacPageSetupDialog
e40298d5 89*/
e9576ca5 90
08680429 91IMPLEMENT_CLASS(wxMacPageSetupDialog, wxPageSetupDialogBase)
e9576ca5 92
08680429
RR
93wxMacPageSetupDialog::wxMacPageSetupDialog(wxWindow *p, wxPageSetupDialogData *data) :
94wxPageSetupDialogBase()
e9576ca5
SC
95{
96 Create(p, data);
97}
98
08680429 99bool wxMacPageSetupDialog::Create(wxWindow *p, wxPageSetupDialogData *data)
e9576ca5
SC
100{
101 m_dialogParent = p;
e40298d5 102
e9576ca5
SC
103 if (data)
104 m_pageSetupData = (*data);
e40298d5 105
e9576ca5
SC
106 return TRUE;
107}
108
08680429 109wxMacPageSetupDialog::~wxMacPageSetupDialog()
e9576ca5
SC
110{
111}
112
08680429
RR
113wxPageSetupData& wxMacPageSetupDialog::GetPageSetupDialogData()
114{
115 return m_pageSetupData;
116}
117
118int wxMacPageSetupDialog::ShowModal()
e9576ca5 119{
08680429
RR
120 m_pageSetupData.ConvertToNative();
121
122 int result = m_pageSetupData.GetPrintData().m_nativePrintData->ShowPageSetupDialog();
123
746d7582 124 if (result == wxID_OK )
08680429 125 m_pageSetupData.ConvertFromNative();
962cbf2e 126
08680429 127 return result;
e9576ca5
SC
128}
129
179e085f
RN
130#endif
131