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