]>
git.saurik.com Git - wxWidgets.git/blob - src/msw/printdlg.cpp
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxPrintDialog, wxPageSetupDialog
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart and Markus Holzem
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
13 #pragma implementation "printdlg.h"
16 // For compilers that support precompilation, includes "wx.h".
17 #include "wx/wxprec.h"
19 #if defined(__BORLANDC__)
26 #include "wx/printdlg.h"
27 #include "wx/dcprint.h"
29 // Have to emulate page setup dialog for Win16
30 #if !defined(__WIN95__)
31 #include "wx/generic/prntdlgg.h"
42 // Clash with Windows header files
47 #if !USE_SHARED_LIBRARY
48 IMPLEMENT_DYNAMIC_CLASS(wxPrintDialog
, wxDialog
)
49 IMPLEMENT_CLASS(wxPageSetupDialog
, wxDialog
)
52 wxPrintDialog::wxPrintDialog(void):
63 wxPrintDialog::wxPrintDialog(wxWindow
*p
, wxPrintData
* data
):
69 bool wxPrintDialog::Create(wxWindow
*p
, wxPrintData
* data
)
82 printData
.SetOwnerWindow(p
);
88 wxPrintDialog::~wxPrintDialog(void)
90 if (destroyDC
&& printerDC
)
92 if (deviceName
) delete[] deviceName
;
93 if (driverName
) delete[] driverName
;
94 if (portName
) delete[] portName
;
97 int wxPrintDialog::ShowModal(void)
99 printData
.ConvertToNative();
101 bool ret
= (PrintDlg( (PRINTDLG
*)printData
.printData
) != 0);
102 if ( ret
!= FALSE
&& ((PRINTDLG
*)printData
.printData
)->hDC
)
104 wxPrinterDC
*pdc
= new wxPrinterDC((WXHDC
) ((PRINTDLG
*)printData
.printData
)->hDC
);
106 printData
.ConvertFromNative();
113 DWORD exError = CommDlgExtendedError();
114 sprintf(buf, "ret = %d, ex error = %d", (int) ret, (int) exError);
121 wxDC
*wxPrintDialog::GetPrintDC(void)
136 wxPageSetupDialog::wxPageSetupDialog(void):
139 m_dialogParent
= NULL
;
142 wxPageSetupDialog::wxPageSetupDialog(wxWindow
*p
, wxPageSetupData
*data
):
148 bool wxPageSetupDialog::Create(wxWindow
*p
, wxPageSetupData
*data
)
153 m_pageSetupData
= (*data
);
155 #if defined(__WIN95__)
156 m_pageSetupData
.SetOwnerWindow(p
);
161 wxPageSetupDialog::~wxPageSetupDialog(void)
165 int wxPageSetupDialog::ShowModal(void)
168 m_pageSetupData
.ConvertToNative();
169 if (PageSetupDlg( (PAGESETUPDLG
*)m_pageSetupData
.GetNativeData() ))
171 m_pageSetupData
.ConvertFromNative();
177 wxGenericPageSetupDialog
*genericPageSetupDialog
= new wxGenericPageSetupDialog(GetParent(), & m_pageSetupData
);
178 int ret
= genericPageSetupDialog
->ShowModal();
179 m_pageSetupData
= genericPageSetupDialog
->GetPageSetupData();
180 genericPageSetupDialog
->Close(TRUE
);