X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/155ecd4c4221d3bbc7aa93d472d11948f21d21ab..a766986f6d443ba1d50e3af25f3306fa56e4518e:/src/gtk1/dcclient.cpp?ds=sidebyside diff --git a/src/gtk1/dcclient.cpp b/src/gtk1/dcclient.cpp index 6dd1e9f48d..7046368d6c 100644 --- a/src/gtk1/dcclient.cpp +++ b/src/gtk1/dcclient.cpp @@ -14,19 +14,18 @@ #define XCopyPlane XCOPYPLANE #endif -#include "wx/dcclient.h" - #ifndef WX_PRECOMP #include "wx/log.h" - #include "wx/dcmemory.h" #include "wx/math.h" // for floating-point functions #include "wx/image.h" + #include "wx/module.h" #endif -#include "wx/module.h" #include "wx/fontutil.h" #include "wx/gtk1/win_gtk.h" +#include "wx/gtk1/dcclient.h" +#include "wx/gtk1/dcmemory.h" #include #include @@ -260,12 +259,13 @@ static void wxFreePoolGC( GdkGC *gc ) } //----------------------------------------------------------------------------- -// wxWindowDC +// wxWindowDCImpl //----------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxWindowDC, wxDC) +IMPLEMENT_ABSTRACT_CLASS(wxWindowDCImpl, wxDC) -wxWindowDC::wxWindowDC() +wxWindowDCImpl::wxWindowDCImpl(wxDC *owner) + : wxGTKDCImpl(owner) { m_penGC = (GdkGC *) NULL; m_brushGC = (GdkGC *) NULL; @@ -277,7 +277,8 @@ wxWindowDC::wxWindowDC() m_owner = (wxWindow *)NULL; } -wxWindowDC::wxWindowDC( wxWindow *window ) +wxWindowDCImpl::wxWindowDCImpl(wxDC *owner, wxWindow *window) + : wxGTKDCImpl(owner) { wxASSERT_MSG( window, wxT("DC needs a window") ); @@ -330,12 +331,12 @@ wxWindowDC::wxWindowDC( wxWindow *window ) m_owner = window; } -wxWindowDC::~wxWindowDC() +wxWindowDCImpl::~wxWindowDCImpl() { Destroy(); } -void wxWindowDC::SetUpDC() +void wxWindowDCImpl::SetUpDC() { m_ok = true; @@ -348,8 +349,7 @@ void wxWindowDC::SetUpDC() m_textGC = wxGetPoolGC( m_window, wxTEXT_SCREEN ); m_bgGC = wxGetPoolGC( m_window, wxBG_SCREEN ); } - else - if (m_isMemDC && (((wxMemoryDC*)this)->m_selected.GetDepth() == 1)) + else if (m_isMemDC && (((wxMemoryDCImpl*)this)->m_selected.GetDepth() == 1)) { m_penGC = wxGetPoolGC( m_window, wxPEN_MONO ); m_brushGC = wxGetPoolGC( m_window, wxBRUSH_MONO ); @@ -421,7 +421,7 @@ void wxWindowDC::SetUpDC() } } -void wxWindowDC::DoGetSize( int* width, int* height ) const +void wxWindowDCImpl::DoGetSize( int* width, int* height ) const { wxCHECK_RET( m_owner, _T("GetSize() doesn't work without window") ); @@ -431,20 +431,20 @@ void wxWindowDC::DoGetSize( int* width, int* height ) const extern bool wxDoFloodFill(wxDC *dc, wxCoord x, wxCoord y, const wxColour & col, int style); -bool wxWindowDC::DoFloodFill(wxCoord x, wxCoord y, +bool wxWindowDCImpl::DoFloodFill(wxCoord x, wxCoord y, const wxColour& col, int style) { - return wxDoFloodFill(this, x, y, col, style); + return wxDoFloodFill(GetOwner(), x, y, col, style); } -bool wxWindowDC::DoGetPixel( wxCoord x1, wxCoord y1, wxColour *col ) const +bool wxWindowDCImpl::DoGetPixel( wxCoord x1, wxCoord y1, wxColour *col ) const { // Generic (and therefore rather inefficient) method. // Could be improved. wxMemoryDC memdc; wxBitmap bitmap(1, 1); memdc.SelectObject(bitmap); - memdc.Blit(0, 0, 1, 1, (wxDC*) this, x1, y1); + memdc.Blit(0, 0, 1, 1, GetOwner(), x1, y1); memdc.SelectObject(wxNullBitmap); wxImage image = bitmap.ConvertToImage(); @@ -452,9 +452,9 @@ bool wxWindowDC::DoGetPixel( wxCoord x1, wxCoord y1, wxColour *col ) const return true; } -void wxWindowDC::DoDrawLine( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2 ) +void wxWindowDCImpl::DoDrawLine( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2 ) { - wxCHECK_RET( Ok(), wxT("invalid window dc") ); + wxCHECK_RET( IsOk(), wxT("invalid window dc") ); if (m_pen.GetStyle() != wxTRANSPARENT) { @@ -466,9 +466,9 @@ void wxWindowDC::DoDrawLine( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2 ) } } -void wxWindowDC::DoCrossHair( wxCoord x, wxCoord y ) +void wxWindowDCImpl::DoCrossHair( wxCoord x, wxCoord y ) { - wxCHECK_RET( Ok(), wxT("invalid window dc") ); + wxCHECK_RET( IsOk(), wxT("invalid window dc") ); if (m_pen.GetStyle() != wxTRANSPARENT) { @@ -485,10 +485,10 @@ void wxWindowDC::DoCrossHair( wxCoord x, wxCoord y ) } } -void wxWindowDC::DoDrawArc( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2, +void wxWindowDCImpl::DoDrawArc( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2, wxCoord xc, wxCoord yc ) { - wxCHECK_RET( Ok(), wxT("invalid window dc") ); + wxCHECK_RET( IsOk(), wxT("invalid window dc") ); wxCoord xx1 = XLOG2DEV(x1); wxCoord yy1 = YLOG2DEV(y1); @@ -577,9 +577,9 @@ void wxWindowDC::DoDrawArc( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2, CalcBoundingBox (x2, y2); } -void wxWindowDC::DoDrawEllipticArc( wxCoord x, wxCoord y, wxCoord width, wxCoord height, double sa, double ea ) +void wxWindowDCImpl::DoDrawEllipticArc( wxCoord x, wxCoord y, wxCoord width, wxCoord height, double sa, double ea ) { - wxCHECK_RET( Ok(), wxT("invalid window dc") ); + wxCHECK_RET( IsOk(), wxT("invalid window dc") ); wxCoord xx = XLOG2DEV(x); wxCoord yy = YLOG2DEV(y); @@ -639,9 +639,9 @@ void wxWindowDC::DoDrawEllipticArc( wxCoord x, wxCoord y, wxCoord width, wxCoord CalcBoundingBox (x + width, y + height); } -void wxWindowDC::DoDrawPoint( wxCoord x, wxCoord y ) +void wxWindowDCImpl::DoDrawPoint( wxCoord x, wxCoord y ) { - wxCHECK_RET( Ok(), wxT("invalid window dc") ); + wxCHECK_RET( IsOk(), wxT("invalid window dc") ); if ((m_pen.GetStyle() != wxTRANSPARENT) && m_window) gdk_draw_point( m_window, m_penGC, XLOG2DEV(x), YLOG2DEV(y) ); @@ -649,27 +649,16 @@ void wxWindowDC::DoDrawPoint( wxCoord x, wxCoord y ) CalcBoundingBox (x, y); } -void wxWindowDC::DoDrawLines( int n, wxPoint points[], wxCoord xoffset, wxCoord yoffset ) +void wxWindowDCImpl::DoDrawLines( int n, wxPoint points[], wxCoord xoffset, wxCoord yoffset ) { - wxCHECK_RET( Ok(), wxT("invalid window dc") ); + wxCHECK_RET( IsOk(), wxT("invalid window dc") ); if (m_pen.GetStyle() == wxTRANSPARENT) return; if (n <= 0) return; - //Check, if scaling is necessary - bool doScale(true); - long val(10); - if (!xoffset) - if (!yoffset) - if (XLOG2DEV(val)==val) - if (YLOG2DEV(val)==val) - doScale = false; - GdkPoint *gpts = NULL; - - if (doScale){ - gpts = new GdkPoint[n]; - if (! gpts) + GdkPoint * const gpts = new GdkPoint[n]; + if ( !gpts ) { wxFAIL_MSG( wxT("Cannot allocate PolyLine") ); return; @@ -677,138 +666,91 @@ void wxWindowDC::DoDrawLines( int n, wxPoint points[], wxCoord xoffset, wxCoord for (int i = 0; i < n; i++) { - wxCoord x1 = XLOG2DEV(points[i].x + xoffset); - wxCoord y1 = YLOG2DEV(points[i].y + yoffset); - - CalcBoundingBox( x1 + xoffset, y1 + yoffset ); + wxCoord x = points[i].x + xoffset, + y = points[i].y + yoffset; - gpts[i].x = x1; - gpts[i].y = y1; - } - } - else { - for (int i = 0; i < n; i++) { - CalcBoundingBox( points[i].x, points[i].y ); - } + CalcBoundingBox(x + xoffset, y + yoffset); - //GdkPoint and wxPoint have the same memory allignment, so we can cast one into another - gpts = reinterpret_cast(points); + gpts[i].x = XLOG2DEV(x); + gpts[i].y = YLOG2DEV(y); } - if (m_window) - gdk_draw_lines( m_window, m_penGC, gpts, n); + gdk_draw_lines( m_window, m_penGC, gpts, n); - if (doScale) delete[] gpts; } -void wxWindowDC::DoDrawPolygon( int n, wxPoint points[], wxCoord xoffset, wxCoord yoffset, int WXUNUSED(fillStyle) ) +void wxWindowDCImpl::DoDrawPolygon( int n, wxPoint points[], wxCoord xoffset, wxCoord yoffset, int WXUNUSED(fillStyle) ) { - wxCHECK_RET( Ok(), wxT("invalid window dc") ); + wxCHECK_RET( IsOk(), wxT("invalid window dc") ); if (n <= 0) return; - //Check, if scaling is necessary - bool doScale(true); - long val(10); - if (!xoffset) - if (!yoffset) - if (XLOG2DEV(val)==val) - if (YLOG2DEV(val)==val){ - doScale = false; - } - - GdkPoint *gdkpoints = NULL; + GdkPoint * const gpts = new GdkPoint[n]; - if (doScale){ - gdkpoints = new GdkPoint[n+1]; //FIXME: Why the "+1" - - int i; - for (i = 0 ; i < n ; i++) + for (int i = 0 ; i < n ; i++) { - gdkpoints[i].x = XLOG2DEV(points[i].x + xoffset); - gdkpoints[i].y = YLOG2DEV(points[i].y + yoffset); + wxCoord x = points[i].x + xoffset, + y = points[i].y + yoffset; - CalcBoundingBox( points[i].x + xoffset, points[i].y + yoffset ); - } - } - else { - int i(0); - for (; i < n ; ++i) { - CalcBoundingBox( points[i].x, points[i].y ); - } - //GdkPoint and wxPoint have the same memory allignment, so we can cast one into another - gdkpoints = reinterpret_cast (points); + CalcBoundingBox(x + xoffset, y + yoffset); + + gpts[i].x = XLOG2DEV(x); + gpts[i].y = YLOG2DEV(y); } - if (m_window) + if (m_brush.GetStyle() == wxSOLID) { - //I think wxSOLID is the most often used style (it is for me), - //so I put it in front of the if ... ifelse's - if (m_brush.GetStyle() == wxSOLID) + gdk_draw_polygon( m_window, m_brushGC, TRUE, gpts, n ); + } + else if (m_brush.GetStyle() != wxTRANSPARENT) + { + if ((m_brush.GetStyle() == wxSTIPPLE_MASK_OPAQUE) && (m_brush.GetStipple()->GetMask())) { - gdk_draw_polygon( m_window, m_brushGC, TRUE, gdkpoints, n ); - }else - if (m_brush.GetStyle() != wxTRANSPARENT) + gdk_gc_set_ts_origin( m_textGC, + m_deviceOriginX % m_brush.GetStipple()->GetWidth(), + m_deviceOriginY % m_brush.GetStipple()->GetHeight() ); + gdk_draw_polygon( m_window, m_textGC, TRUE, gpts, n ); + gdk_gc_set_ts_origin( m_textGC, 0, 0 ); + } else + if (IS_15_PIX_HATCH(m_brush.GetStyle())) { - if ((m_brush.GetStyle() == wxSTIPPLE_MASK_OPAQUE) && (m_brush.GetStipple()->GetMask())) - { - gdk_gc_set_ts_origin( m_textGC, - m_deviceOriginX % m_brush.GetStipple()->GetWidth(), - m_deviceOriginY % m_brush.GetStipple()->GetHeight() ); - gdk_draw_polygon( m_window, m_textGC, TRUE, gdkpoints, n ); - gdk_gc_set_ts_origin( m_textGC, 0, 0 ); - } else - if (IS_15_PIX_HATCH(m_brush.GetStyle())) - { - gdk_gc_set_ts_origin( m_brushGC, m_deviceOriginX % 15, m_deviceOriginY % 15 ); - gdk_draw_polygon( m_window, m_brushGC, TRUE, gdkpoints, n ); - gdk_gc_set_ts_origin( m_brushGC, 0, 0 ); - } else - if (IS_16_PIX_HATCH(m_brush.GetStyle())) - { - gdk_gc_set_ts_origin( m_brushGC, m_deviceOriginX % 16, m_deviceOriginY % 16 ); - gdk_draw_polygon( m_window, m_brushGC, TRUE, gdkpoints, n ); - gdk_gc_set_ts_origin( m_brushGC, 0, 0 ); - } else - if (m_brush.GetStyle() == wxSTIPPLE) - { - gdk_gc_set_ts_origin( m_brushGC, - m_deviceOriginX % m_brush.GetStipple()->GetWidth(), - m_deviceOriginY % m_brush.GetStipple()->GetHeight() ); - gdk_draw_polygon( m_window, m_brushGC, TRUE, gdkpoints, n ); - gdk_gc_set_ts_origin( m_brushGC, 0, 0 ); - } - else - { - gdk_draw_polygon( m_window, m_brushGC, TRUE, gdkpoints, n ); - } + gdk_gc_set_ts_origin( m_brushGC, m_deviceOriginX % 15, m_deviceOriginY % 15 ); + gdk_draw_polygon( m_window, m_brushGC, TRUE, gpts, n ); + gdk_gc_set_ts_origin( m_brushGC, 0, 0 ); + } else + if (IS_16_PIX_HATCH(m_brush.GetStyle())) + { + gdk_gc_set_ts_origin( m_brushGC, m_deviceOriginX % 16, m_deviceOriginY % 16 ); + gdk_draw_polygon( m_window, m_brushGC, TRUE, gpts, n ); + gdk_gc_set_ts_origin( m_brushGC, 0, 0 ); + } else + if (m_brush.GetStyle() == wxSTIPPLE) + { + gdk_gc_set_ts_origin( m_brushGC, + m_deviceOriginX % m_brush.GetStipple()->GetWidth(), + m_deviceOriginY % m_brush.GetStipple()->GetHeight() ); + gdk_draw_polygon( m_window, m_brushGC, TRUE, gpts, n ); + gdk_gc_set_ts_origin( m_brushGC, 0, 0 ); } - - if (m_pen.GetStyle() != wxTRANSPARENT) + else { -/* - for (i = 0 ; i < n ; i++) - { - gdk_draw_line( m_window, m_penGC, - gdkpoints[i%n].x, - gdkpoints[i%n].y, - gdkpoints[(i+1)%n].x, - gdkpoints[(i+1)%n].y); - } -*/ - gdk_draw_polygon( m_window, m_penGC, FALSE, gdkpoints, n ); - + gdk_draw_polygon( m_window, m_brushGC, TRUE, gpts, n ); } } - if (doScale) - delete[] gdkpoints; + if (m_pen.GetStyle() != wxTRANSPARENT) + { + gdk_draw_polygon( m_window, m_penGC, FALSE, gpts, n ); + + } + + delete[] gpts; } -void wxWindowDC::DoDrawRectangle( wxCoord x, wxCoord y, wxCoord width, wxCoord height ) +void wxWindowDCImpl::DoDrawRectangle( wxCoord x, wxCoord y, wxCoord width, wxCoord height ) { - wxCHECK_RET( Ok(), wxT("invalid window dc") ); + wxCHECK_RET( IsOk(), wxT("invalid window dc") ); wxCoord xx = XLOG2DEV(x); wxCoord yy = YLOG2DEV(y); @@ -868,9 +810,9 @@ void wxWindowDC::DoDrawRectangle( wxCoord x, wxCoord y, wxCoord width, wxCoord h CalcBoundingBox( x + width, y + height ); } -void wxWindowDC::DoDrawRoundedRectangle( wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius ) +void wxWindowDCImpl::DoDrawRoundedRectangle( wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius ) { - wxCHECK_RET( Ok(), wxT("invalid window dc") ); + wxCHECK_RET( IsOk(), wxT("invalid window dc") ); if (radius < 0.0) radius = - radius * ((width < height) ? width : height); @@ -888,7 +830,7 @@ void wxWindowDC::DoDrawRoundedRectangle( wxCoord x, wxCoord y, wxCoord width, wx // X drawing errors with small radii if (rr == 0) { - DrawRectangle( x, y, width, height ); + DoDrawRectangle( x, y, width, height ); return; } @@ -991,9 +933,9 @@ void wxWindowDC::DoDrawRoundedRectangle( wxCoord x, wxCoord y, wxCoord width, wx CalcBoundingBox( x + width, y + height ); } -void wxWindowDC::DoDrawEllipse( wxCoord x, wxCoord y, wxCoord width, wxCoord height ) +void wxWindowDCImpl::DoDrawEllipse( wxCoord x, wxCoord y, wxCoord width, wxCoord height ) { - wxCHECK_RET( Ok(), wxT("invalid window dc") ); + wxCHECK_RET( IsOk(), wxT("invalid window dc") ); wxCoord xx = XLOG2DEV(x); wxCoord yy = YLOG2DEV(y); @@ -1050,17 +992,17 @@ void wxWindowDC::DoDrawEllipse( wxCoord x, wxCoord y, wxCoord width, wxCoord hei CalcBoundingBox( x + width, y + height ); } -void wxWindowDC::DoDrawIcon( const wxIcon &icon, wxCoord x, wxCoord y ) +void wxWindowDCImpl::DoDrawIcon( const wxIcon &icon, wxCoord x, wxCoord y ) { // VZ: egcs 1.0.3 refuses to compile this without cast, no idea why DoDrawBitmap( (const wxBitmap&)icon, x, y, true ); } -void wxWindowDC::DoDrawBitmap( const wxBitmap &bitmap, +void wxWindowDCImpl::DoDrawBitmap( const wxBitmap &bitmap, wxCoord x, wxCoord y, bool useMask ) { - wxCHECK_RET( Ok(), wxT("invalid window dc") ); + wxCHECK_RET( IsOk(), wxT("invalid window dc") ); wxCHECK_RET( bitmap.Ok(), wxT("invalid bitmap") ); @@ -1183,26 +1125,29 @@ void wxWindowDC::DoDrawBitmap( const wxBitmap &bitmap, gdk_bitmap_unref( new_mask ); } -bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest, - wxCoord width, wxCoord height, - wxDC *source, - wxCoord xsrc, wxCoord ysrc, - int logical_func, - bool useMask, - wxCoord xsrcMask, wxCoord ysrcMask ) +bool wxWindowDCImpl::DoBlit( wxCoord xdest, wxCoord ydest, + wxCoord width, wxCoord height, + wxDC *source, + wxCoord xsrc, wxCoord ysrc, + int logical_func, + bool useMask, + wxCoord xsrcMask, wxCoord ysrcMask ) { - wxCHECK_MSG( Ok(), false, wxT("invalid window dc") ); + wxCHECK_MSG( IsOk(), false, wxT("invalid window dc") ); wxCHECK_MSG( source, false, wxT("invalid source dc") ); if (!m_window) return false; // transform the source DC coords to the device ones - xsrc = source->XLOG2DEV(xsrc); - ysrc = source->YLOG2DEV(ysrc); + xsrc = source->LogicalToDeviceX(xsrc); + ysrc = source->LogicalToDeviceY(ysrc); + + wxWindowDCImpl *srcDC = wxDynamicCast(source->GetImpl(), wxWindowDCImpl); + wxCHECK_MSG( srcDC, false, "source must be a window DC" ); - wxClientDC *srcDC = (wxClientDC*)source; - wxMemoryDC *memDC = (wxMemoryDC*)source; + // FIXME: this cast is not always valid, see the code using m_isMemDC + wxMemoryDCImpl *memDC = wx_static_cast(wxMemoryDCImpl *, srcDC); bool use_bitmap_method = false; bool is_mono = false; @@ -1450,9 +1395,9 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest, return true; } -void wxWindowDC::DoDrawText( const wxString &text, wxCoord x, wxCoord y ) +void wxWindowDCImpl::DoDrawText( const wxString &text, wxCoord x, wxCoord y ) { - wxCHECK_RET( Ok(), wxT("invalid window dc") ); + wxCHECK_RET( IsOk(), wxT("invalid window dc") ); if (!m_window) return; @@ -1497,15 +1442,15 @@ void wxWindowDC::DoDrawText( const wxString &text, wxCoord x, wxCoord y ) // a better approach here: // http://www.daa.com.au/pipermail/pygtk/2003-April/005052.html -void wxWindowDC::DoDrawRotatedText( const wxString &text, wxCoord x, wxCoord y, double angle ) +void wxWindowDCImpl::DoDrawRotatedText( const wxString &text, wxCoord x, wxCoord y, double angle ) { if ( wxIsNullDouble(angle) ) { - DrawText(text, x, y); + DoDrawText(text, x, y); return; } - wxCHECK_RET( Ok(), wxT("invalid window dc") ); + wxCHECK_RET( IsOk(), wxT("invalid window dc") ); if (!m_window) return; @@ -1603,10 +1548,10 @@ void wxWindowDC::DoDrawRotatedText( const wxString &text, wxCoord x, wxCoord y, CalcBoundingBox(x + maxX, y + maxY); } -void wxWindowDC::DoGetTextExtent(const wxString &string, +void wxWindowDCImpl::DoGetTextExtent(const wxString &string, wxCoord *width, wxCoord *height, wxCoord *descent, wxCoord *externalLeading, - wxFont *theFont) const + const wxFont *theFont) const { if ( width ) *width = 0; @@ -1638,7 +1583,7 @@ void wxWindowDC::DoGetTextExtent(const wxString &string, *descent = wxCoord(font->descent / m_scaleY); } -wxCoord wxWindowDC::GetCharWidth() const +wxCoord wxWindowDCImpl::GetCharWidth() const { GdkFont *font = m_font.GetInternalFont( m_scaleY ); wxCHECK_MSG( font, -1, wxT("invalid font") ); @@ -1646,7 +1591,7 @@ wxCoord wxWindowDC::GetCharWidth() const return wxCoord(gdk_string_width( font, "H" ) / m_scaleX); } -wxCoord wxWindowDC::GetCharHeight() const +wxCoord wxWindowDCImpl::GetCharHeight() const { GdkFont *font = m_font.GetInternalFont( m_scaleY ); wxCHECK_MSG( font, -1, wxT("invalid font") ); @@ -1654,9 +1599,9 @@ wxCoord wxWindowDC::GetCharHeight() const return wxCoord((font->ascent + font->descent) / m_scaleY); } -void wxWindowDC::Clear() +void wxWindowDCImpl::Clear() { - wxCHECK_RET( Ok(), wxT("invalid window dc") ); + wxCHECK_RET( IsOk(), wxT("invalid window dc") ); if (!m_window) return; @@ -1692,14 +1637,14 @@ void wxWindowDC::Clear() #endif // 0/1 } -void wxWindowDC::SetFont( const wxFont &font ) +void wxWindowDCImpl::SetFont( const wxFont &font ) { m_font = font; } -void wxWindowDC::SetPen( const wxPen &pen ) +void wxWindowDCImpl::SetPen( const wxPen &pen ) { - wxCHECK_RET( Ok(), wxT("invalid window dc") ); + wxCHECK_RET( IsOk(), wxT("invalid window dc") ); if (m_pen == pen) return; @@ -1847,9 +1792,9 @@ void wxWindowDC::SetPen( const wxPen &pen ) gdk_gc_set_foreground( m_penGC, m_pen.GetColour().GetColor() ); } -void wxWindowDC::SetBrush( const wxBrush &brush ) +void wxWindowDCImpl::SetBrush( const wxBrush &brush ) { - wxCHECK_RET( Ok(), wxT("invalid window dc") ); + wxCHECK_RET( IsOk(), wxT("invalid window dc") ); if (m_brush == brush) return; @@ -1892,12 +1837,12 @@ void wxWindowDC::SetBrush( const wxBrush &brush ) } } -void wxWindowDC::SetBackground( const wxBrush &brush ) +void wxWindowDCImpl::SetBackground( const wxBrush &brush ) { /* CMB 21/7/98: Added SetBackground. Sets background brush * for Clear() and bg colour for shapes filled with cross-hatch brush */ - wxCHECK_RET( Ok(), wxT("invalid window dc") ); + wxCHECK_RET( IsOk(), wxT("invalid window dc") ); if (m_backgroundBrush == brush) return; @@ -1937,9 +1882,9 @@ void wxWindowDC::SetBackground( const wxBrush &brush ) } } -void wxWindowDC::SetLogicalFunction( int function ) +void wxWindowDCImpl::SetLogicalFunction( int function ) { - wxCHECK_RET( Ok(), wxT("invalid window dc") ); + wxCHECK_RET( IsOk(), wxT("invalid window dc") ); if (m_logicalFunction == function) return; @@ -1985,9 +1930,9 @@ void wxWindowDC::SetLogicalFunction( int function ) gdk_gc_set_function( m_textGC, mode ); } -void wxWindowDC::SetTextForeground( const wxColour &col ) +void wxWindowDCImpl::SetTextForeground( const wxColour &col ) { - wxCHECK_RET( Ok(), wxT("invalid window dc") ); + wxCHECK_RET( IsOk(), wxT("invalid window dc") ); // don't set m_textForegroundColour to an invalid colour as we'd crash // later then (we use m_textForegroundColour.GetColor() without checking @@ -2004,9 +1949,9 @@ void wxWindowDC::SetTextForeground( const wxColour &col ) } } -void wxWindowDC::SetTextBackground( const wxColour &col ) +void wxWindowDCImpl::SetTextBackground( const wxColour &col ) { - wxCHECK_RET( Ok(), wxT("invalid window dc") ); + wxCHECK_RET( IsOk(), wxT("invalid window dc") ); // same as above if ( !col.Ok() || (m_textBackgroundColour == col) ) @@ -2021,9 +1966,9 @@ void wxWindowDC::SetTextBackground( const wxColour &col ) } } -void wxWindowDC::SetBackgroundMode( int mode ) +void wxWindowDCImpl::SetBackgroundMode( int mode ) { - wxCHECK_RET( Ok(), wxT("invalid window dc") ); + wxCHECK_RET( IsOk(), wxT("invalid window dc") ); m_backgroundMode = mode; @@ -2039,14 +1984,14 @@ void wxWindowDC::SetBackgroundMode( int mode ) } } -void wxWindowDC::SetPalette( const wxPalette& WXUNUSED(palette) ) +void wxWindowDCImpl::SetPalette( const wxPalette& WXUNUSED(palette) ) { - wxFAIL_MSG( wxT("wxWindowDC::SetPalette not implemented") ); + wxFAIL_MSG( wxT("wxWindowDCImpl::SetPalette not implemented") ); } -void wxWindowDC::DoSetClippingRegion( wxCoord x, wxCoord y, wxCoord width, wxCoord height ) +void wxWindowDCImpl::DoSetClippingRegion( wxCoord x, wxCoord y, wxCoord width, wxCoord height ) { - wxCHECK_RET( Ok(), wxT("invalid window dc") ); + wxCHECK_RET( IsOk(), wxT("invalid window dc") ); if (!m_window) return; @@ -2068,7 +2013,7 @@ void wxWindowDC::DoSetClippingRegion( wxCoord x, wxCoord y, wxCoord width, wxCoo wxCoord xx, yy, ww, hh; m_currentClippingRegion.GetBox( xx, yy, ww, hh ); - wxDC::DoSetClippingRegion( xx, yy, ww, hh ); + wxGTKDCImpl::DoSetClippingRegion( xx, yy, ww, hh ); gdk_gc_set_clip_region( m_penGC, m_currentClippingRegion.GetRegion() ); gdk_gc_set_clip_region( m_brushGC, m_currentClippingRegion.GetRegion() ); @@ -2076,9 +2021,9 @@ void wxWindowDC::DoSetClippingRegion( wxCoord x, wxCoord y, wxCoord width, wxCoo gdk_gc_set_clip_region( m_bgGC, m_currentClippingRegion.GetRegion() ); } -void wxWindowDC::DoSetClippingRegionAsRegion( const wxRegion ®ion ) +void wxWindowDCImpl::DoSetClippingRegionAsRegion( const wxRegion ®ion ) { - wxCHECK_RET( Ok(), wxT("invalid window dc") ); + wxCHECK_RET( IsOk(), wxT("invalid window dc") ); if (region.Empty()) { @@ -2100,7 +2045,7 @@ void wxWindowDC::DoSetClippingRegionAsRegion( const wxRegion ®ion ) wxCoord xx, yy, ww, hh; m_currentClippingRegion.GetBox( xx, yy, ww, hh ); - wxDC::DoSetClippingRegion( xx, yy, ww, hh ); + wxGTKDCImpl::DoSetClippingRegion( xx, yy, ww, hh ); gdk_gc_set_clip_region( m_penGC, m_currentClippingRegion.GetRegion() ); gdk_gc_set_clip_region( m_brushGC, m_currentClippingRegion.GetRegion() ); @@ -2108,11 +2053,11 @@ void wxWindowDC::DoSetClippingRegionAsRegion( const wxRegion ®ion ) gdk_gc_set_clip_region( m_bgGC, m_currentClippingRegion.GetRegion() ); } -void wxWindowDC::DestroyClippingRegion() +void wxWindowDCImpl::DestroyClippingRegion() { - wxCHECK_RET( Ok(), wxT("invalid window dc") ); + wxCHECK_RET( IsOk(), wxT("invalid window dc") ); - wxDC::DestroyClippingRegion(); + wxGTKDCImpl::DestroyClippingRegion(); m_currentClippingRegion.Clear(); @@ -2139,7 +2084,7 @@ void wxWindowDC::DestroyClippingRegion() } } -void wxWindowDC::Destroy() +void wxWindowDCImpl::Destroy() { if (m_penGC) wxFreePoolGC( m_penGC ); m_penGC = (GdkGC*) NULL; @@ -2151,11 +2096,11 @@ void wxWindowDC::Destroy() m_bgGC = (GdkGC*) NULL; } -void wxWindowDC::ComputeScaleAndOrigin() +void wxWindowDCImpl::ComputeScaleAndOrigin() { const wxRealPoint origScale(m_scaleX, m_scaleY); - wxDC::ComputeScaleAndOrigin(); + wxGTKDCImpl::ComputeScaleAndOrigin(); // if scale has changed call SetPen to recalulate the line width if ( wxRealPoint(m_scaleX, m_scaleY) != origScale && m_pen.Ok() ) @@ -2169,12 +2114,12 @@ void wxWindowDC::ComputeScaleAndOrigin() } // Resolution in pixels per logical inch -wxSize wxWindowDC::GetPPI() const +wxSize wxWindowDCImpl::GetPPI() const { return wxSize( (int) (m_mm_to_pix_x * 25.4 + 0.5), (int) (m_mm_to_pix_y * 25.4 + 0.5)); } -int wxWindowDC::GetDepth() const +int wxWindowDCImpl::GetDepth() const { wxFAIL_MSG(wxT("not implemented")); @@ -2183,10 +2128,10 @@ int wxWindowDC::GetDepth() const //----------------------------------------------------------------------------- -// wxPaintDC +// wxPaintDCImpl //----------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxPaintDC, wxClientDC) +IMPLEMENT_ABSTRACT_CLASS(wxPaintDCImpl, wxClientDCImpl) // Limit the paint region to the window size. Sometimes // the paint region is too big, and this risks X11 errors @@ -2207,8 +2152,8 @@ static void wxLimitRegionToSize(wxRegion& region, const wxSize& sz) } } -wxPaintDC::wxPaintDC( wxWindow *win ) - : wxClientDC( win ) +wxPaintDCImpl::wxPaintDCImpl(wxDC *owner, wxWindow *win) + : wxClientDCImpl(owner, win) { #if USE_PAINT_REGION if (!win->m_clipPaintRegion) @@ -2236,15 +2181,15 @@ wxPaintDC::wxPaintDC( wxWindow *win ) } //----------------------------------------------------------------------------- -// wxClientDC +// wxClientDCImpl //----------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxClientDC, wxWindowDC) +IMPLEMENT_ABSTRACT_CLASS(wxClientDCImpl, wxWindowDCImpl) -wxClientDC::wxClientDC( wxWindow *win ) - : wxWindowDC( win ) +wxClientDCImpl::wxClientDCImpl(wxDC *owner, wxWindow *win) + : wxWindowDCImpl(owner, win) { - wxCHECK_RET( win, _T("NULL window in wxClientDC::wxClientDC") ); + wxCHECK_RET( win, _T("NULL window in wxClientDCImpl::wxClientDCImpl") ); #ifdef __WXUNIVERSAL__ wxPoint ptOrigin = win->GetClientAreaOrigin(); @@ -2254,7 +2199,7 @@ wxClientDC::wxClientDC( wxWindow *win ) #endif // __WXUNIVERSAL__ } -void wxClientDC::DoGetSize(int *width, int *height) const +void wxClientDCImpl::DoGetSize(int *width, int *height) const { wxCHECK_RET( m_owner, _T("GetSize() doesn't work without window") );