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