X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/62f864c32c53356b7228591c85b14abc491c46f0..4fe0156b18e2330be391b804da341e546164b85f:/src/mac/classic/dcprint.cpp diff --git a/src/mac/classic/dcprint.cpp b/src/mac/classic/dcprint.cpp index f141bf4085..c67228b4ff 100644 --- a/src/mac/classic/dcprint.cpp +++ b/src/mac/classic/dcprint.cpp @@ -1,31 +1,28 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: dcprint.cpp +// Name: src/mac/classic/dcprint.cpp // Purpose: wxPrinterDC class // Author: Julian Smart // Modified by: // Created: 01/02/97 // RCS-ID: $Id$ // Copyright: (c) Julian Smart -// Licence: wxWindows licence +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#ifdef __GNUG__ -#pragma implementation "dcprint.h" -#endif - // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" #ifdef __BORLANDC__ -#pragma hdrstop + #pragma hdrstop #endif +#include "wx/dcprint.h" + #ifndef WX_PRECOMP + #include "wx/msgdlg.h" + #include "wx/math.h" #endif -#include "wx/dcprint.h" -#include "wx/msgdlg.h" -#include "wx/math.h" #include "wx/mac/uma.h" #include "wx/mac/private/print.h" @@ -55,7 +52,7 @@ class wxMacCarbonPrinterDC : public wxNativePrinterDC { public : wxMacCarbonPrinterDC( wxPrintData* data ) ; - ~wxMacCarbonPrinterDC() ; + virtual ~wxMacCarbonPrinterDC() ; virtual bool StartDoc( wxPrinterDC* dc , const wxString& message ) ; virtual void EndDoc( wxPrinterDC* dc ) ; virtual void StartPage( wxPrinterDC* dc ) ; @@ -188,7 +185,7 @@ class wxMacClassicPrinterDC : public wxNativePrinterDC { public : wxMacClassicPrinterDC( wxPrintData* data ) ; - ~wxMacClassicPrinterDC() ; + virtual ~wxMacClassicPrinterDC() ; virtual bool StartDoc( wxPrinterDC* dc , const wxString& message ) ; virtual void EndDoc( wxPrinterDC* dc ) ; virtual void StartPage( wxPrinterDC* dc ) ; @@ -304,7 +301,7 @@ void wxMacClassicPrinterDC::EndPage( wxPrinterDC* dc ) wxPrinterDC::wxPrinterDC(const wxPrintData& printdata) { - m_ok = FALSE ; + m_ok = false ; m_printData = printdata ; m_printData.ConvertToNative() ; m_nativePrinterDC = wxNativePrinterDC::Create( &m_printData ) ; @@ -401,6 +398,18 @@ void wxPrinterDC::EndPage(void) m_ok = m_nativePrinterDC->Ok() ; } +wxRect wxPrinterDC::GetPaperRect() +{ + wxMacCarbonPrintData *native = (wxMacCarbonPrintData*) m_printData.GetNativeData() ; + OSStatus err = noErr ; + PMRect rPaper; + err = PMGetAdjustedPaperRect(native->m_macPageFormat, &rPaper); + if ( err != noErr ) + return pageRect; + return wxRect(wxCoord(rPaper.left), wxCoord(rPaper.top), + wxCoord(rPaper.right - rPaper.left), wxCoord(rPaper.bottom - rPaper.top)); +} + void wxPrinterDC::DoGetSize(int *width, int *height) const { wxCHECK_RET( m_ok , _T("GetSize() doesn't work without a valid wxPrinterDC") ); @@ -410,5 +419,3 @@ void wxPrinterDC::DoGetSize(int *width, int *height) const if ( height ) * height = m_nativePrinterDC->GetMaxY() ; } - -