X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/7bcb11d30764df47144189e164f53d8171ed4a63..2e1a688e3e9c6c265620e4f05d579077367e9fdb:/src/msw/printdlg.cpp diff --git a/src/msw/printdlg.cpp b/src/msw/printdlg.cpp index 2d0eb79e6c..c9e98a3dbf 100644 --- a/src/msw/printdlg.cpp +++ b/src/msw/printdlg.cpp @@ -6,21 +6,26 @@ // Created: 04/01/98 // RCS-ID: $Id$ // Copyright: (c) Julian Smart and Markus Holzem -// Licence: wxWindows license +// Licence: wxWindows license ///////////////////////////////////////////////////////////////////////////// +// =========================================================================== +// declarations +// =========================================================================== + +// --------------------------------------------------------------------------- +// headers +// --------------------------------------------------------------------------- + #ifdef __GNUG__ -#pragma implementation "printdlg.h" + #pragma implementation "printdlg.h" #endif // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" #ifdef __BORLANDC__ -#pragma hdrstop -#endif - -#ifndef WX_PRECOMP + #pragma hdrstop #endif #include "wx/printdlg.h" @@ -28,41 +33,57 @@ // Have to emulate page setup dialog for Win16 #if !defined(__WIN95__) -#include "wx/generic/prntdlgg.h" + #include "wx/generic/prntdlgg.h" #endif #include -#include + +#include "wx/msw/private.h" + #include #ifndef __WIN32__ -#include + #include #endif -// Clash with Windows header files -#ifdef StartDoc -#undef StartDoc -#endif +// --------------------------------------------------------------------------- +// wxWin macros +// --------------------------------------------------------------------------- #if !USE_SHARED_LIBRARY -IMPLEMENT_DYNAMIC_CLASS(wxPrintDialog, wxDialog) -IMPLEMENT_CLASS(wxPageSetupDialog, wxDialog) + IMPLEMENT_DYNAMIC_CLASS(wxPrintDialog, wxDialog) + IMPLEMENT_CLASS(wxPageSetupDialog, wxDialog) #endif -wxPrintDialog::wxPrintDialog(void): -wxDialog() +// =========================================================================== +// implementation +// =========================================================================== + +// --------------------------------------------------------------------------- +// wxPrintDialog +// --------------------------------------------------------------------------- + +wxPrintDialog::wxPrintDialog() { m_dialogParent = NULL; m_printerDC = NULL; m_destroyDC = TRUE; } -wxPrintDialog::wxPrintDialog(wxWindow *p, wxPrintDialogData* data): -wxDialog() +wxPrintDialog::wxPrintDialog(wxWindow *p, wxPrintDialogData* data) { Create(p, data); } +wxPrintDialog::wxPrintDialog(wxWindow *p, wxPrintData* data) +{ + wxPrintDialogData data2; + if ( data ) + data2 = *data; + + Create(p, &data2); +} + bool wxPrintDialog::Create(wxWindow *p, wxPrintDialogData* data) { m_dialogParent = p; @@ -71,22 +92,22 @@ bool wxPrintDialog::Create(wxWindow *p, wxPrintDialogData* data) if ( data ) m_printDialogData = *data; - + m_printDialogData.SetOwnerWindow(p); return TRUE; } -wxPrintDialog::~wxPrintDialog(void) +wxPrintDialog::~wxPrintDialog() { if (m_destroyDC && m_printerDC) delete m_printerDC; } -int wxPrintDialog::ShowModal(void) +int wxPrintDialog::ShowModal() { m_printDialogData.ConvertToNative(); - + bool ret = (PrintDlg( (PRINTDLG *)m_printDialogData.GetNativeData() ) != 0); if ( ret != FALSE && ((PRINTDLG *)m_printDialogData.GetNativeData())->hDC) { @@ -97,17 +118,11 @@ int wxPrintDialog::ShowModal(void) } else { - /* - char buf[256]; - DWORD exError = CommDlgExtendedError(); - sprintf(buf, "ret = %d, ex error = %d", (int) ret, (int) exError); - wxMessageBox(buf); - */ return wxID_CANCEL; } } -wxDC *wxPrintDialog::GetPrintDC(void) +wxDC *wxPrintDialog::GetPrintDC() { if (m_printerDC) { @@ -118,18 +133,16 @@ wxDC *wxPrintDialog::GetPrintDC(void) return (wxDC*) NULL; } -/* -* wxPageSetupDialog -*/ +// --------------------------------------------------------------------------- +// wxPageSetupDialog +// --------------------------------------------------------------------------- -wxPageSetupDialog::wxPageSetupDialog(void): -wxDialog() +wxPageSetupDialog::wxPageSetupDialog() { m_dialogParent = NULL; } -wxPageSetupDialog::wxPageSetupDialog(wxWindow *p, wxPageSetupData *data): -wxDialog() +wxPageSetupDialog::wxPageSetupDialog(wxWindow *p, wxPageSetupData *data) { Create(p, data); } @@ -137,21 +150,21 @@ wxDialog() bool wxPageSetupDialog::Create(wxWindow *p, wxPageSetupData *data) { m_dialogParent = p; - + if (data) m_pageSetupData = (*data); - + #if defined(__WIN95__) m_pageSetupData.SetOwnerWindow(p); #endif return TRUE; } -wxPageSetupDialog::~wxPageSetupDialog(void) +wxPageSetupDialog::~wxPageSetupDialog() { } -int wxPageSetupDialog::ShowModal(void) +int wxPageSetupDialog::ShowModal() { #ifdef __WIN95__ m_pageSetupData.ConvertToNative();