]> git.saurik.com Git - wxWidgets.git/blame - src/mac/carbon/printdlg.cpp
Do not emit a wxEVT_COMMAND_TEXT_UPDATED when the tab key is lifted (otherwise each...
[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
65571936 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"
08680429 18#include "wx/mac/printdlg.h"
e9576ca5 19#include "wx/dcprint.h"
0bec761d 20#include "wx/msgdlg.h"
746d7582 21#include "wx/mac/private/print.h"
a3d3d3bf 22
e9576ca5 23// Use generic page setup dialog: use your own native one if one exists.
e9576ca5 24
c061373d 25IMPLEMENT_DYNAMIC_CLASS(wxMacPrintDialog, wxPrintDialogBase)
e9576ca5 26
c061373d 27wxMacPrintDialog::wxMacPrintDialog()
e9576ca5
SC
28{
29 m_dialogParent = NULL;
e7549107
SC
30 m_printerDC = NULL;
31 m_destroyDC = TRUE;
e9576ca5
SC
32}
33
c061373d 34wxMacPrintDialog::wxMacPrintDialog(wxWindow *p, wxPrintDialogData* data)
e9576ca5
SC
35{
36 Create(p, data);
37}
38
c061373d 39wxMacPrintDialog::wxMacPrintDialog(wxWindow *p, wxPrintData* data)
e7549107
SC
40{
41 wxPrintDialogData data2;
42 if ( data )
43 data2 = *data;
e40298d5 44
e7549107
SC
45 Create(p, &data2);
46}
47
c061373d 48bool wxMacPrintDialog::Create(wxWindow *p, wxPrintDialogData* data)
e9576ca5
SC
49{
50 m_dialogParent = p;
e7549107
SC
51 m_printerDC = NULL;
52 m_destroyDC = TRUE;
e40298d5 53
e9576ca5 54 if ( data )
e7549107 55 m_printDialogData = *data;
e40298d5 56
e9576ca5
SC
57 return TRUE;
58}
59
c061373d 60wxMacPrintDialog::~wxMacPrintDialog()
e9576ca5 61{
f5bb2251 62 if (m_destroyDC && m_printerDC) {
e7549107 63 delete m_printerDC;
f5bb2251
GD
64 m_printerDC = NULL;
65 }
e9576ca5
SC
66}
67
c061373d 68int wxMacPrintDialog::ShowModal()
e9576ca5 69{
746d7582
SC
70 m_printDialogData.ConvertToNative() ;
71 int result = m_printDialogData.GetPrintData().m_nativePrintData->ShowPrintDialog() ;
72 if ( result == wxID_OK )
73 m_printDialogData.ConvertFromNative() ;
0bec761d 74
e40298d5 75 return result ;
e9576ca5
SC
76}
77
c061373d 78wxDC *wxMacPrintDialog::GetPrintDC()
e9576ca5 79{
e7549107 80 return new wxPrinterDC( m_printDialogData.GetPrintData() ) ;
e9576ca5
SC
81}
82
83/*
08680429 84* wxMacPageSetupDialog
e40298d5 85*/
e9576ca5 86
08680429 87IMPLEMENT_CLASS(wxMacPageSetupDialog, wxPageSetupDialogBase)
e9576ca5 88
08680429
RR
89wxMacPageSetupDialog::wxMacPageSetupDialog(wxWindow *p, wxPageSetupDialogData *data) :
90wxPageSetupDialogBase()
e9576ca5
SC
91{
92 Create(p, data);
93}
94
08680429 95bool wxMacPageSetupDialog::Create(wxWindow *p, wxPageSetupDialogData *data)
e9576ca5
SC
96{
97 m_dialogParent = p;
e40298d5 98
e9576ca5
SC
99 if (data)
100 m_pageSetupData = (*data);
e40298d5 101
e9576ca5
SC
102 return TRUE;
103}
104
08680429 105wxMacPageSetupDialog::~wxMacPageSetupDialog()
e9576ca5
SC
106{
107}
108
08680429
RR
109wxPageSetupData& wxMacPageSetupDialog::GetPageSetupDialogData()
110{
111 return m_pageSetupData;
112}
113
114int wxMacPageSetupDialog::ShowModal()
e9576ca5 115{
08680429
RR
116 m_pageSetupData.ConvertToNative();
117
118 int result = m_pageSetupData.GetPrintData().m_nativePrintData->ShowPageSetupDialog();
119
746d7582 120 if (result == wxID_OK )
08680429 121 m_pageSetupData.ConvertFromNative();
962cbf2e 122
08680429 123 return result;
e9576ca5
SC
124}
125