]>
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 #if !USE_SHARED_LIBRARY
54 IMPLEMENT_DYNAMIC_CLASS(wxPrintDialog
, wxDialog
)
55 IMPLEMENT_CLASS(wxPageSetupDialog
, wxDialog
)
58 // ===========================================================================
60 // ===========================================================================
62 // ---------------------------------------------------------------------------
64 // ---------------------------------------------------------------------------
66 wxPrintDialog::wxPrintDialog()
68 m_dialogParent
= NULL
;
73 wxPrintDialog::wxPrintDialog(wxWindow
*p
, wxPrintDialogData
* data
)
78 wxPrintDialog::wxPrintDialog(wxWindow
*p
, wxPrintData
* data
)
80 wxPrintDialogData data2
;
87 bool wxPrintDialog::Create(wxWindow
*p
, wxPrintDialogData
* data
)
94 m_printDialogData
= *data
;
96 m_printDialogData
.SetOwnerWindow(p
);
101 wxPrintDialog::~wxPrintDialog()
103 if (m_destroyDC
&& m_printerDC
)
107 int wxPrintDialog::ShowModal()
109 m_printDialogData
.ConvertToNative();
111 bool ret
= (PrintDlg( (PRINTDLG
*)m_printDialogData
.GetNativeData() ) != 0);
112 if ( ret
!= FALSE
&& ((PRINTDLG
*)m_printDialogData
.GetNativeData())->hDC
)
114 wxPrinterDC
*pdc
= new wxPrinterDC((WXHDC
) ((PRINTDLG
*)m_printDialogData
.GetNativeData())->hDC
);
116 m_printDialogData
.ConvertFromNative();
125 wxDC
*wxPrintDialog::GetPrintDC()
136 // ---------------------------------------------------------------------------
138 // ---------------------------------------------------------------------------
140 wxPageSetupDialog::wxPageSetupDialog()
142 m_dialogParent
= NULL
;
145 wxPageSetupDialog::wxPageSetupDialog(wxWindow
*p
, wxPageSetupData
*data
)
150 bool wxPageSetupDialog::Create(wxWindow
*p
, wxPageSetupData
*data
)
155 m_pageSetupData
= (*data
);
157 #if defined(__WIN95__)
158 m_pageSetupData
.SetOwnerWindow(p
);
163 wxPageSetupDialog::~wxPageSetupDialog()
167 int wxPageSetupDialog::ShowModal()
170 m_pageSetupData
.ConvertToNative();
171 if (PageSetupDlg( (PAGESETUPDLG
*)m_pageSetupData
.GetNativeData() ))
173 m_pageSetupData
.ConvertFromNative();
179 wxGenericPageSetupDialog
*genericPageSetupDialog
= new wxGenericPageSetupDialog(GetParent(), & m_pageSetupData
);
180 int ret
= genericPageSetupDialog
->ShowModal();
181 m_pageSetupData
= genericPageSetupDialog
->GetPageSetupData();
182 genericPageSetupDialog
->Close(TRUE
);