]> git.saurik.com Git - wxWidgets.git/blob - src/osx/carbon/printdlg.cpp
changing disclosure triangle to allow for label
[wxWidgets.git] / src / osx / carbon / printdlg.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/osx/carbon/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
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #include "wx/wxprec.h"
13
14 #if wxUSE_PRINTING_ARCHITECTURE
15
16 #include "wx/printdlg.h"
17
18 #ifndef WX_PRECOMP
19 #include "wx/object.h"
20 #include "wx/dcprint.h"
21 #include "wx/msgdlg.h"
22 #include "wx/textctrl.h"
23 #include "wx/sizer.h"
24 #include "wx/stattext.h"
25 #endif
26
27 #include "wx/osx/printdlg.h"
28 #include "wx/osx/private/print.h"
29 #include "wx/osx/private.h"
30 #include "wx/statline.h"
31
32 int wxMacPrintDialog::ShowModal()
33 {
34 m_printDialogData.GetPrintData().ConvertToNative();
35 ((wxOSXPrintData*)m_printDialogData.GetPrintData().GetNativeData())->TransferFrom( &m_printDialogData );
36
37 int result = wxID_CANCEL;
38
39 OSErr err = noErr;
40 Boolean accepted;
41 wxOSXPrintData* nativeData = (wxOSXPrintData*)m_printDialogData.GetPrintData().GetNativeData();
42 err = PMSessionPrintDialog(nativeData->GetPrintSession(), nativeData->GetPrintSettings(),
43 nativeData->GetPageFormat(), &accepted );
44
45 if ((err == noErr) && !accepted)
46 {
47 // user clicked Cancel button
48 err = kPMCancel;
49 }
50
51 if (err == noErr)
52 {
53 result = wxID_OK;
54 }
55
56 if ((err != noErr) && (err != kPMCancel))
57 {
58 wxString message;
59
60 message.Printf( wxT("Print Error %d"), err );
61 wxMessageDialog dialog( NULL, message, wxEmptyString, wxICON_HAND | wxOK );
62 dialog.ShowModal();
63 }
64
65 if (result == wxID_OK)
66 {
67 m_printDialogData.GetPrintData().ConvertFromNative();
68 ((wxOSXPrintData*)m_printDialogData.GetPrintData().GetNativeData())->TransferTo( &m_printDialogData );
69 }
70 return result;
71 }
72
73 int wxMacPageSetupDialog::ShowModal()
74 {
75 m_pageSetupData.GetPrintData().ConvertToNative();
76 wxOSXPrintData* nativeData = (wxOSXPrintData*)m_pageSetupData.GetPrintData().GetNativeData();
77 nativeData->TransferFrom( &m_pageSetupData );
78
79 int result = wxID_CANCEL;
80 OSErr err = noErr;
81 Boolean accepted;
82
83 err = PMSessionPageSetupDialog( nativeData->GetPrintSession(), nativeData->GetPageFormat(),
84 &accepted );
85
86 if ((err == noErr) && !accepted)
87 {
88 // user clicked Cancel button
89 err = kPMCancel;
90 }
91
92 // If the user did not cancel, flatten and save the PageFormat object
93 // with our document.
94 if (err == noErr)
95 {
96 result = wxID_OK;
97 }
98
99 if ((err != noErr) && (err != kPMCancel))
100 {
101 wxString message;
102
103 message.Printf( wxT("Print Error %d"), err );
104 wxMessageDialog dialog( NULL, message, wxEmptyString, wxICON_HAND | wxOK );
105 dialog.ShowModal();
106 }
107
108 if (result == wxID_OK)
109 {
110 m_pageSetupData.GetPrintData().ConvertFromNative();
111 m_pageSetupData.SetPaperSize( m_pageSetupData.GetPrintData().GetPaperSize() );
112 nativeData->TransferTo( &m_pageSetupData );
113 }
114 return result;
115 }
116
117 #endif