]>
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
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 // ===========================================================================
14 // ===========================================================================
16 // ---------------------------------------------------------------------------
18 // ---------------------------------------------------------------------------
20 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
21 #pragma implementation "printdlg.h"
24 // For compilers that support precompilation, includes "wx.h".
25 #include "wx/wxprec.h"
31 // Don't use the Windows print dialog if we're in wxUniv mode and using
32 // the PostScript architecture
33 #if wxUSE_PRINTING_ARCHITECTURE && (!defined(__WXUNIVERSAL__) || !wxUSE_POSTSCRIPT_ARCHITECTURE_IN_MSW)
39 #include "wx/printdlg.h"
40 #include "wx/dcprint.h"
42 // Have to emulate page setup dialog for Win16
43 #if !defined(__WIN95__)
44 #include "wx/generic/prntdlgg.h"
49 #include "wx/msw/private.h"
57 // ---------------------------------------------------------------------------
59 // ---------------------------------------------------------------------------
61 IMPLEMENT_DYNAMIC_CLASS(wxPrintDialog
, wxDialog
)
62 IMPLEMENT_CLASS(wxPageSetupDialog
, wxDialog
)
64 // ===========================================================================
66 // ===========================================================================
68 // ---------------------------------------------------------------------------
70 // ---------------------------------------------------------------------------
72 wxPrintDialog::wxPrintDialog()
74 m_dialogParent
= NULL
;
79 wxPrintDialog::wxPrintDialog(wxWindow
*p
, wxPrintDialogData
* data
)
84 wxPrintDialog::wxPrintDialog(wxWindow
*p
, wxPrintData
* data
)
86 wxPrintDialogData data2
;
93 bool wxPrintDialog::Create(wxWindow
*p
, wxPrintDialogData
* data
)
100 m_printDialogData
= *data
;
102 m_printDialogData
.SetOwnerWindow(p
);
107 wxPrintDialog::~wxPrintDialog()
109 if (m_destroyDC
&& m_printerDC
)
113 int wxPrintDialog::ShowModal()
115 m_printDialogData
.ConvertToNative();
117 PRINTDLG
* p
= (PRINTDLG
*)m_printDialogData
.GetNativeData() ;
119 p
->hwndOwner
= (HWND
) m_dialogParent
->GetHWND();
120 else if (wxTheApp
->GetTopWindow())
121 p
->hwndOwner
= (HWND
) wxTheApp
->GetTopWindow()->GetHWND();
125 bool ret
= (PrintDlg( p
) != 0);
129 if ( ret
!= FALSE
&& ((PRINTDLG
*)m_printDialogData
.GetNativeData())->hDC
)
131 wxPrinterDC
*pdc
= new wxPrinterDC((WXHDC
) ((PRINTDLG
*)m_printDialogData
.GetNativeData())->hDC
);
133 m_printDialogData
.ConvertFromNative();
142 wxDC
*wxPrintDialog::GetPrintDC()
153 // ---------------------------------------------------------------------------
155 // ---------------------------------------------------------------------------
157 wxPageSetupDialog::wxPageSetupDialog()
159 m_dialogParent
= NULL
;
162 wxPageSetupDialog::wxPageSetupDialog(wxWindow
*p
, wxPageSetupData
*data
)
167 bool wxPageSetupDialog::Create(wxWindow
*p
, wxPageSetupData
*data
)
172 m_pageSetupData
= (*data
);
174 #if defined(__WIN95__)
175 m_pageSetupData
.SetOwnerWindow(p
);
180 wxPageSetupDialog::~wxPageSetupDialog()
184 int wxPageSetupDialog::ShowModal()
187 m_pageSetupData
.ConvertToNative();
188 PAGESETUPDLG
*p
= (PAGESETUPDLG
*)m_pageSetupData
.GetNativeData();
190 p
->hwndOwner
= (HWND
) m_dialogParent
->GetHWND();
191 else if (wxTheApp
->GetTopWindow())
192 p
->hwndOwner
= (HWND
) wxTheApp
->GetTopWindow()->GetHWND();
195 BOOL retVal
= PageSetupDlg( p
) ;
199 m_pageSetupData
.ConvertFromNative();
205 wxGenericPageSetupDialog
*genericPageSetupDialog
= new wxGenericPageSetupDialog(GetParent(), & m_pageSetupData
);
206 int ret
= genericPageSetupDialog
->ShowModal();
207 m_pageSetupData
= genericPageSetupDialog
->GetPageSetupData();
208 genericPageSetupDialog
->Close(TRUE
);
214 // wxUSE_PRINTING_ARCHITECTURE