]>
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"
44 #include "wx/msw/private.h"
52 // ---------------------------------------------------------------------------
54 // ---------------------------------------------------------------------------
56 IMPLEMENT_DYNAMIC_CLASS(wxPrintDialog
, wxDialog
)
57 IMPLEMENT_CLASS(wxPageSetupDialog
, wxDialog
)
59 // ===========================================================================
61 // ===========================================================================
63 // ---------------------------------------------------------------------------
65 // ---------------------------------------------------------------------------
67 wxPrintDialog::wxPrintDialog()
69 m_dialogParent
= NULL
;
74 wxPrintDialog::wxPrintDialog(wxWindow
*p
, wxPrintDialogData
* data
)
79 wxPrintDialog::wxPrintDialog(wxWindow
*p
, wxPrintData
* data
)
81 wxPrintDialogData data2
;
88 bool wxPrintDialog::Create(wxWindow
*p
, wxPrintDialogData
* data
)
95 m_printDialogData
= *data
;
97 m_printDialogData
.SetOwnerWindow(p
);
102 wxPrintDialog::~wxPrintDialog()
104 if (m_destroyDC
&& m_printerDC
)
108 int wxPrintDialog::ShowModal()
110 m_printDialogData
.ConvertToNative();
112 PRINTDLG
* p
= (PRINTDLG
*)m_printDialogData
.GetNativeData() ;
114 p
->hwndOwner
= (HWND
) m_dialogParent
->GetHWND();
115 else if (wxTheApp
->GetTopWindow())
116 p
->hwndOwner
= (HWND
) wxTheApp
->GetTopWindow()->GetHWND();
120 bool ret
= (PrintDlg( p
) != 0);
124 if ( ret
!= FALSE
&& ((PRINTDLG
*)m_printDialogData
.GetNativeData())->hDC
)
126 wxPrinterDC
*pdc
= new wxPrinterDC((WXHDC
) ((PRINTDLG
*)m_printDialogData
.GetNativeData())->hDC
);
128 m_printDialogData
.ConvertFromNative();
137 wxDC
*wxPrintDialog::GetPrintDC()
148 // ---------------------------------------------------------------------------
150 // ---------------------------------------------------------------------------
152 wxPageSetupDialog::wxPageSetupDialog()
154 m_dialogParent
= NULL
;
157 wxPageSetupDialog::wxPageSetupDialog(wxWindow
*p
, wxPageSetupData
*data
)
162 bool wxPageSetupDialog::Create(wxWindow
*p
, wxPageSetupData
*data
)
167 m_pageSetupData
= (*data
);
169 #if defined(__WIN95__)
170 m_pageSetupData
.SetOwnerWindow(p
);
175 wxPageSetupDialog::~wxPageSetupDialog()
179 int wxPageSetupDialog::ShowModal()
182 m_pageSetupData
.ConvertToNative();
183 PAGESETUPDLG
*p
= (PAGESETUPDLG
*)m_pageSetupData
.GetNativeData();
185 p
->hwndOwner
= (HWND
) m_dialogParent
->GetHWND();
186 else if (wxTheApp
->GetTopWindow())
187 p
->hwndOwner
= (HWND
) wxTheApp
->GetTopWindow()->GetHWND();
190 BOOL retVal
= PageSetupDlg( p
) ;
194 m_pageSetupData
.ConvertFromNative();
200 wxGenericPageSetupDialog
*genericPageSetupDialog
= new wxGenericPageSetupDialog(GetParent(), & m_pageSetupData
);
201 int ret
= genericPageSetupDialog
->ShowModal();
202 m_pageSetupData
= genericPageSetupDialog
->GetPageSetupData();
203 genericPageSetupDialog
->Close(TRUE
);
209 // wxUSE_PRINTING_ARCHITECTURE