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