]> git.saurik.com Git - wxWidgets.git/blame - src/mac/classic/printdlg.cpp
Build fix after wxColourBase introduction.
[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
15#ifndef WX_PRECOMP
16 #include "wx/object.h"
17#endif
18
2646f485
SC
19#include "wx/printdlg.h"
20#include "wx/dcprint.h"
21#include "wx/msgdlg.h"
22#include "wx/mac/private/print.h"
23
24// Use generic page setup dialog: use your own native one if one exists.
25
2646f485
SC
26IMPLEMENT_DYNAMIC_CLASS(wxPrintDialog, wxDialog)
27IMPLEMENT_CLASS(wxPageSetupDialog, wxDialog)
2646f485
SC
28
29wxPrintDialog::wxPrintDialog()
30{
31 m_dialogParent = NULL;
32 m_printerDC = NULL;
8e3f3880 33 m_destroyDC = true;
2646f485
SC
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;
8e3f3880 46
2646f485
SC
47 Create(p, &data2);
48}
49
50bool wxPrintDialog::Create(wxWindow *p, wxPrintDialogData* data)
51{
52 m_dialogParent = p;
53 m_printerDC = NULL;
8e3f3880
WS
54 m_destroyDC = true;
55
2646f485
SC
56 if ( data )
57 m_printDialogData = *data;
8e3f3880
WS
58
59 return true;
2646f485
SC
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() ;
8e3f3880 76
2646f485
SC
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;
8e3f3880 104
2646f485
SC
105 if (data)
106 m_pageSetupData = (*data);
8e3f3880
WS
107
108 return true;
2646f485
SC
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() ;
8e3f3880 121
2646f485
SC
122 return result ;
123}