]>
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 /////////////////////////////////////////////////////////////////////////////
12 // ===========================================================================
14 // ===========================================================================
16 // ---------------------------------------------------------------------------
18 // ---------------------------------------------------------------------------
21 #pragma implementation "printdlg.h"
24 // For compilers that support precompilation, includes "wx.h".
25 #include "wx/wxprec.h"
31 #include "wx/printdlg.h"
32 #include "wx/dcprint.h"
34 // Have to emulate page setup dialog for Win16
35 #if !defined(__WIN95__)
36 #include "wx/generic/prntdlgg.h"
41 #include "wx/msw/private.h"
49 // ---------------------------------------------------------------------------
51 // ---------------------------------------------------------------------------
53 IMPLEMENT_DYNAMIC_CLASS(wxPrintDialog
, wxDialog
)
54 IMPLEMENT_CLASS(wxPageSetupDialog
, wxDialog
)
56 // ===========================================================================
58 // ===========================================================================
60 // ---------------------------------------------------------------------------
62 // ---------------------------------------------------------------------------
64 wxPrintDialog::wxPrintDialog()
66 m_dialogParent
= NULL
;
71 wxPrintDialog::wxPrintDialog(wxWindow
*p
, wxPrintDialogData
* data
)
76 wxPrintDialog::wxPrintDialog(wxWindow
*p
, wxPrintData
* data
)
78 wxPrintDialogData data2
;
85 bool wxPrintDialog::Create(wxWindow
*p
, wxPrintDialogData
* data
)
92 m_printDialogData
= *data
;
94 m_printDialogData
.SetOwnerWindow(p
);
99 wxPrintDialog::~wxPrintDialog()
101 if (m_destroyDC
&& m_printerDC
)
105 int wxPrintDialog::ShowModal()
107 m_printDialogData
.ConvertToNative();
109 bool ret
= (PrintDlg( (PRINTDLG
*)m_printDialogData
.GetNativeData() ) != 0);
110 if ( ret
!= FALSE
&& ((PRINTDLG
*)m_printDialogData
.GetNativeData())->hDC
)
112 wxPrinterDC
*pdc
= new wxPrinterDC((WXHDC
) ((PRINTDLG
*)m_printDialogData
.GetNativeData())->hDC
);
114 m_printDialogData
.ConvertFromNative();
123 wxDC
*wxPrintDialog::GetPrintDC()
134 // ---------------------------------------------------------------------------
136 // ---------------------------------------------------------------------------
138 wxPageSetupDialog::wxPageSetupDialog()
140 m_dialogParent
= NULL
;
143 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()
165 int wxPageSetupDialog::ShowModal()
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
);