virtual void SetMapMode(int mode);
virtual void SetUserScale(double x, double y);
virtual void SetLogicalScale(double x, double y);
- virtual void SetLogicalOrigin(long x, long y);
- virtual void SetDeviceOrigin(long x, long y);
+ virtual void SetLogicalOrigin(wxCoord x, wxCoord y);
+ virtual void SetDeviceOrigin(wxCoord x, wxCoord y);
virtual void SetAxisOrientation(bool xLeftRight, bool yBottomUp);
protected:
- virtual void DoDrawIcon(const wxIcon& icon, long x, long y);
- virtual void DoDrawBitmap(const wxBitmap &bmp, long x, long y,
+ virtual void DoDrawIcon(const wxIcon& icon, wxCoord x, wxCoord y);
+ virtual void DoDrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y,
bool useMask = FALSE);
- virtual void DoSetClippingRegion(long x, long y,
- long width, long height);
+ virtual void DoSetClippingRegion(wxCoord x, wxCoord y,
+ wxCoord width, wxCoord height);
virtual void DoGetSize(int *width, int *height) const;
virtual void DoGetSizeMM(int* width, int* height) const;
public:
void ComputeScaleAndOrigin();
- long XDEV2LOG(long x) const
+ wxCoord XDEV2LOG(wxCoord x) const
{
- long new_x = x - m_deviceOriginX;
+ wxCoord new_x = x - m_deviceOriginX;
if (new_x > 0)
- return (long)((double)(new_x) / m_scaleX + 0.5) * m_signX + m_logicalOriginX;
+ return (wxCoord)((double)(new_x) / m_scaleX + 0.5) * m_signX + m_logicalOriginX;
else
- return (long)((double)(new_x) / m_scaleX - 0.5) * m_signX + m_logicalOriginX;
+ return (wxCoord)((double)(new_x) / m_scaleX - 0.5) * m_signX + m_logicalOriginX;
}
- long XDEV2LOGREL(long x) const
+ wxCoord XDEV2LOGREL(wxCoord x) const
{
if (x > 0)
- return (long)((double)(x) / m_scaleX + 0.5);
+ return (wxCoord)((double)(x) / m_scaleX + 0.5);
else
- return (long)((double)(x) / m_scaleX - 0.5);
+ return (wxCoord)((double)(x) / m_scaleX - 0.5);
}
- long YDEV2LOG(long y) const
+ wxCoord YDEV2LOG(wxCoord y) const
{
- long new_y = y - m_deviceOriginY;
+ wxCoord new_y = y - m_deviceOriginY;
if (new_y > 0)
- return (long)((double)(new_y) / m_scaleY + 0.5) * m_signY + m_logicalOriginY;
+ return (wxCoord)((double)(new_y) / m_scaleY + 0.5) * m_signY + m_logicalOriginY;
else
- return (long)((double)(new_y) / m_scaleY - 0.5) * m_signY + m_logicalOriginY;
+ return (wxCoord)((double)(new_y) / m_scaleY - 0.5) * m_signY + m_logicalOriginY;
}
- long YDEV2LOGREL(long y) const
+ wxCoord YDEV2LOGREL(wxCoord y) const
{
if (y > 0)
- return (long)((double)(y) / m_scaleY + 0.5);
+ return (wxCoord)((double)(y) / m_scaleY + 0.5);
else
- return (long)((double)(y) / m_scaleY - 0.5);
+ return (wxCoord)((double)(y) / m_scaleY - 0.5);
}
- long XLOG2DEV(long x) const
+ wxCoord XLOG2DEV(wxCoord x) const
{
- long new_x = x - m_logicalOriginX;
+ wxCoord new_x = x - m_logicalOriginX;
if (new_x > 0)
- return (long)((double)(new_x) * m_scaleX + 0.5) * m_signX + m_deviceOriginX;
+ return (wxCoord)((double)(new_x) * m_scaleX + 0.5) * m_signX + m_deviceOriginX;
else
- return (long)((double)(new_x) * m_scaleX - 0.5) * m_signX + m_deviceOriginX;
+ return (wxCoord)((double)(new_x) * m_scaleX - 0.5) * m_signX + m_deviceOriginX;
}
// Without device translation, for backing pixmap purposes
- long XLOG2DEV_2(long x) const
+ wxCoord XLOG2DEV_2(wxCoord x) const
{
- long new_x = x - m_logicalOriginX;
+ wxCoord new_x = x - m_logicalOriginX;
if (new_x > 0)
- return (long)((double)(new_x) * m_scaleX + 0.5) * m_signX;
+ return (wxCoord)((double)(new_x) * m_scaleX + 0.5) * m_signX;
else
- return (long)((double)(new_x) * m_scaleX - 0.5) * m_signX;
+ return (wxCoord)((double)(new_x) * m_scaleX - 0.5) * m_signX;
}
- long XLOG2DEVREL(long x) const
+ wxCoord XLOG2DEVREL(wxCoord x) const
{
if (x > 0)
- return (long)((double)(x) * m_scaleX + 0.5);
+ return (wxCoord)((double)(x) * m_scaleX + 0.5);
else
- return (long)((double)(x) * m_scaleX - 0.5);
+ return (wxCoord)((double)(x) * m_scaleX - 0.5);
}
- long YLOG2DEV(long y) const
+ wxCoord YLOG2DEV(wxCoord y) const
{
- long new_y = y - m_logicalOriginY;
+ wxCoord new_y = y - m_logicalOriginY;
if (new_y > 0)
- return (long)((double)(new_y) * m_scaleY + 0.5) * m_signY + m_deviceOriginY;
+ return (wxCoord)((double)(new_y) * m_scaleY + 0.5) * m_signY + m_deviceOriginY;
else
- return (long)((double)(new_y) * m_scaleY - 0.5) * m_signY + m_deviceOriginY;
+ return (wxCoord)((double)(new_y) * m_scaleY - 0.5) * m_signY + m_deviceOriginY;
}
// Without device translation, for backing pixmap purposes
- long YLOG2DEV_2(long y) const
+ wxCoord YLOG2DEV_2(wxCoord y) const
{
- long new_y = y - m_logicalOriginY;
+ wxCoord new_y = y - m_logicalOriginY;
if (new_y > 0)
- return (long)((double)(new_y) * m_scaleY + 0.5) * m_signY;
+ return (wxCoord)((double)(new_y) * m_scaleY + 0.5) * m_signY;
else
- return (long)((double)(new_y) * m_scaleY - 0.5) * m_signY;
+ return (wxCoord)((double)(new_y) * m_scaleY - 0.5) * m_signY;
}
- long YLOG2DEVREL(long y) const
+ wxCoord YLOG2DEVREL(wxCoord y) const
{
if (y > 0)
- return (long)((double)(y) * m_scaleY + 0.5);
+ return (wxCoord)((double)(y) * m_scaleY + 0.5);
else
- return (long)((double)(y) * m_scaleY - 0.5);
+ return (wxCoord)((double)(y) * m_scaleY - 0.5);
}
- void SetInternalDeviceOrigin( long x, long y );
- void GetInternalDeviceOrigin( long *x, long *y );
+ void SetInternalDeviceOrigin( wxCoord x, wxCoord y );
+ void GetInternalDeviceOrigin( wxCoord *x, wxCoord *y );
public:
// not sure what for, but what is a mm on a screen you don't know the size of?
// If un-scrolled is non-zero or d.o. changes with scrolling. Set using
// SetInternalDeviceOrigin().
- long m_internalDeviceOriginX,m_internalDeviceOriginY;
+ wxCoord m_internalDeviceOriginX,m_internalDeviceOriginY;
// To be set by external classes such as wxScrolledWindow using
// SetDeviceOrigin()
- long m_externalDeviceOriginX,m_externalDeviceOriginY;
+ wxCoord m_externalDeviceOriginX,m_externalDeviceOriginY;
// recompute scale?
bool m_needComputeScaleX, m_needComputeScaleY;
virtual void SetTextForeground(const wxColour& colour);
virtual void SetTextBackground(const wxColour& colour);
- virtual long GetCharHeight() const;
- virtual long GetCharWidth() const;
- virtual void GetTextExtent(const wxString& string,
- long *x, long *y,
- long *descent = NULL,
- long *externalLeading = NULL,
- wxFont *theFont = NULL) const;
+ virtual wxCoord GetCharHeight() const;
+ virtual wxCoord GetCharWidth() const;
+ virtual void DoGetTextExtent(const wxString& string,
+ wxCoord *x, wxCoord *y,
+ wxCoord *descent = NULL,
+ wxCoord *externalLeading = NULL,
+ wxFont *theFont = NULL) const;
virtual bool CanDrawBitmap() const;
virtual bool CanGetTextExtent() const;
void SetAutoSetting(bool flag) { m_autoSetting = flag; }
protected:
- virtual void DoFloodFill(long x, long y, const wxColour& col,
+ virtual void DoFloodFill(wxCoord x, wxCoord y, const wxColour& col,
int style = wxFLOOD_SURFACE);
- virtual bool DoGetPixel(long x, long y, wxColour *col) const;
+ virtual bool DoGetPixel(wxCoord x, wxCoord y, wxColour *col) const;
- virtual void DoDrawPoint(long x, long y);
- virtual void DoDrawLine(long x1, long y1, long x2, long y2);
+ virtual void DoDrawPoint(wxCoord x, wxCoord y);
+ virtual void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2);
- virtual void DoDrawArc(long x1, long y1,
- long x2, long y2,
- long xc, long yc);
- virtual void DoDrawEllipticArc(long x, long y, long w, long h,
+ virtual void DoDrawArc(wxCoord x1, wxCoord y1,
+ wxCoord x2, wxCoord y2,
+ wxCoord xc, wxCoord yc);
+ virtual void DoDrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h,
double sa, double ea);
- virtual void DoDrawRectangle(long x, long y, long width, long height);
- virtual void DoDrawRoundedRectangle(long x, long y,
- long width, long height,
+ virtual void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
+ virtual void DoDrawRoundedRectangle(wxCoord x, wxCoord y,
+ wxCoord width, wxCoord height,
double radius);
- virtual void DoDrawEllipse(long x, long y, long width, long height);
+ virtual void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
- virtual void DoCrossHair(long x, long y);
+ virtual void DoCrossHair(wxCoord x, wxCoord y);
- virtual void DoDrawText(const wxString& text, long x, long y);
+ virtual void DoDrawText(const wxString& text, wxCoord x, wxCoord y);
- virtual bool DoBlit(long xdest, long ydest, long width, long height,
- wxDC *source, long xsrc, long ysrc,
+ virtual bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
+ wxDC *source, wxCoord xsrc, wxCoord ysrc,
int rop = wxCOPY, bool useMask = FALSE);
virtual void DoSetClippingRegionAsRegion(const wxRegion& region);
- virtual void DoSetClippingRegion(long x, long y,
- long width, long height);
+ virtual void DoSetClippingRegion(wxCoord x, wxCoord y,
+ wxCoord width, wxCoord height);
virtual void DoDrawLines(int n, wxPoint points[],
- long xoffset, long yoffset);
+ wxCoord xoffset, wxCoord yoffset);
virtual void DoDrawPolygon(int n, wxPoint points[],
- long xoffset, long yoffset,
+ wxCoord xoffset, wxCoord yoffset,
int fillStyle = wxODDEVEN_RULE);
#if wxUSE_SPLINES
#include "wx/dc.h"
#include "wx/dcmemory.h"
+#include "wx/defs.h"
#if !USE_SHARED_LIBRARY
IMPLEMENT_ABSTRACT_CLASS(wxDC, wxObject)
m_isInteractive = FALSE;
}
-void wxDC::DoDrawIcon( const wxIcon &icon, long x, long y)
+void wxDC::DoDrawIcon( const wxIcon &icon, wxCoord x, wxCoord y)
{
wxCHECK_RET( Ok(), "invalid dc" );
wxCHECK_RET( icon.Ok(), "invalid icon" );
DoDrawBitmap(icon, x, y, TRUE);
}
-void wxDC::DoDrawBitmap( const wxBitmap& bitmap, long x, long y, bool useMask )
+void wxDC::DoDrawBitmap( const wxBitmap& bitmap, wxCoord x, wxCoord y, bool useMask )
{
wxCHECK_RET( bitmap.Ok(), "invalid bitmap" );
memDC.SelectObject(wxNullBitmap);
}
-void wxDC::DoSetClippingRegion( long x, long y, long width, long height )
+void wxDC::DoSetClippingRegion( wxCoord x, wxCoord y, wxCoord width, wxCoord height )
{
m_clipping = TRUE;
m_clipX1 = x;
ComputeScaleAndOrigin();
}
-void wxDC::SetLogicalOrigin( long x, long y )
+void wxDC::SetLogicalOrigin( wxCoord x, wxCoord y )
{
m_logicalOriginX = x * m_signX; // is this still correct ?
m_logicalOriginY = y * m_signY;
ComputeScaleAndOrigin();
}
-void wxDC::SetDeviceOrigin( long x, long y )
+void wxDC::SetDeviceOrigin( wxCoord x, wxCoord y )
{
m_externalDeviceOriginX = x;
m_externalDeviceOriginY = y;
ComputeScaleAndOrigin();
}
-void wxDC::SetInternalDeviceOrigin( long x, long y )
+void wxDC::SetInternalDeviceOrigin( wxCoord x, wxCoord y )
{
m_internalDeviceOriginX = x;
m_internalDeviceOriginY = y;
ComputeScaleAndOrigin();
}
-void wxDC::GetInternalDeviceOrigin( long *x, long *y )
+void wxDC::GetInternalDeviceOrigin( wxCoord *x, wxCoord *y )
{
if (x) *x = m_internalDeviceOriginX;
if (y) *y = m_internalDeviceOriginY;
ComputeScaleAndOrigin();
}
-long wxDCBase::DeviceToLogicalX(long x) const
+wxCoord wxDCBase::DeviceToLogicalX(wxCoord x) const
{
return ((wxDC *)this)->XDEV2LOG(x);
}
-long wxDCBase::DeviceToLogicalY(long y) const
+wxCoord wxDCBase::DeviceToLogicalY(wxCoord y) const
{
return ((wxDC *)this)->YDEV2LOG(y);
}
-long wxDCBase::DeviceToLogicalXRel(long x) const
+wxCoord wxDCBase::DeviceToLogicalXRel(wxCoord x) const
{
return ((wxDC *)this)->XDEV2LOGREL(x);
}
-long wxDCBase::DeviceToLogicalYRel(long y) const
+wxCoord wxDCBase::DeviceToLogicalYRel(wxCoord y) const
{
return ((wxDC *)this)->YDEV2LOGREL(y);
}
-long wxDCBase::LogicalToDeviceX(long x) const
+wxCoord wxDCBase::LogicalToDeviceX(wxCoord x) const
{
return ((wxDC *)this)->XLOG2DEV(x);
}
-long wxDCBase::LogicalToDeviceY(long y) const
+wxCoord wxDCBase::LogicalToDeviceY(wxCoord y) const
{
return ((wxDC *)this)->YLOG2DEV(y);
}
-long wxDCBase::LogicalToDeviceXRel(long x) const
+wxCoord wxDCBase::LogicalToDeviceXRel(wxCoord x) const
{
return ((wxDC *)this)->XLOG2DEVREL(x);
}
-long wxDCBase::LogicalToDeviceYRel(long y) const
+wxCoord wxDCBase::LogicalToDeviceYRel(wxCoord y) const
{
return ((wxDC *)this)->YLOG2DEVREL(y);
}
m_userRegion = (WXRegion) 0;
}
-void wxWindowDC::DoFloodFill( long WXUNUSED(x1), long WXUNUSED(y1),
+void wxWindowDC::DoFloodFill( wxCoord WXUNUSED(x1), wxCoord WXUNUSED(y1),
const wxColour& WXUNUSED(col), int WXUNUSED(style) )
{
wxFAIL_MSG("not implemented");
}
-bool wxWindowDC::DoGetPixel( long WXUNUSED(x1), long WXUNUSED(y1), wxColour *WXUNUSED(col) ) const
+bool wxWindowDC::DoGetPixel( wxCoord WXUNUSED(x1), wxCoord WXUNUSED(y1), wxColour *WXUNUSED(col) ) const
{
wxFAIL_MSG("not implemented");
return FALSE;
}
-void wxWindowDC::DoDrawLine( long x1, long y1, long x2, long y2 )
+void wxWindowDC::DoDrawLine( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2 )
{
wxCHECK_RET( Ok(), "invalid dc" );
CalcBoundingBox(x2, y2);
}
-void wxWindowDC::DoCrossHair( long x, long y )
+void wxWindowDC::DoCrossHair( wxCoord x, wxCoord y )
{
wxCHECK_RET( Ok(), "invalid dc" );
}
}
-void wxWindowDC::DoDrawArc( long x1, long y1, long x2, long y2, long xc, long yc )
+void wxWindowDC::DoDrawArc( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2, wxCoord xc, wxCoord yc )
{
wxCHECK_RET( Ok(), "invalid dc" );
int xxc_2 = XLOG2DEV_2 (xc);
int yyc_2 = YLOG2DEV_2 (yc);
- long dx = xx1 - xxc;
- long dy = yy1 - yyc;
+ wxCoord dx = xx1 - xxc;
+ wxCoord dy = yy1 - yyc;
double radius = sqrt (dx * dx + dy * dy);
- long r = (long) radius;
+ wxCoord r = (wxCoord) radius;
double radius1, radius2;
CalcBoundingBox (x2, y2);
}
-void wxWindowDC::DoDrawEllipticArc( long x, long y, long width, long height, double sa, double ea )
+void wxWindowDC::DoDrawEllipticArc( wxCoord x, wxCoord y, wxCoord width, wxCoord height, double sa, double ea )
{
wxCHECK_RET( Ok(), "invalid dc" );
CalcBoundingBox (x + width, y + height);
}
-void wxWindowDC::DoDrawPoint( long x, long y )
+void wxWindowDC::DoDrawPoint( wxCoord x, wxCoord y )
{
wxCHECK_RET( Ok(), "invalid dc" );
CalcBoundingBox (x, y);
}
-void wxWindowDC::DoDrawLines( int n, wxPoint points[], long xoffset, long yoffset )
+void wxWindowDC::DoDrawLines( int n, wxPoint points[], wxCoord xoffset, wxCoord yoffset )
{
wxCHECK_RET( Ok(), "invalid dc" );
}
void wxWindowDC::DoDrawPolygon( int n, wxPoint points[],
- long xoffset, long yoffset, int fillStyle )
+ wxCoord xoffset, wxCoord yoffset, int fillStyle )
{
wxCHECK_RET( Ok(), "invalid dc" );
delete[]xpoints2;
}
-void wxWindowDC::DoDrawRectangle( long x, long y, long width, long height )
+void wxWindowDC::DoDrawRectangle( wxCoord x, wxCoord y, wxCoord width, wxCoord height )
{
wxCHECK_RET( Ok(), "invalid dc" );
CalcBoundingBox (x + width, y + height);
}
-void wxWindowDC::DoDrawRoundedRectangle( long x, long y, long width, long height, double radius )
+void wxWindowDC::DoDrawRoundedRectangle( wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius )
{
wxCHECK_RET( Ok(), "invalid dc" );
}
-void wxWindowDC::DoDrawEllipse( long x, long y, long width, long height )
+void wxWindowDC::DoDrawEllipse( wxCoord x, wxCoord y, wxCoord width, wxCoord height )
{
wxCHECK_RET( Ok(), "invalid dc" );
}
#if 0
-void wxWindowDC::DoDrawIcon( const wxIcon &icon, long x, long y)
+void wxWindowDC::DoDrawIcon( const wxIcon &icon, wxCoord x, wxCoord y)
{
// FreeGetPixelCache();
#endif // 0
// TODO: use scaled Blit e.g. as per John Price's implementation in Contrib/Utilities
-bool wxWindowDC::DoBlit( long xdest, long ydest, long width, long height,
- wxDC *source, long xsrc, long ysrc, int rop, bool useMask )
+bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
+ wxDC *source, wxCoord xsrc, wxCoord ysrc, int rop, bool useMask )
{
wxCHECK_MSG( Ok(), FALSE, "invalid dc" );
return FALSE;
}
-void wxWindowDC::DoDrawText( const wxString &text, long x, long y )
+void wxWindowDC::DoDrawText( const wxString &text, wxCoord x, wxCoord y )
{
wxCHECK_RET( Ok(), "invalid dc" );
XLOG2DEV_2 (x), YLOG2DEV_2 (y) + ascent, (char*) (const char*) text, slen);
}
- long w, h;
+ wxCoord w, h;
GetTextExtent (text, &w, &h);
CalcBoundingBox (x + w, y + h);
CalcBoundingBox (x, y);
return TRUE;
}
-void wxWindowDC::GetTextExtent( const wxString &string, long *width, long *height,
- long *descent, long *externalLeading,
+void wxWindowDC::DoGetTextExtent( const wxString &string, wxCoord *width, wxCoord *height,
+ wxCoord *descent, wxCoord *externalLeading,
wxFont *font ) const
{
wxCHECK_RET( Ok(), "invalid dc" );
*externalLeading = 0;
}
-long wxWindowDC::GetCharWidth() const
+wxCoord wxWindowDC::GetCharWidth() const
{
wxCHECK_MSG( Ok(), 0, "invalid dc" );
wxCHECK_MSG( m_font.Ok(), 0, "invalid font" );
return XDEV2LOGREL(overall.width);
}
-long wxWindowDC::GetCharHeight() const
+wxCoord wxWindowDC::GetCharHeight() const
{
wxCHECK_MSG( Ok(), 0, "invalid dc" );
wxCHECK_MSG( m_font.Ok(), 0, "invalid font" );
if (!m_font.Ok())
{
- if ((m_oldFont != (WXFont) 0) && ((long) m_oldFont != -1))
+ if ((m_oldFont != (WXFont) 0) && ((wxCoord) m_oldFont != -1))
{
XSetFont ((Display*) m_display, (GC) m_gc, (Font) m_oldFont);
}
-void wxWindowDC::DoSetClippingRegion( long x, long y, long width, long height )
+void wxWindowDC::DoSetClippingRegion( wxCoord x, wxCoord y, wxCoord width, wxCoord height )
{
wxDC::DoSetClippingRegion( x, y, width, height );