]>
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"
47 // Clash with Windows header files
52 // ---------------------------------------------------------------------------
54 // ---------------------------------------------------------------------------
56 #if !USE_SHARED_LIBRARY
57 IMPLEMENT_DYNAMIC_CLASS(wxPrintDialog
, wxDialog
)
58 IMPLEMENT_CLASS(wxPageSetupDialog
, wxDialog
)
61 // ===========================================================================
63 // ===========================================================================
65 // ---------------------------------------------------------------------------
67 // ---------------------------------------------------------------------------
69 wxPrintDialog::wxPrintDialog()
71 m_dialogParent
= NULL
;
76 wxPrintDialog::wxPrintDialog(wxWindow
*p
, wxPrintDialogData
* data
)
81 wxPrintDialog::wxPrintDialog(wxWindow
*p
, wxPrintData
* data
)
83 wxPrintDialogData data2
;
90 bool wxPrintDialog::Create(wxWindow
*p
, wxPrintDialogData
* data
)
97 m_printDialogData
= *data
;
99 m_printDialogData
.SetOwnerWindow(p
);
104 wxPrintDialog::~wxPrintDialog()
106 if (m_destroyDC
&& m_printerDC
)
110 int wxPrintDialog::ShowModal()
112 m_printDialogData
.ConvertToNative();
114 bool ret
= (PrintDlg( (PRINTDLG
*)m_printDialogData
.GetNativeData() ) != 0);
115 if ( ret
!= FALSE
&& ((PRINTDLG
*)m_printDialogData
.GetNativeData())->hDC
)
117 wxPrinterDC
*pdc
= new wxPrinterDC((WXHDC
) ((PRINTDLG
*)m_printDialogData
.GetNativeData())->hDC
);
119 m_printDialogData
.ConvertFromNative();
128 wxDC
*wxPrintDialog::GetPrintDC()
139 // ---------------------------------------------------------------------------
141 // ---------------------------------------------------------------------------
143 wxPageSetupDialog::wxPageSetupDialog()
145 m_dialogParent
= NULL
;
148 wxPageSetupDialog::wxPageSetupDialog(wxWindow
*p
, wxPageSetupData
*data
)
153 bool wxPageSetupDialog::Create(wxWindow
*p
, wxPageSetupData
*data
)
158 m_pageSetupData
= (*data
);
160 #if defined(__WIN95__)
161 m_pageSetupData
.SetOwnerWindow(p
);
166 wxPageSetupDialog::~wxPageSetupDialog()
170 int wxPageSetupDialog::ShowModal()
173 m_pageSetupData
.ConvertToNative();
174 if (PageSetupDlg( (PAGESETUPDLG
*)m_pageSetupData
.GetNativeData() ))
176 m_pageSetupData
.ConvertFromNative();
182 wxGenericPageSetupDialog
*genericPageSetupDialog
= new wxGenericPageSetupDialog(GetParent(), & m_pageSetupData
);
183 int ret
= genericPageSetupDialog
->ShowModal();
184 m_pageSetupData
= genericPageSetupDialog
->GetPageSetupData();
185 genericPageSetupDialog
->Close(TRUE
);