]> git.saurik.com Git - wxWidgets.git/blame - src/mac/carbon/printdlg.cpp
cleanup in toplevel activation, and switching to native carbon event notification...
[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
e40298d5 9// Licence: wxWindows licence
e9576ca5
SC
10/////////////////////////////////////////////////////////////////////////////
11
12#ifdef __GNUG__
13#pragma implementation "printdlg.h"
14#endif
15
16#include "wx/object.h"
e7549107 17#include "wx/printdlg.h"
e9576ca5 18#include "wx/dcprint.h"
0bec761d 19#include "wx/msgdlg.h"
746d7582 20#include "wx/mac/private/print.h"
a3d3d3bf 21
e9576ca5 22// Use generic page setup dialog: use your own native one if one exists.
e9576ca5 23
2f1ae414 24#if !USE_SHARED_LIBRARY
e9576ca5
SC
25IMPLEMENT_DYNAMIC_CLASS(wxPrintDialog, wxDialog)
26IMPLEMENT_CLASS(wxPageSetupDialog, wxDialog)
2f1ae414 27#endif
e9576ca5 28
e7549107 29wxPrintDialog::wxPrintDialog()
e9576ca5
SC
30{
31 m_dialogParent = NULL;
e7549107
SC
32 m_printerDC = NULL;
33 m_destroyDC = TRUE;
e9576ca5
SC
34}
35
e7549107 36wxPrintDialog::wxPrintDialog(wxWindow *p, wxPrintDialogData* data)
e9576ca5
SC
37{
38 Create(p, data);
39}
40
e7549107
SC
41wxPrintDialog::wxPrintDialog(wxWindow *p, wxPrintData* data)
42{
43 wxPrintDialogData data2;
44 if ( data )
45 data2 = *data;
e40298d5 46
e7549107
SC
47 Create(p, &data2);
48}
49
50bool wxPrintDialog::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
62wxPrintDialog::~wxPrintDialog()
63{
f5bb2251 64 if (m_destroyDC && m_printerDC) {
e7549107 65 delete m_printerDC;
f5bb2251
GD
66 m_printerDC = NULL;
67 }
e9576ca5
SC
68}
69
70int wxPrintDialog::ShowModal()
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
80wxDC *wxPrintDialog::GetPrintDC()
81{
e7549107 82 return new wxPrinterDC( m_printDialogData.GetPrintData() ) ;
e9576ca5
SC
83}
84
85/*
e40298d5
JS
86* wxPageSetupDialog
87*/
e9576ca5
SC
88
89wxPageSetupDialog::wxPageSetupDialog():
e40298d5 90wxDialog()
e9576ca5 91{
e40298d5 92 m_dialogParent = NULL;
e9576ca5
SC
93}
94
95wxPageSetupDialog::wxPageSetupDialog(wxWindow *p, wxPageSetupData *data):
e40298d5 96wxDialog()
e9576ca5
SC
97{
98 Create(p, data);
99}
100
101bool wxPageSetupDialog::Create(wxWindow *p, wxPageSetupData *data)
102{
103 m_dialogParent = p;
e40298d5 104
e9576ca5
SC
105 if (data)
106 m_pageSetupData = (*data);
e40298d5 107
e9576ca5
SC
108 return TRUE;
109}
110
111wxPageSetupDialog::~wxPageSetupDialog()
112{
113}
114
115int wxPageSetupDialog::ShowModal()
116{
746d7582
SC
117 m_pageSetupData.ConvertToNative() ;
118 int result = m_pageSetupData.GetPrintData().m_nativePrintData->ShowPageSetupDialog() ;
119 if (result == wxID_OK )
120 m_pageSetupData.ConvertFromNative() ;
962cbf2e 121
e40298d5 122 return result ;
e9576ca5
SC
123}
124