]>
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/cmndata.h"
40 #include "wx/printdlg.h"
41 #include "wx/dcprint.h"
45 #include "wx/msw/private.h"
53 // ---------------------------------------------------------------------------
55 // ---------------------------------------------------------------------------
57 IMPLEMENT_CLASS(wxWindowsPrintDialog
, wxPrintDialogBase
)
59 wxWindowsPrintDialog::wxWindowsPrintDialog(wxWindow
*p
, wxPrintDialogData
* data
)
64 wxWindowsPrintDialog::wxWindowsPrintDialog(wxWindow
*p
, wxPrintData
* data
)
66 wxPrintDialogData data2
;
73 bool wxWindowsPrintDialog::Create(wxWindow
*p
, wxPrintDialogData
* data
)
80 m_printDialogData
= *data
;
82 m_printDialogData
.SetOwnerWindow(p
);
87 wxWindowsPrintDialog::~wxWindowsPrintDialog()
89 if (m_destroyDC
&& m_printerDC
)
93 int wxWindowsPrintDialog::ShowModal()
95 m_printDialogData
.ConvertToNative();
97 PRINTDLG
* p
= (PRINTDLG
*)m_printDialogData
.GetNativeData() ;
99 p
->hwndOwner
= (HWND
) m_dialogParent
->GetHWND();
100 else if (wxTheApp
->GetTopWindow())
101 p
->hwndOwner
= (HWND
) wxTheApp
->GetTopWindow()->GetHWND();
105 bool ret
= (PrintDlg( p
) != 0);
109 if ( ret
!= false && ((PRINTDLG
*)m_printDialogData
.GetNativeData())->hDC
)
111 wxPrinterDC
*pdc
= new wxPrinterDC((WXHDC
) ((PRINTDLG
*)m_printDialogData
.GetNativeData())->hDC
);
113 m_printDialogData
.ConvertFromNative();
122 wxDC
*wxWindowsPrintDialog::GetPrintDC()
133 // ---------------------------------------------------------------------------
135 // ---------------------------------------------------------------------------
137 IMPLEMENT_CLASS(wxPageSetupDialog
, wxDialog
)
139 wxPageSetupDialog::wxPageSetupDialog()
141 m_dialogParent
= NULL
;
144 wxPageSetupDialog::wxPageSetupDialog(wxWindow
*p
, wxPageSetupData
*data
)
149 bool wxPageSetupDialog::Create(wxWindow
*p
, wxPageSetupData
*data
)
154 m_pageSetupData
= (*data
);
156 #if defined(__WIN95__)
157 m_pageSetupData
.SetOwnerWindow(p
);
162 wxPageSetupDialog::~wxPageSetupDialog()
166 int wxPageSetupDialog::ShowModal()
169 m_pageSetupData
.ConvertToNative();
170 PAGESETUPDLG
*p
= (PAGESETUPDLG
*)m_pageSetupData
.GetNativeData();
172 p
->hwndOwner
= (HWND
) m_dialogParent
->GetHWND();
173 else if (wxTheApp
->GetTopWindow())
174 p
->hwndOwner
= (HWND
) wxTheApp
->GetTopWindow()->GetHWND();
177 BOOL retVal
= PageSetupDlg( p
) ;
181 m_pageSetupData
.ConvertFromNative();
187 wxGenericPageSetupDialog
*genericPageSetupDialog
= new wxGenericPageSetupDialog(GetParent(), & m_pageSetupData
);
188 int ret
= genericPageSetupDialog
->ShowModal();
189 m_pageSetupData
= genericPageSetupDialog
->GetPageSetupData();
190 genericPageSetupDialog
->Close(true);
196 // wxUSE_PRINTING_ARCHITECTURE