]>
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 #if wxUSE_PRINTING_ARCHITECTURE
37 #include "wx/printdlg.h"
38 #include "wx/dcprint.h"
40 // Have to emulate page setup dialog for Win16
41 #if !defined(__WIN95__)
42 #include "wx/generic/prntdlgg.h"
47 #include "wx/msw/private.h"
55 // ---------------------------------------------------------------------------
57 // ---------------------------------------------------------------------------
59 IMPLEMENT_DYNAMIC_CLASS(wxPrintDialog
, wxDialog
)
60 IMPLEMENT_CLASS(wxPageSetupDialog
, wxDialog
)
62 // ===========================================================================
64 // ===========================================================================
66 // ---------------------------------------------------------------------------
68 // ---------------------------------------------------------------------------
70 wxPrintDialog::wxPrintDialog()
72 m_dialogParent
= NULL
;
77 wxPrintDialog::wxPrintDialog(wxWindow
*p
, wxPrintDialogData
* data
)
82 wxPrintDialog::wxPrintDialog(wxWindow
*p
, wxPrintData
* data
)
84 wxPrintDialogData data2
;
91 bool wxPrintDialog::Create(wxWindow
*p
, wxPrintDialogData
* data
)
98 m_printDialogData
= *data
;
100 m_printDialogData
.SetOwnerWindow(p
);
105 wxPrintDialog::~wxPrintDialog()
107 if (m_destroyDC
&& m_printerDC
)
111 int wxPrintDialog::ShowModal()
113 m_printDialogData
.ConvertToNative();
115 PRINTDLG
* p
= (PRINTDLG
*)m_printDialogData
.GetNativeData() ;
117 p
->hwndOwner
= (HWND
) m_dialogParent
->GetHWND();
118 else if (wxTheApp
->GetTopWindow())
119 p
->hwndOwner
= (HWND
) wxTheApp
->GetTopWindow()->GetHWND();
123 bool ret
= (PrintDlg( p
) != 0);
127 if ( ret
!= FALSE
&& ((PRINTDLG
*)m_printDialogData
.GetNativeData())->hDC
)
129 wxPrinterDC
*pdc
= new wxPrinterDC((WXHDC
) ((PRINTDLG
*)m_printDialogData
.GetNativeData())->hDC
);
131 m_printDialogData
.ConvertFromNative();
140 wxDC
*wxPrintDialog::GetPrintDC()
151 // ---------------------------------------------------------------------------
153 // ---------------------------------------------------------------------------
155 wxPageSetupDialog::wxPageSetupDialog()
157 m_dialogParent
= NULL
;
160 wxPageSetupDialog::wxPageSetupDialog(wxWindow
*p
, wxPageSetupData
*data
)
165 bool wxPageSetupDialog::Create(wxWindow
*p
, wxPageSetupData
*data
)
170 m_pageSetupData
= (*data
);
172 #if defined(__WIN95__)
173 m_pageSetupData
.SetOwnerWindow(p
);
178 wxPageSetupDialog::~wxPageSetupDialog()
182 int wxPageSetupDialog::ShowModal()
185 m_pageSetupData
.ConvertToNative();
186 PAGESETUPDLG
*p
= (PAGESETUPDLG
*)m_pageSetupData
.GetNativeData();
188 p
->hwndOwner
= (HWND
) m_dialogParent
->GetHWND();
189 else if (wxTheApp
->GetTopWindow())
190 p
->hwndOwner
= (HWND
) wxTheApp
->GetTopWindow()->GetHWND();
193 BOOL retVal
= PageSetupDlg( p
) ;
197 m_pageSetupData
.ConvertFromNative();
203 wxGenericPageSetupDialog
*genericPageSetupDialog
= new wxGenericPageSetupDialog(GetParent(), & m_pageSetupData
);
204 int ret
= genericPageSetupDialog
->ShowModal();
205 m_pageSetupData
= genericPageSetupDialog
->GetPageSetupData();
206 genericPageSetupDialog
->Close(TRUE
);
212 // wxUSE_PRINTING_ARCHITECTURE