]> git.saurik.com Git - wxWidgets.git/blame - src/mac/carbon/printdlg.cpp
Applied [ 1059554 ] patch for [1028659] fixes a couple of bugs with menus
[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
e9576ca5 18#include "wx/object.h"
e7549107 19#include "wx/printdlg.h"
08680429 20#include "wx/mac/printdlg.h"
e9576ca5 21#include "wx/dcprint.h"
0bec761d 22#include "wx/msgdlg.h"
746d7582 23#include "wx/mac/private/print.h"
a3d3d3bf 24
e9576ca5 25// Use generic page setup dialog: use your own native one if one exists.
e9576ca5 26
c061373d 27IMPLEMENT_DYNAMIC_CLASS(wxMacPrintDialog, wxPrintDialogBase)
e9576ca5 28
c061373d 29wxMacPrintDialog::wxMacPrintDialog()
e9576ca5
SC
30{
31 m_dialogParent = NULL;
e7549107
SC
32 m_printerDC = NULL;
33 m_destroyDC = TRUE;
e9576ca5
SC
34}
35
c061373d 36wxMacPrintDialog::wxMacPrintDialog(wxWindow *p, wxPrintDialogData* data)
e9576ca5
SC
37{
38 Create(p, data);
39}
40
c061373d 41wxMacPrintDialog::wxMacPrintDialog(wxWindow *p, wxPrintData* data)
e7549107
SC
42{
43 wxPrintDialogData data2;
44 if ( data )
45 data2 = *data;
e40298d5 46
e7549107
SC
47 Create(p, &data2);
48}
49
c061373d 50bool wxMacPrintDialog::Create(wxWindow *p, wxPrintDialogData* data)
e9576ca5
SC
51{
52 m_dialogParent = p;
e7549107
SC
53 m_printerDC = NULL;
54 m_destroyDC = TRUE;
e40298d5 55
e9576ca5 56 if ( data )
e7549107 57 m_printDialogData = *data;
e40298d5 58
e9576ca5
SC
59 return TRUE;
60}
61
c061373d 62wxMacPrintDialog::~wxMacPrintDialog()
e9576ca5 63{
f5bb2251 64 if (m_destroyDC && m_printerDC) {
e7549107 65 delete m_printerDC;
f5bb2251
GD
66 m_printerDC = NULL;
67 }
e9576ca5
SC
68}
69
c061373d 70int wxMacPrintDialog::ShowModal()
e9576ca5 71{
746d7582
SC
72 m_printDialogData.ConvertToNative() ;
73 int result = m_printDialogData.GetPrintData().m_nativePrintData->ShowPrintDialog() ;
74 if ( result == wxID_OK )
75 m_printDialogData.ConvertFromNative() ;
0bec761d 76
e40298d5 77 return result ;
e9576ca5
SC
78}
79
c061373d 80wxDC *wxMacPrintDialog::GetPrintDC()
e9576ca5 81{
e7549107 82 return new wxPrinterDC( m_printDialogData.GetPrintData() ) ;
e9576ca5
SC
83}
84
85/*
08680429 86* wxMacPageSetupDialog
e40298d5 87*/
e9576ca5 88
08680429 89IMPLEMENT_CLASS(wxMacPageSetupDialog, wxPageSetupDialogBase)
e9576ca5 90
08680429
RR
91wxMacPageSetupDialog::wxMacPageSetupDialog(wxWindow *p, wxPageSetupDialogData *data) :
92wxPageSetupDialogBase()
e9576ca5
SC
93{
94 Create(p, data);
95}
96
08680429 97bool wxMacPageSetupDialog::Create(wxWindow *p, wxPageSetupDialogData *data)
e9576ca5
SC
98{
99 m_dialogParent = p;
e40298d5 100
e9576ca5
SC
101 if (data)
102 m_pageSetupData = (*data);
e40298d5 103
e9576ca5
SC
104 return TRUE;
105}
106
08680429 107wxMacPageSetupDialog::~wxMacPageSetupDialog()
e9576ca5
SC
108{
109}
110
08680429
RR
111wxPageSetupData& wxMacPageSetupDialog::GetPageSetupDialogData()
112{
113 return m_pageSetupData;
114}
115
116int wxMacPageSetupDialog::ShowModal()
e9576ca5 117{
08680429
RR
118 m_pageSetupData.ConvertToNative();
119
120 int result = m_pageSetupData.GetPrintData().m_nativePrintData->ShowPageSetupDialog();
121
746d7582 122 if (result == wxID_OK )
08680429 123 m_pageSetupData.ConvertFromNative();
962cbf2e 124
08680429 125 return result;
e9576ca5
SC
126}
127