/////////////////////////////////////////////////////////////////////////////
// Name: wx/dc.h
// Purpose: wxDC class
-// Author: Vadim Zeitlin
+// Author: Vadim Zeitlin
// Modified by:
// Created: 05/25/99
// RCS-ID: $Id$
// ---------------------------------------------------------
// wxPrinterDC Impl API
- virtual wxRect GetPaperRect()
+ virtual wxRect GetPaperRect() const
{ int w = 0; int h = 0; DoGetSize( &w, &h ); return wxRect(0,0,w,h); }
- virtual int GetResolution()
+ virtual int GetResolution() const
{ return -1; }
private:
wxSize GetPPI() const
{ return m_pimpl->GetPPI(); }
- virtual int GetResolution()
+ virtual int GetResolution() const
{ return m_pimpl->GetResolution(); }
// Right-To-Left (RTL) modes
wxPrinterDC();
wxPrinterDC(const wxPrintData& data);
- wxRect GetPaperRect();
- int GetResolution();
+ wxRect GetPaperRect() const;
+ int GetResolution() const;
protected:
wxPrinterDC(wxDCImpl *impl) : wxDC(impl) { }
// Overrridden for wxPrinterDC Impl
- virtual int GetResolution();
- virtual wxRect GetPaperRect();
+ virtual int GetResolution() const;
+ virtual wxRect GetPaperRect() const;
protected:
bool DoFloodFill(wxCoord x1, wxCoord y1, const wxColour &col, int style = wxFLOOD_SURFACE);
void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
#if wxUSE_SPLINES
void DoDrawSpline(const wxPointList *points);
-#endif
+#endif
bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
wxDC *source, wxCoord xsrc, wxCoord ysrc, int rop = wxCOPY, bool useMask = false,
wxCoord xsrcMask = wxDefaultCoord, wxCoord ysrcMask = wxDefaultCoord);
wxPrintData& GetPrintData() { return m_printData; }
// overriden for wxPrinterDC Impl
- virtual wxRect GetPaperRect();
- virtual int GetResolution();
+ virtual wxRect GetPaperRect() const;
+ virtual int GetResolution() const;
private:
wxPrintData m_printData;
unsigned char m_currentRed;
unsigned char m_currentGreen;
unsigned char m_currentBlue;
-
+
double m_pageHeight;
GnomePrintContext *m_gpc;
void SetBackgroundMode(int mode);
void SetPalette(const wxPalette& WXUNUSED(palette)) { }
void SetResolution(int ppi);
-
+
// overriden for wxPrinterDC Impl
- virtual int GetResolution();
- virtual wxRect GetPaperRect();
+ virtual int GetResolution() const;
+ virtual wxRect GetPaperRect() const;
protected:
bool DoFloodFill(wxCoord x1, wxCoord y1, const wxColour &col, int style=wxFLOOD_SURFACE );
int orientation = wxPORTRAIT);
virtual ~wxPrinterDC();
- wxRect GetPaperRect();
+ wxRect GetPaperRect() const;
DECLARE_CLASS(wxPrinterDCImpl)
};
virtual void StartPage();
virtual void EndPage();
- virtual wxRect GetPaperRect();
+ virtual wxRect GetPaperRect() const;
protected:
virtual void DoDrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y,
virtual void StartPage(void);
virtual void EndPage(void);
- virtual wxRect GetPaperRect();
+ virtual wxRect GetPaperRect() const;
protected:
virtual void DoDrawBitmap( const wxBitmap& rBmp
virtual void StartPage(void) ;
virtual void EndPage(void) ;
- wxRect GetPaperRect();
+ wxRect GetPaperRect() const;
wxPrintData& GetPrintData() { return m_printData; }
virtual wxSize GetPPI() const;
-
+
protected:
virtual void DoGetSize( int *width, int *height ) const;
-
+
wxPrintData m_printData ;
wxNativePrinterDC* m_nativePrinterDC ;
-
+
private:
DECLARE_CLASS(wxPrinterDC)
#endif // wxUSE_PRINTING_ARCHITECTURE
virtual void StartPage();
virtual void EndPage();
- wxRect GetPaperRect();
+ wxRect GetPaperRect() const;
protected:
virtual void DoDrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y,
{
}
-wxRect wxPrinterDC::GetPaperRect()
+wxRect wxPrinterDC::GetPaperRect() const
{
return GetImpl()->GetPaperRect();
}
-int wxPrinterDC::GetResolution()
+int wxPrinterDC::GetResolution() const
{
return GetImpl()->GetResolution();
}
return m_ok;
}
-wxRect wxPostScriptDCImpl::GetPaperRect()
+wxRect wxPostScriptDCImpl::GetPaperRect() const
{
int w = 0;
int h = 0;
return wxRect(0,0,w,h);
}
-int wxPostScriptDCImpl::GetResolution()
+int wxPostScriptDCImpl::GetResolution() const
{
return DPI;
}
// overridden for wxPrinterDC Impl
-int wxGnomePrinterDCImpl::GetResolution()
+int wxGnomePrinterDCImpl::GetResolution() const
{
return DPI;
}
-wxRect wxGnomePrinterDCImpl::GetPaperRect()
+wxRect wxGnomePrinterDCImpl::GetPaperRect() const
{
// GNOME print doesn't support printer margins
int w = 0;
}
m_printDialogData = dialog.GetPrintDialogData();
-
+
return new wxPrinterDC( m_printDialogData.GetPrintData() );
}
#if wxCAIRO_SCALE
m_PS2DEV = 1.0;
m_DEV2PS = 1.0;
-
+
cairo_scale( m_cairo, 72.0 / (double)m_resolution, 72.0 / (double)m_resolution );
#else
m_PS2DEV = (double)m_resolution / 72.0;
void wxGtkPrinterDCImpl::Clear()
{
// Clear does nothing for printing, but keep the code
-// for later reuse
+// for later reuse
/*
cairo_save(m_cairo);
cairo_set_operator (m_cairo, CAIRO_OPERATOR_SOURCE);
m_pen = pen;
double width;
-
+
if (m_pen.GetWidth() <= 0)
width = 0.1;
else
// overriden for wxPrinterDC Impl
-wxRect wxGtkPrinterDCImpl::GetPaperRect()
+wxRect wxGtkPrinterDCImpl::GetPaperRect() const
{
// Does GtkPrint support printer margins?
int w = 0;
return wxRect( 0,0,w,h );
}
-int wxGtkPrinterDCImpl::GetResolution()
+int wxGtkPrinterDCImpl::GetResolution() const
{
return m_resolution;
}
wxSize sizeDevUnits(paper->GetSizeDeviceUnits());
sizeDevUnits.x = wxRound((double)sizeDevUnits.x * (double)m_resolution / 72.0);
sizeDevUnits.y = wxRound((double)sizeDevUnits.y * (double)m_resolution / 72.0);
-
+
wxSize sizeTenthsMM(paper->GetSize());
wxSize sizeMM(sizeTenthsMM.x / 10, sizeTenthsMM.y / 10);
}
-wxRect wxPrinterDCImpl::GetPaperRect()
+wxRect wxPrinterDCImpl::GetPaperRect() const
{
if (!IsOk()) return wxRect(0, 0, 0, 0);
// ::EndPage((HDC) m_hDC);
} // end of wxPrinterDC::EndPage
-wxRect wxPrinterDCImpl::GetPaperRect()
+wxRect wxPrinterDCImpl::GetPaperRect() const
{
// Use page rect if we can't get paper rect.
wxCoord w, h;
PMResolution res;
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
if ( PMPrinterGetOutputResolution != NULL )
{
PMPrinter printer;
else
#endif
{
-#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5
+#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5
m_err = PMGetResolution((PMPageFormat) (native->m_macPageFormat), &res);
#endif
}
-
+
m_ppi = wxSize(int(res.hRes), int(res.vRes));
}
m_err = PMSessionBeginCGDocumentNoDialog(native->m_macPrintSession,
native->m_macPrintSettings,
- native->m_macPageFormat);
+ native->m_macPageFormat);
if ( m_err != noErr )
return false;
m_maxY = wxCoord(rPage.bottom - rPage.top);
PMResolution res;
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
if ( PMPrinterGetOutputResolution != NULL )
{
PMPrinter printer;
else
#endif
{
-#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5
+#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5
m_err = PMGetResolution((PMPageFormat) (native->m_macPageFormat), &res);
#endif
}
*h = m_maxY ;
}
-wxSize wxMacCarbonPrinterDC::GetPPI() const
+wxSize wxMacCarbonPrinterDC::GetPPI() const
{
return m_ppi ;
};
{
wxSize sz = GetPPI();
m_mm_to_pix_x = mm2inches * sz.x;
- m_mm_to_pix_y = mm2inches * sz.y;
+ m_mm_to_pix_y = mm2inches * sz.y;
}
// we need at least a measuring context because people start measuring before a page
// gets printed at all
}
}
-wxRect wxPrinterDCImpl::GetPaperRect()
+wxRect wxPrinterDCImpl::GetPaperRect() const
{
wxCoord w, h;
GetOwner()->GetSize(&w, &h);
{
}
-wxRect wxPrinterDC::GetPaperRect()
+wxRect wxPrinterDC::GetPaperRect() const
{
// Use page rect if we can't get paper rect.
wxCoord w, h;