]>
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"
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):
55 m_dialogParent
= NULL
;
60 wxPrintDialog::wxPrintDialog(wxWindow
*p
, wxPrintDialogData
* data
):
66 bool wxPrintDialog::Create(wxWindow
*p
, wxPrintDialogData
* data
)
73 m_printDialogData
= *data
;
75 m_printDialogData
.SetOwnerWindow(p
);
80 wxPrintDialog::~wxPrintDialog(void)
82 if (m_destroyDC
&& m_printerDC
)
86 int wxPrintDialog::ShowModal(void)
88 m_printDialogData
.ConvertToNative();
90 bool ret
= (PrintDlg( (PRINTDLG
*)m_printDialogData
.GetNativeData() ) != 0);
91 if ( ret
!= FALSE
&& ((PRINTDLG
*)m_printDialogData
.GetNativeData())->hDC
)
93 wxPrinterDC
*pdc
= new wxPrinterDC((WXHDC
) ((PRINTDLG
*)m_printDialogData
.GetNativeData())->hDC
);
95 m_printDialogData
.ConvertFromNative();
102 DWORD exError = CommDlgExtendedError();
103 sprintf(buf, "ret = %d, ex error = %d", (int) ret, (int) exError);
110 wxDC
*wxPrintDialog::GetPrintDC(void)
125 wxPageSetupDialog::wxPageSetupDialog(void):
128 m_dialogParent
= NULL
;
131 wxPageSetupDialog::wxPageSetupDialog(wxWindow
*p
, wxPageSetupData
*data
):
137 bool wxPageSetupDialog::Create(wxWindow
*p
, wxPageSetupData
*data
)
142 m_pageSetupData
= (*data
);
144 #if defined(__WIN95__)
145 m_pageSetupData
.SetOwnerWindow(p
);
150 wxPageSetupDialog::~wxPageSetupDialog(void)
154 int wxPageSetupDialog::ShowModal(void)
157 m_pageSetupData
.ConvertToNative();
158 if (PageSetupDlg( (PAGESETUPDLG
*)m_pageSetupData
.GetNativeData() ))
160 m_pageSetupData
.ConvertFromNative();
166 wxGenericPageSetupDialog
*genericPageSetupDialog
= new wxGenericPageSetupDialog(GetParent(), & m_pageSetupData
);
167 int ret
= genericPageSetupDialog
->ShowModal();
168 m_pageSetupData
= genericPageSetupDialog
->GetPageSetupData();
169 genericPageSetupDialog
->Close(TRUE
);