wxASSERT_MSG( (window != (wxWindow*) NULL), "You must pass a valid wxWindow to wxWindowDC/wxClientDC/wxPaintDC constructor." );
m_window = window;
+ m_font = window->GetFont();
m_gc = (WXGC) 0;
m_gcBacking = (WXGC) 0;
m_backgroundPixel = -1;
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" );
// TODO: this should be an error log function
wxFAIL_MSG("set a valid font before calling GetTextExtent!");
- *width = -1;
- *height = -1;
+ if (width) *width = -1;
+ if (height) *height = -1;
return;
}
XTextExtents((XFontStruct*) pFontStruct, (char*) (const char*) string, slen, &direction,
&ascent, &descent2, &overall);
- *width = XDEV2LOGREL (overall.width);
- *height = YDEV2LOGREL (ascent + descent2);
+ if (width) *width = XDEV2LOGREL (overall.width);
+ if (height) *height = YDEV2LOGREL (ascent + descent2);
if (descent)
*descent = descent2;
if (externalLeading)
*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);
int style;
int join;
int cap;
- const static char dotted[] = {2, 5};
- const static char short_dashed[] = {4, 4};
- const static char long_dashed[] = {4, 8};
- const static char dotted_dashed[] = {6, 6, 2, 6};
+ static const char dotted[] = {2, 5};
+ static const char short_dashed[] = {4, 4};
+ static const char long_dashed[] = {4, 8};
+ static const char dotted_dashed[] = {6, 6, 2, 6};
// We express dash pattern in pen width unit, so we are
// independent of zoom factor and so on...
}
-void wxWindowDC::DoSetClippingRegion( long x, long y, long width, long height )
+void wxWindowDC::DoSetClippingRegion( wxCoord x, wxCoord y, wxCoord width, wxCoord height )
{
- wxDC::SetClippingRegion( x, y, width, height );
+ wxDC::DoSetClippingRegion( x, y, width, height );
if (m_userRegion)
XDestroyRegion ((Region) m_userRegion);
{
wxRect box = region.GetBox();
- wxDC::SetClippingRegion( box.x, box.y, box.width, box.height );
+ wxDC::DoSetClippingRegion( box.x, box.y, box.width, box.height );
if (m_userRegion)
XDestroyRegion ((Region) m_userRegion);
void wxWindowDC::DoDrawSpline( wxList *points )
{
- wxCHECK_RET( Ok(), _T("invalid window dc") );
+ wxCHECK_RET( Ok(), wxT("invalid window dc") );
wxPoint *p;
double cx1, cy1, cx2, cy2, cx3, cy3, cx4, cy4;
win->SetUpdateRegion(*region);
+ wxRegion& theRegion(win->GetUpdateRegion());
+ theRegion.SetRects(updateRects); // We also store in terms of rects, for iteration to work.
+
// Set the clipping region. Any user-defined region will be combined with this
// one in SetDCClipping.
XSetRegion ((Display*) m_display, (GC) m_gc, (Region) region->GetXRegion());