]>
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 #define IN_WX_MAIN_CPP
18 #include "wx/wxprec.h"
20 #if defined(__BORLANDC__)
27 #include "wx/printdlg.h"
28 #include "wx/dcprint.h"
30 // Have to emulate page setup dialog for Win16
31 #if !defined(__WIN95__)
32 #include "wx/generic/prntdlgg.h"
43 // Clash with Windows header files
48 #if !USE_SHARED_LIBRARY
49 IMPLEMENT_DYNAMIC_CLASS(wxPrintDialog
, wxDialog
)
50 IMPLEMENT_CLASS(wxPageSetupDialog
, wxDialog
)
53 wxPrintDialog::wxPrintDialog(void):
64 wxPrintDialog::wxPrintDialog(wxWindow
*p
, wxPrintData
* data
):
70 bool wxPrintDialog::Create(wxWindow
*p
, wxPrintData
* data
)
83 printData
.SetOwnerWindow(p
);
89 wxPrintDialog::~wxPrintDialog(void)
91 if (destroyDC
&& printerDC
)
93 if (deviceName
) delete[] deviceName
;
94 if (driverName
) delete[] driverName
;
95 if (portName
) delete[] portName
;
98 int wxPrintDialog::ShowModal(void)
100 printData
.ConvertToNative();
102 bool ret
= (PrintDlg( (PRINTDLG
*)printData
.printData
) != 0);
103 if ( ret
!= FALSE
&& ((PRINTDLG
*)printData
.printData
)->hDC
)
105 wxPrinterDC
*pdc
= new wxPrinterDC((WXHDC
) ((PRINTDLG
*)printData
.printData
)->hDC
);
107 printData
.ConvertFromNative();
114 DWORD exError = CommDlgExtendedError();
115 sprintf(buf, "ret = %d, ex error = %d", (int) ret, (int) exError);
122 wxDC
*wxPrintDialog::GetPrintDC(void)
137 wxPageSetupDialog::wxPageSetupDialog(void):
140 m_dialogParent
= NULL
;
143 wxPageSetupDialog::wxPageSetupDialog(wxWindow
*p
, wxPageSetupData
*data
):
149 bool wxPageSetupDialog::Create(wxWindow
*p
, wxPageSetupData
*data
)
154 m_pageSetupData
= (*data
);
156 #if defined(__WIN95__)
157 m_pageSetupData
.SetOwnerWindow(p
);
162 wxPageSetupDialog::~wxPageSetupDialog(void)
166 int wxPageSetupDialog::ShowModal(void)
169 m_pageSetupData
.ConvertToNative();
170 if (PageSetupDlg( (PAGESETUPDLG
*)m_pageSetupData
.GetNativeData() ))
172 m_pageSetupData
.ConvertFromNative();
178 wxGenericPageSetupDialog
*genericPageSetupDialog
= new wxGenericPageSetupDialog(GetParent(), & m_pageSetupData
);
179 int ret
= genericPageSetupDialog
->ShowModal();
180 m_pageSetupData
= genericPageSetupDialog
->GetPageSetupData();
181 genericPageSetupDialog
->Close(TRUE
);