#ifndef WX_PRECOMP
#include "wx/app.h"
#include "wx/window.h"
- #include "wx/dcmemory.h"
#include "wx/math.h"
#include "wx/image.h"
#include "wx/module.h"
#endif
#include "wx/fontutil.h"
+#include "wx/vector.h"
#include "wx/x11/private.h"
+#include "wx/x11/dcclient.h"
+#include "wx/x11/dcmemory.h"
#if wxUSE_UNICODE
#include "glib.h"
// local defines
//-----------------------------------------------------------------------------
-#define USE_PAINT_REGION 1
+// VZ: what is this for exactly??
+#define USE_PAINT_REGION 0
//-----------------------------------------------------------------------------
// local data
#define IS_16_PIX_HATCH(s) ((s)!=wxCROSSDIAG_HATCH && (s)!=wxHORIZONTAL_HATCH && (s)!=wxVERTICAL_HATCH)
static Pixmap hatches[num_hatches];
-static Pixmap *hatch_bitmap = (Pixmap *) NULL;
+static Pixmap *hatch_bitmap = NULL;
//-----------------------------------------------------------------------------
// constants
// wxWindowDC
// ----------------------------------------------------------------------------
-IMPLEMENT_DYNAMIC_CLASS(wxWindowDC, wxDC)
+IMPLEMENT_ABSTRACT_CLASS(wxWindowDCImpl, wxX11DCImpl)
-wxWindowDC::wxWindowDC()
+wxWindowDCImpl::wxWindowDCImpl( wxDC *owner )
+ : wxX11DCImpl( owner )
{
- m_display = (WXDisplay *) NULL;
- m_penGC = (WXGC *) NULL;
- m_brushGC = (WXGC *) NULL;
- m_textGC = (WXGC *) NULL;
- m_bgGC = (WXGC *) NULL;
- m_cmap = (WXColormap *) NULL;
- m_isMemDC = false;
- m_isScreenDC = false;
- m_owner = (wxWindow *)NULL;
-
-#if wxUSE_UNICODE
- m_context = (PangoContext *)NULL;
- m_fontdesc = (PangoFontDescription *)NULL;
-#endif
+ Init();
}
-wxWindowDC::wxWindowDC( wxWindow *window )
+wxWindowDCImpl::wxWindowDCImpl( wxDC* owner, wxWindow *window )
+ : wxX11DCImpl( owner )
{
wxASSERT_MSG( window, wxT("DC needs a window") );
- m_display = (WXDisplay *) NULL;
- m_penGC = (WXGC *) NULL;
- m_brushGC = (WXGC *) NULL;
- m_textGC = (WXGC *) NULL;
- m_bgGC = (WXGC *) NULL;
- m_cmap = (WXColormap *) NULL;
- m_owner = (wxWindow *)NULL;
- m_isMemDC = false;
- m_isScreenDC = false;
+ Init();
+
m_font = window->GetFont();
- m_window = (WXWindow*) window->GetMainWindow();
+ m_x11window = (WXWindow*) window->GetMainWindow();
// not realized ?
- if (!m_window)
+ if (!m_x11window)
{
// don't report problems
m_ok = true;
m_display = (WXDisplay *) wxGlobalDisplay();
#if wxUSE_UNICODE
- m_context = wxTheApp->GetPangoContext();
m_fontdesc = window->GetFont().GetNativeFontInfo()->description;
#endif
/* this must be done after SetUpDC, bacause SetUpDC calls the
repective SetBrush, SetPen, SetBackground etc functions
- to set up the DC. SetBackground call m_owner->SetBackground
+ to set up the DC. SetBackground call m_window->SetBackground
and this might not be desired as the standard dc background
is white whereas a window might assume gray to be the
standard (as e.g. wxStatusBar) */
- m_owner = window;
+ m_window = window;
}
-wxWindowDC::~wxWindowDC()
+wxWindowDCImpl::~wxWindowDCImpl()
{
Destroy();
}
-void wxWindowDC::SetUpDC()
+void wxWindowDCImpl::Init()
+{
+ m_display = NULL;
+ m_penGC = NULL;
+ m_brushGC = NULL;
+ m_textGC = NULL;
+ m_bgGC = NULL;
+ m_cmap = NULL;
+ m_isMemDC = false;
+ m_isScreenDC = false;
+ m_x11window = NULL;
+
+#if wxUSE_UNICODE
+ m_context = wxTheApp->GetPangoContext();
+ m_fontdesc = NULL;
+#endif
+}
+
+void wxWindowDCImpl::SetUpDC()
{
m_ok = true;
wxASSERT_MSG( !m_penGC, wxT("GCs already created") );
+ bool ismono = false;
+ if (m_isMemDC)
+ {
+ wxMemoryDCImpl *mem_impl = (wxMemoryDCImpl *) this;
+ if (mem_impl->GetSelectedBitmap().IsOk())
+ ismono = mem_impl->GetSelectedBitmap().GetDepth() == 1;
+ }
+
if (m_isScreenDC)
{
- m_penGC = (WXGC*) wxGetPoolGC( (Window) m_window, wxPEN_SCREEN );
- m_brushGC = (WXGC*) wxGetPoolGC( (Window) m_window, wxBRUSH_SCREEN );
- m_textGC = (WXGC*) wxGetPoolGC( (Window) m_window, wxTEXT_SCREEN );
- m_bgGC = (WXGC*) wxGetPoolGC( (Window) m_window, wxBG_SCREEN );
+ m_penGC = (WXGC*) wxGetPoolGC( (Window) m_x11window, wxPEN_SCREEN );
+ m_brushGC = (WXGC*) wxGetPoolGC( (Window) m_x11window, wxBRUSH_SCREEN );
+ m_textGC = (WXGC*) wxGetPoolGC( (Window) m_x11window, wxTEXT_SCREEN );
+ m_bgGC = (WXGC*) wxGetPoolGC( (Window) m_x11window, wxBG_SCREEN );
}
else
- if (m_isMemDC && (((wxMemoryDC*)this)->m_selected.GetDepth() == 1))
+ if (m_isMemDC && ismono)
{
- m_penGC = (WXGC*) wxGetPoolGC( (Window) m_window, wxPEN_MONO );
- m_brushGC = (WXGC*) wxGetPoolGC( (Window) m_window, wxBRUSH_MONO );
- m_textGC = (WXGC*) wxGetPoolGC( (Window) m_window, wxTEXT_MONO );
- m_bgGC = (WXGC*) wxGetPoolGC( (Window) m_window, wxBG_MONO );
+ m_penGC = (WXGC*) wxGetPoolGC( (Window) m_x11window, wxPEN_MONO );
+ m_brushGC = (WXGC*) wxGetPoolGC( (Window) m_x11window, wxBRUSH_MONO );
+ m_textGC = (WXGC*) wxGetPoolGC( (Window) m_x11window, wxTEXT_MONO );
+ m_bgGC = (WXGC*) wxGetPoolGC( (Window) m_x11window, wxBG_MONO );
}
else
{
- m_penGC = (WXGC*) wxGetPoolGC( (Window) m_window, wxPEN_COLOUR );
- m_brushGC = (WXGC*) wxGetPoolGC( (Window) m_window, wxBRUSH_COLOUR );
- m_textGC = (WXGC*) wxGetPoolGC( (Window) m_window, wxTEXT_COLOUR );
- m_bgGC = (WXGC*) wxGetPoolGC( (Window) m_window, wxBG_COLOUR );
+ m_penGC = (WXGC*) wxGetPoolGC( (Window) m_x11window, wxPEN_COLOUR );
+ m_brushGC = (WXGC*) wxGetPoolGC( (Window) m_x11window, wxBRUSH_COLOUR );
+ m_textGC = (WXGC*) wxGetPoolGC( (Window) m_x11window, wxTEXT_COLOUR );
+ m_bgGC = (WXGC*) wxGetPoolGC( (Window) m_x11window, wxBG_COLOUR );
}
/* background colour */
}
}
-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") );
+ wxCHECK_RET( m_window, wxT("GetSize() doesn't work without window") );
- m_owner->GetSize(width, height);
+ m_window->GetSize(width, height);
}
extern bool wxDoFloodFill(wxDC *dc, wxCoord x, wxCoord y,
- const wxColour & col, int style);
+ const wxColour & col, wxFloodFillStyle style);
-bool wxWindowDC::DoFloodFill(wxCoord x, wxCoord y,
- const wxColour& col, int style)
+bool wxWindowDCImpl::DoFloodFill(wxCoord x, wxCoord y,
+ const wxColour& col, wxFloodFillStyle 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());
col->Set(image.GetRed(0, 0), image.GetGreen(0, 0), image.GetBlue(0, 0));
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)
{
- if (m_window)
+ if (m_x11window)
{
// This hack is for the iPaq: XDrawLine draws
// nothing, whereas XDrawLines works...
points[0].y = y1;
points[1].x = x2;
points[1].y = y2;
- DrawLines( 2, points, 0, 0 );
+ DoDrawLines( 2, points, 0, 0 );
- // XDrawLine( (Display*) m_display, (Window) m_window,
+ // XDrawLine( (Display*) m_display, (Window) m_x11window,
// (GC) m_penGC, XLOG2DEV(x1), YLOG2DEV(y1), XLOG2DEV(x2), YLOG2DEV(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)
{
int w = 0;
int h = 0;
- GetSize( &w, &h );
+ DoGetSize( &w, &h );
wxCoord xx = XLOG2DEV(x);
wxCoord yy = YLOG2DEV(y);
- if (m_window)
+ if (m_x11window)
{
- XDrawLine( (Display*) m_display, (Window) m_window,
+ XDrawLine( (Display*) m_display, (Window) m_x11window,
(GC) m_penGC, 0, yy, XLOG2DEVREL(w), yy );
- XDrawLine( (Display*) m_display, (Window) m_window,
+ XDrawLine( (Display*) m_display, (Window) m_x11window,
(GC) m_penGC, xx, 0, xx, YLOG2DEVREL(h) );
}
}
}
-void wxWindowDC::DoDrawArc( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2, wxCoord xc, wxCoord yc )
+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);
while (alpha2 <= 0) alpha2 += 360*64;
while (alpha1 > 360*64) alpha1 -= 360*64;
- if (m_window)
+ if (m_x11window)
{
if (m_brush.GetStyle() != wxTRANSPARENT)
{
m_deviceOriginX % m_brush.GetStipple()->GetWidth(),
m_deviceOriginY % m_brush.GetStipple()->GetHeight() );
- XFillArc( (Display*) m_display, (Window) m_window,
+ XFillArc( (Display*) m_display, (Window) m_x11window,
(GC) m_brushGC, xxc-r, yyc-r, 2*r,2*r, alpha1, alpha2 );
XSetTSOrigin( (Display*) m_display, (GC) m_textGC, 0, 0 );
XSetTSOrigin( (Display*) m_display, (GC) m_brushGC,
m_deviceOriginX % 15, m_deviceOriginY % 15 );
- XFillArc( (Display*) m_display, (Window) m_window,
+ XFillArc( (Display*) m_display, (Window) m_x11window,
(GC) m_brushGC, xxc-r, yyc-r, 2*r,2*r, alpha1, alpha2 );
XSetTSOrigin( (Display*) m_display, (GC) m_brushGC, 0, 0 );
XSetTSOrigin( (Display*) m_display, (GC) m_brushGC,
m_deviceOriginX % 16, m_deviceOriginY % 16 );
- XFillArc( (Display*) m_display, (Window) m_window,
+ XFillArc( (Display*) m_display, (Window) m_x11window,
(GC) m_brushGC, xxc-r, yyc-r, 2*r,2*r, alpha1, alpha2 );
XSetTSOrigin( (Display*) m_display, (GC) m_brushGC, 0, 0 );
m_deviceOriginX % m_brush.GetStipple()->GetWidth(),
m_deviceOriginY % m_brush.GetStipple()->GetHeight() );
- XFillArc( (Display*) m_display, (Window) m_window,
+ XFillArc( (Display*) m_display, (Window) m_x11window,
(GC) m_brushGC, xxc-r, yyc-r, 2*r,2*r, alpha1, alpha2 );
XSetTSOrigin( (Display*) m_display, (GC) m_brushGC, 0, 0 );
}
else
{
- XFillArc( (Display*) m_display, (Window) m_window,
+ XFillArc( (Display*) m_display, (Window) m_x11window,
(GC) m_brushGC, xxc-r, yyc-r, 2*r,2*r, alpha1, alpha2 );
}
}
if (m_pen.GetStyle() != wxTRANSPARENT)
{
- XDrawArc( (Display*) m_display, (Window) m_window,
+ XDrawArc( (Display*) m_display, (Window) m_x11window,
(GC) m_penGC, xxc-r, yyc-r, 2*r,2*r, alpha1, alpha2 );
- XDrawLine( (Display*) m_display, (Window) m_window,
+ XDrawLine( (Display*) m_display, (Window) m_x11window,
(GC) m_penGC, xx1, yy1, xxc, yyc );
- XDrawLine( (Display*) m_display, (Window) m_window,
+ XDrawLine( (Display*) m_display, (Window) m_x11window,
(GC) m_penGC, xxc, yyc, xx2, yy2 );
}
}
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);
if (ww < 0) { ww = -ww; xx = xx - ww; }
if (hh < 0) { hh = -hh; yy = yy - hh; }
- if (m_window)
+ if (m_x11window)
{
wxCoord start = wxCoord(sa * 64.0);
wxCoord end = wxCoord((ea-sa) * 64.0);
m_deviceOriginX % m_brush.GetStipple()->GetWidth(),
m_deviceOriginY % m_brush.GetStipple()->GetHeight() );
- XFillArc( (Display*) m_display, (Window) m_window,
+ XFillArc( (Display*) m_display, (Window) m_x11window,
(GC) m_textGC, xx, yy, ww, hh, start, end );
XSetTSOrigin( (Display*) m_display, (GC) m_textGC, 0, 0 );
XSetTSOrigin( (Display*) m_display, (GC) m_brushGC,
m_deviceOriginX % 15, m_deviceOriginY % 15 );
- XFillArc( (Display*) m_display, (Window) m_window,
+ XFillArc( (Display*) m_display, (Window) m_x11window,
(GC) m_brushGC, xx, yy, ww, hh, start, end );
XSetTSOrigin( (Display*) m_display, (GC) m_brushGC, 0, 0 );
XSetTSOrigin( (Display*) m_display, (GC) m_brushGC,
m_deviceOriginX % 16, m_deviceOriginY % 16 );
- XFillArc( (Display*) m_display, (Window) m_window,
+ XFillArc( (Display*) m_display, (Window) m_x11window,
(GC) m_brushGC, xx, yy, ww, hh, start, end );
XSetTSOrigin( (Display*) m_display, (GC) m_brushGC, 0, 0 );
m_deviceOriginX % m_brush.GetStipple()->GetWidth(),
m_deviceOriginY % m_brush.GetStipple()->GetHeight() );
- XFillArc( (Display*) m_display, (Window) m_window,
+ XFillArc( (Display*) m_display, (Window) m_x11window,
(GC) m_brushGC, xx, yy, ww, hh, start, end );
XSetTSOrigin( (Display*) m_display, (GC) m_brushGC, 0, 0 );
}
else
{
- XFillArc( (Display*) m_display, (Window) m_window,
+ XFillArc( (Display*) m_display, (Window) m_x11window,
(GC) m_brushGC, xx, yy, ww, hh, start, end );
}
}
if (m_pen.GetStyle() != wxTRANSPARENT)
{
- XDrawArc( (Display*) m_display, (Window) m_window,
+ XDrawArc( (Display*) m_display, (Window) m_x11window,
(GC) m_penGC, xx, yy, ww, hh, start, end );
}
}
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)
- XDrawPoint( (Display*) m_display, (Window) m_window,
+ if ((m_pen.GetStyle() != wxTRANSPARENT) && m_x11window)
+ XDrawPoint( (Display*) m_display, (Window) m_x11window,
(GC) m_penGC, XLOG2DEV(x), YLOG2DEV(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;
CalcBoundingBox( points[i].x + xoffset, points[i].y + yoffset );
}
- XDrawLines( (Display*) m_display, (Window) m_window, (GC) m_penGC, xpoints, n, 0 );
+ XDrawLines( (Display*) m_display, (Window) m_x11window, (GC) m_penGC, xpoints, n, 0 );
delete[] xpoints;
}
-void wxWindowDC::DoDrawPolygon( int n, wxPoint points[],
- wxCoord xoffset, wxCoord yoffset, int fillStyle )
+void wxWindowDCImpl::DoDrawPolygon( int n, wxPoint points[],
+ wxCoord xoffset, wxCoord yoffset,
+ wxPolygonFillMode WXUNUSED(fillStyle) )
{
- wxCHECK_RET( Ok(), wxT("invalid window dc") );
+ wxCHECK_RET( IsOk(), wxT("invalid window dc") );
if (n <= 0) return;
CalcBoundingBox (points[i].x + xoffset, points[i].y + yoffset);
}
- if (m_window)
+ if (m_x11window)
{
if (m_brush.GetStyle() != wxTRANSPARENT)
{
m_deviceOriginX % m_brush.GetStipple()->GetWidth(),
m_deviceOriginY % m_brush.GetStipple()->GetHeight() );
- XFillPolygon( (Display*) m_display, (Window) m_window,
+ XFillPolygon( (Display*) m_display, (Window) m_x11window,
(GC) m_textGC, xpoints, n, Complex, 0);
XSetTSOrigin( (Display*) m_display, (GC) m_textGC, 0, 0 );
XSetTSOrigin( (Display*) m_display, (GC) m_brushGC,
m_deviceOriginX % 15, m_deviceOriginY % 15 );
- XFillPolygon( (Display*) m_display, (Window) m_window,
+ XFillPolygon( (Display*) m_display, (Window) m_x11window,
(GC) m_brushGC, xpoints, n, Complex, 0);
XSetTSOrigin( (Display*) m_display, (GC) m_brushGC, 0, 0 );
XSetTSOrigin( (Display*) m_display, (GC) m_brushGC,
m_deviceOriginX % 16, m_deviceOriginY % 16 );
- XFillPolygon( (Display*) m_display, (Window) m_window,
+ XFillPolygon( (Display*) m_display, (Window) m_x11window,
(GC) m_brushGC, xpoints, n, Complex, 0);
XSetTSOrigin( (Display*) m_display, (GC) m_brushGC, 0, 0 );
m_deviceOriginX % m_brush.GetStipple()->GetWidth(),
m_deviceOriginY % m_brush.GetStipple()->GetHeight() );
- XFillPolygon( (Display*) m_display, (Window) m_window,
+ XFillPolygon( (Display*) m_display, (Window) m_x11window,
(GC) m_brushGC, xpoints, n, Complex, 0);
XSetTSOrigin( (Display*) m_display, (GC) m_brushGC, 0, 0 );
}
else
{
- XFillPolygon( (Display*) m_display, (Window) m_window,
+ XFillPolygon( (Display*) m_display, (Window) m_x11window,
(GC) m_brushGC, xpoints, n, Complex, 0);
}
}
xpoints[i].x = xpoints[0].x;
xpoints[i].y = xpoints[0].y;
- XDrawLines( (Display*) m_display, (Window) m_window, (GC) m_penGC, xpoints, n + 1, 0);
+ XDrawLines( (Display*) m_display, (Window) m_x11window, (GC) m_penGC, xpoints, n + 1, 0);
}
}
delete[] xpoints;
}
-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);
if (ww < 0) { ww = -ww; xx = xx - ww; }
if (hh < 0) { hh = -hh; yy = yy - hh; }
- if (m_window)
+ if (m_x11window)
{
if (m_brush.GetStyle() != wxTRANSPARENT)
{
m_deviceOriginX % m_brush.GetStipple()->GetWidth(),
m_deviceOriginY % m_brush.GetStipple()->GetHeight() );
- XFillRectangle( (Display*) m_display, (Window) m_window,
+ XFillRectangle( (Display*) m_display, (Window) m_x11window,
(GC) m_textGC, xx, yy, ww, hh );
XSetTSOrigin( (Display*) m_display, (GC) m_textGC, 0, 0 );
XSetTSOrigin( (Display*) m_display, (GC) m_brushGC,
m_deviceOriginX % 15, m_deviceOriginY % 15 );
- XFillRectangle( (Display*) m_display, (Window) m_window,
+ XFillRectangle( (Display*) m_display, (Window) m_x11window,
(GC) m_brushGC, xx, yy, ww, hh );
XSetTSOrigin( (Display*) m_display, (GC) m_brushGC, 0, 0 );
XSetTSOrigin( (Display*) m_display, (GC) m_brushGC,
m_deviceOriginX % 16, m_deviceOriginY % 16 );
- XFillRectangle( (Display*) m_display, (Window) m_window,
+ XFillRectangle( (Display*) m_display, (Window) m_x11window,
(GC) m_brushGC, xx, yy, ww, hh );
XSetTSOrigin( (Display*) m_display, (GC) m_brushGC, 0, 0 );
m_deviceOriginX % m_brush.GetStipple()->GetWidth(),
m_deviceOriginY % m_brush.GetStipple()->GetHeight() );
- XFillRectangle( (Display*) m_display, (Window) m_window,
+ XFillRectangle( (Display*) m_display, (Window) m_x11window,
(GC) m_brushGC, xx, yy, ww, hh );
XSetTSOrigin( (Display*) m_display, (GC) m_brushGC, 0, 0 );
}
else
{
- XFillRectangle( (Display*) m_display, (Window) m_window,
+ XFillRectangle( (Display*) m_display, (Window) m_x11window,
(GC) m_brushGC, xx, yy, ww, hh );
}
}
if (m_pen.GetStyle () != wxTRANSPARENT)
{
- XDrawRectangle( (Display*) m_display, (Window) m_window,
+ XDrawRectangle( (Display*) m_display, (Window) m_x11window,
(GC) m_penGC, xx, yy, ww-1, hh-1 );
}
}
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);
// X drawing errors with small radii
if (rr == 0)
{
- XDrawRectangle( (Display*) m_display, (Window) m_window,
+ XDrawRectangle( (Display*) m_display, (Window) m_x11window,
(GC) m_penGC, x, y, width, height);
return;
}
hh--;
}
- if (m_window)
+ if (m_x11window)
{
// CMB: ensure dd is not larger than rectangle otherwise we
// get an hour glass shape
XSetTSOrigin( (Display*) m_display, (GC) m_textGC,
m_deviceOriginX % m_brush.GetStipple()->GetWidth(),
m_deviceOriginY % m_brush.GetStipple()->GetHeight() );
- XFillRectangle( (Display*) m_display, (Window) m_window, (GC) m_textGC, xx+rr, yy, ww-dd+1, hh );
- XFillRectangle( (Display*) m_display, (Window) m_window, (GC) m_textGC, xx, yy+rr, ww, hh-dd+1 );
- XFillArc( (Display*) m_display, (Window) m_window, (GC) m_textGC, xx, yy, dd, dd, 90*64, 90*64 );
- XFillArc( (Display*) m_display, (Window) m_window, (GC) m_textGC, xx+ww-dd, yy, dd, dd, 0, 90*64 );
- XFillArc( (Display*) m_display, (Window) m_window, (GC) m_textGC, xx+ww-dd, yy+hh-dd, dd, dd, 270*64, 90*64 );
- XFillArc( (Display*) m_display, (Window) m_window, (GC) m_textGC, xx, yy+hh-dd, dd, dd, 180*64, 90*64 );
+ XFillRectangle( (Display*) m_display, (Window) m_x11window, (GC) m_textGC, xx+rr, yy, ww-dd+1, hh );
+ XFillRectangle( (Display*) m_display, (Window) m_x11window, (GC) m_textGC, xx, yy+rr, ww, hh-dd+1 );
+ XFillArc( (Display*) m_display, (Window) m_x11window, (GC) m_textGC, xx, yy, dd, dd, 90*64, 90*64 );
+ XFillArc( (Display*) m_display, (Window) m_x11window, (GC) m_textGC, xx+ww-dd, yy, dd, dd, 0, 90*64 );
+ XFillArc( (Display*) m_display, (Window) m_x11window, (GC) m_textGC, xx+ww-dd, yy+hh-dd, dd, dd, 270*64, 90*64 );
+ XFillArc( (Display*) m_display, (Window) m_x11window, (GC) m_textGC, xx, yy+hh-dd, dd, dd, 180*64, 90*64 );
XSetTSOrigin( (Display*) m_display, (GC) m_textGC, 0, 0);
} else
if (IS_15_PIX_HATCH(m_brush.GetStyle()))
{
XSetTSOrigin( (Display*) m_display, (GC) m_brushGC, m_deviceOriginX % 15, m_deviceOriginY % 15 );
- XFillRectangle( (Display*) m_display, (Window) m_window, (GC) m_brushGC, xx+rr, yy, ww-dd+1, hh );
- XFillRectangle( (Display*) m_display, (Window) m_window, (GC) m_brushGC, xx, yy+rr, ww, hh-dd+1 );
- XFillArc( (Display*) m_display, (Window) m_window, (GC) m_brushGC, xx, yy, dd, dd, 90*64, 90*64 );
- XFillArc( (Display*) m_display, (Window) m_window, (GC) m_brushGC, xx+ww-dd, yy, dd, dd, 0, 90*64 );
- XFillArc( (Display*) m_display, (Window) m_window, (GC) m_brushGC, xx+ww-dd, yy+hh-dd, dd, dd, 270*64, 90*64 );
- XFillArc( (Display*) m_display, (Window) m_window, (GC) m_brushGC, xx, yy+hh-dd, dd, dd, 180*64, 90*64 );
+ XFillRectangle( (Display*) m_display, (Window) m_x11window, (GC) m_brushGC, xx+rr, yy, ww-dd+1, hh );
+ XFillRectangle( (Display*) m_display, (Window) m_x11window, (GC) m_brushGC, xx, yy+rr, ww, hh-dd+1 );
+ XFillArc( (Display*) m_display, (Window) m_x11window, (GC) m_brushGC, xx, yy, dd, dd, 90*64, 90*64 );
+ XFillArc( (Display*) m_display, (Window) m_x11window, (GC) m_brushGC, xx+ww-dd, yy, dd, dd, 0, 90*64 );
+ XFillArc( (Display*) m_display, (Window) m_x11window, (GC) m_brushGC, xx+ww-dd, yy+hh-dd, dd, dd, 270*64, 90*64 );
+ XFillArc( (Display*) m_display, (Window) m_x11window, (GC) m_brushGC, xx, yy+hh-dd, dd, dd, 180*64, 90*64 );
XSetTSOrigin( (Display*) m_display, (GC) m_brushGC, 0, 0);
} else
if (IS_16_PIX_HATCH(m_brush.GetStyle()))
{
XSetTSOrigin( (Display*) m_display, (GC) m_brushGC, m_deviceOriginX % 16, m_deviceOriginY % 16 );
- XFillRectangle( (Display*) m_display, (Window) m_window, (GC) m_brushGC, xx+rr, yy, ww-dd+1, hh );
- XFillRectangle( (Display*) m_display, (Window) m_window, (GC) m_brushGC, xx, yy+rr, ww, hh-dd+1 );
- XFillArc( (Display*) m_display, (Window) m_window, (GC) m_brushGC, xx, yy, dd, dd, 90*64, 90*64 );
- XFillArc( (Display*) m_display, (Window) m_window, (GC) m_brushGC, xx+ww-dd, yy, dd, dd, 0, 90*64 );
- XFillArc( (Display*) m_display, (Window) m_window, (GC) m_brushGC, xx+ww-dd, yy+hh-dd, dd, dd, 270*64, 90*64 );
- XFillArc( (Display*) m_display, (Window) m_window, (GC) m_brushGC, xx, yy+hh-dd, dd, dd, 180*64, 90*64 );
+ XFillRectangle( (Display*) m_display, (Window) m_x11window, (GC) m_brushGC, xx+rr, yy, ww-dd+1, hh );
+ XFillRectangle( (Display*) m_display, (Window) m_x11window, (GC) m_brushGC, xx, yy+rr, ww, hh-dd+1 );
+ XFillArc( (Display*) m_display, (Window) m_x11window, (GC) m_brushGC, xx, yy, dd, dd, 90*64, 90*64 );
+ XFillArc( (Display*) m_display, (Window) m_x11window, (GC) m_brushGC, xx+ww-dd, yy, dd, dd, 0, 90*64 );
+ XFillArc( (Display*) m_display, (Window) m_x11window, (GC) m_brushGC, xx+ww-dd, yy+hh-dd, dd, dd, 270*64, 90*64 );
+ XFillArc( (Display*) m_display, (Window) m_x11window, (GC) m_brushGC, xx, yy+hh-dd, dd, dd, 180*64, 90*64 );
XSetTSOrigin( (Display*) m_display, (GC) m_brushGC, 0, 0);
} else
if (m_brush.GetStyle() == wxSTIPPLE)
XSetTSOrigin( (Display*) m_display, (GC) m_brushGC,
m_deviceOriginX % m_brush.GetStipple()->GetWidth(),
m_deviceOriginY % m_brush.GetStipple()->GetHeight() );
- XFillRectangle( (Display*) m_display, (Window) m_window, (GC) m_brushGC, xx+rr, yy, ww-dd+1, hh );
- XFillRectangle( (Display*) m_display, (Window) m_window, (GC) m_brushGC, xx, yy+rr, ww, hh-dd+1 );
- XFillArc( (Display*) m_display, (Window) m_window, (GC) m_brushGC, xx, yy, dd, dd, 90*64, 90*64 );
- XFillArc( (Display*) m_display, (Window) m_window, (GC) m_brushGC, xx+ww-dd, yy, dd, dd, 0, 90*64 );
- XFillArc( (Display*) m_display, (Window) m_window, (GC) m_brushGC, xx+ww-dd, yy+hh-dd, dd, dd, 270*64, 90*64 );
- XFillArc( (Display*) m_display, (Window) m_window, (GC) m_brushGC, xx, yy+hh-dd, dd, dd, 180*64, 90*64 );
+ XFillRectangle( (Display*) m_display, (Window) m_x11window, (GC) m_brushGC, xx+rr, yy, ww-dd+1, hh );
+ XFillRectangle( (Display*) m_display, (Window) m_x11window, (GC) m_brushGC, xx, yy+rr, ww, hh-dd+1 );
+ XFillArc( (Display*) m_display, (Window) m_x11window, (GC) m_brushGC, xx, yy, dd, dd, 90*64, 90*64 );
+ XFillArc( (Display*) m_display, (Window) m_x11window, (GC) m_brushGC, xx+ww-dd, yy, dd, dd, 0, 90*64 );
+ XFillArc( (Display*) m_display, (Window) m_x11window, (GC) m_brushGC, xx+ww-dd, yy+hh-dd, dd, dd, 270*64, 90*64 );
+ XFillArc( (Display*) m_display, (Window) m_x11window, (GC) m_brushGC, xx, yy+hh-dd, dd, dd, 180*64, 90*64 );
XSetTSOrigin( (Display*) m_display, (GC) m_brushGC, 0, 0);
}
else
{
- XFillRectangle( (Display*) m_display, (Window) m_window, (GC) m_brushGC, xx+rr, yy, ww-dd+1, hh );
- XFillRectangle( (Display*) m_display, (Window) m_window, (GC) m_brushGC, xx, yy+rr, ww, hh-dd+1 );
- XFillArc( (Display*) m_display, (Window) m_window, (GC) m_brushGC, xx, yy, dd, dd, 90*64, 90*64 );
- XFillArc( (Display*) m_display, (Window) m_window, (GC) m_brushGC, xx+ww-dd, yy, dd, dd, 0, 90*64 );
- XFillArc( (Display*) m_display, (Window) m_window, (GC) m_brushGC, xx+ww-dd, yy+hh-dd, dd, dd, 270*64, 90*64 );
- XFillArc( (Display*) m_display, (Window) m_window, (GC) m_brushGC, xx, yy+hh-dd, dd, dd, 180*64, 90*64 );
+ XFillRectangle( (Display*) m_display, (Window) m_x11window, (GC) m_brushGC, xx+rr, yy, ww-dd+1, hh );
+ XFillRectangle( (Display*) m_display, (Window) m_x11window, (GC) m_brushGC, xx, yy+rr, ww, hh-dd+1 );
+ XFillArc( (Display*) m_display, (Window) m_x11window, (GC) m_brushGC, xx, yy, dd, dd, 90*64, 90*64 );
+ XFillArc( (Display*) m_display, (Window) m_x11window, (GC) m_brushGC, xx+ww-dd, yy, dd, dd, 0, 90*64 );
+ XFillArc( (Display*) m_display, (Window) m_x11window, (GC) m_brushGC, xx+ww-dd, yy+hh-dd, dd, dd, 270*64, 90*64 );
+ XFillArc( (Display*) m_display, (Window) m_x11window, (GC) m_brushGC, xx, yy+hh-dd, dd, dd, 180*64, 90*64 );
}
}
if (m_pen.GetStyle() != wxTRANSPARENT)
{
- XDrawLine( (Display*) m_display, (Window) m_window, (GC) m_penGC, xx+rr+1, yy, xx+ww-rr, yy );
- XDrawLine( (Display*) m_display, (Window) m_window, (GC) m_penGC, xx+rr+1, yy+hh, xx+ww-rr, yy+hh );
- XDrawLine( (Display*) m_display, (Window) m_window, (GC) m_penGC, xx, yy+rr+1, xx, yy+hh-rr );
- XDrawLine( (Display*) m_display, (Window) m_window, (GC) m_penGC, xx+ww, yy+rr+1, xx+ww, yy+hh-rr );
- XDrawArc( (Display*) m_display, (Window) m_window, (GC) m_penGC, xx, yy, dd, dd, 90*64, 90*64 );
- XDrawArc( (Display*) m_display, (Window) m_window, (GC) m_penGC, xx+ww-dd, yy, dd, dd, 0, 90*64 );
- XDrawArc( (Display*) m_display, (Window) m_window, (GC) m_penGC, xx+ww-dd, yy+hh-dd, dd, dd, 270*64, 90*64 );
- XDrawArc( (Display*) m_display, (Window) m_window, (GC) m_penGC, xx, yy+hh-dd, dd, dd, 180*64, 90*64 );
+ XDrawLine( (Display*) m_display, (Window) m_x11window, (GC) m_penGC, xx+rr+1, yy, xx+ww-rr, yy );
+ XDrawLine( (Display*) m_display, (Window) m_x11window, (GC) m_penGC, xx+rr+1, yy+hh, xx+ww-rr, yy+hh );
+ XDrawLine( (Display*) m_display, (Window) m_x11window, (GC) m_penGC, xx, yy+rr+1, xx, yy+hh-rr );
+ XDrawLine( (Display*) m_display, (Window) m_x11window, (GC) m_penGC, xx+ww, yy+rr+1, xx+ww, yy+hh-rr );
+ XDrawArc( (Display*) m_display, (Window) m_x11window, (GC) m_penGC, xx, yy, dd, dd, 90*64, 90*64 );
+ XDrawArc( (Display*) m_display, (Window) m_x11window, (GC) m_penGC, xx+ww-dd, yy, dd, dd, 0, 90*64 );
+ XDrawArc( (Display*) m_display, (Window) m_x11window, (GC) m_penGC, xx+ww-dd, yy+hh-dd, dd, dd, 270*64, 90*64 );
+ XDrawArc( (Display*) m_display, (Window) m_x11window, (GC) m_penGC, xx, yy+hh-dd, dd, dd, 180*64, 90*64 );
}
}
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);
if (ww < 0) { ww = -ww; xx = xx - ww; }
if (hh < 0) { hh = -hh; yy = yy - hh; }
- if (m_window)
+ if (m_x11window)
{
if (m_brush.GetStyle() != wxTRANSPARENT)
{
m_deviceOriginX % m_brush.GetStipple()->GetWidth(),
m_deviceOriginY % m_brush.GetStipple()->GetHeight() );
- XFillArc( (Display*) m_display, (Window) m_window,
+ XFillArc( (Display*) m_display, (Window) m_x11window,
(GC) m_textGC, xx, yy, ww, hh, 0, 360*64 );
XSetTSOrigin( (Display*) m_display, (GC) m_textGC, 0, 0 );
XSetTSOrigin( (Display*) m_display, (GC) m_brushGC,
m_deviceOriginX % 15, m_deviceOriginY % 15 );
- XFillArc( (Display*) m_display, (Window) m_window,
+ XFillArc( (Display*) m_display, (Window) m_x11window,
(GC) m_brushGC, xx, yy, ww, hh, 0, 360*64 );
XSetTSOrigin( (Display*) m_display, (GC) m_brushGC, 0, 0 );
XSetTSOrigin( (Display*) m_display, (GC) m_brushGC,
m_deviceOriginX % 16, m_deviceOriginY % 16 );
- XFillArc( (Display*) m_display, (Window) m_window,
+ XFillArc( (Display*) m_display, (Window) m_x11window,
(GC) m_brushGC, xx, yy, ww, hh, 0, 360*64 );
XSetTSOrigin( (Display*) m_display, (GC) m_brushGC, 0, 0 );
m_deviceOriginX % m_brush.GetStipple()->GetWidth(),
m_deviceOriginY % m_brush.GetStipple()->GetHeight() );
- XFillArc( (Display*) m_display, (Window) m_window,
+ XFillArc( (Display*) m_display, (Window) m_x11window,
(GC) m_brushGC, xx, yy, ww, hh, 0, 360*64 );
XSetTSOrigin( (Display*) m_display, (GC) m_brushGC, 0, 0 );
}
else
{
- XFillArc( (Display*) m_display, (Window) m_window,
+ XFillArc( (Display*) m_display, (Window) m_x11window,
(GC) m_brushGC, xx, yy, ww, hh, 0, 360*64 );
}
}
if (m_pen.GetStyle () != wxTRANSPARENT)
{
- XDrawArc( (Display*) m_display, (Window) m_window,
+ XDrawArc( (Display*) m_display, (Window) m_x11window,
(GC) m_penGC, xx, yy, ww, hh, 0, 360*64 );
}
}
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)
{
DoDrawBitmap(icon, x, y, true);
}
#if wxUSE_NANOX
-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") );
+ wxCHECK_RET( bitmap.IsOk(), wxT("invalid bitmap") );
bool is_mono = (bitmap.GetBitmap() != NULL);
CalcBoundingBox( x, y );
CalcBoundingBox( x + w, y + h );
- if (!m_window) return;
+ if (!m_x11window) return;
int ww = XLOG2DEVREL(w);
int hh = YLOG2DEVREL(h);
// In DoBlit, we may be able to eliminate this step
// if we check if the rop = copy
#if 0
- GrCopyArea(bufPixmap, gc, 0, 0, w, h, (Window) m_window,
+ GrCopyArea(bufPixmap, gc, 0, 0, w, h, (Window) m_x11window,
0, 0, GR_MODE_COPY);
#endif
// set unmasked area in dest to BLACK
GrSetGCBackground(gc, BLACK);
GrSetGCForeground(gc, WHITE);
- GrCopyArea((Window) m_window, gc, xx, yy, w, h, maskPixmap,
+ GrCopyArea((Window) m_x11window, gc, xx, yy, w, h, maskPixmap,
0, 0, GR_MODE_AND);
// OR buffer to dest
- GrCopyArea((Window) m_window, gc, xx, yy, w, h, bufPixmap,
+ GrCopyArea((Window) m_x11window, gc, xx, yy, w, h, bufPixmap,
0, 0, GR_MODE_OR);
GrDestroyGC(gc);
GrDestroyWindow(bufPixmap);
}
else
- XCopyArea( (Display*) m_display, (Pixmap) use_bitmap.GetPixmap(), (Window) m_window,
+ XCopyArea( (Display*) m_display, (Pixmap) use_bitmap.GetPixmap(), (Window) m_x11window,
(GC) m_penGC, 0, 0, w, h, xx, yy );
/* remove mask again if any */
#else
// Normal X11
-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") );
+ wxCHECK_RET( bitmap.IsOk(), wxT("invalid bitmap") );
bool is_mono = (bitmap.GetBitmap() != NULL);
CalcBoundingBox( x, y );
CalcBoundingBox( x + w, y + h );
- if (!m_window) return;
+ if (!m_x11window) return;
int ww = XLOG2DEVREL(w);
int hh = YLOG2DEVREL(h);
XSetStipple( xdisplay, gc, (Pixmap) mask);
}
- wxCoord clip_x, clip_y, clip_w, clip_h;
- m_currentClippingRegion.GetBox(clip_x, clip_y, clip_w, clip_h);
- XFillRectangle( xdisplay, new_pixmap, gc, clip_x-xx, clip_y-yy, clip_w, clip_h );
+ wxVector<XRectangle> rects;
+ for ( wxRegionIterator iter(m_currentClippingRegion);
+ iter;
+ ++iter )
+ {
+ XRectangle rect;
+ rect.x = iter.GetX() - xx;
+ rect.y = iter.GetY() - yy;
+ rect.width = iter.GetWidth();
+ rect.height = iter.GetHeight();
+ rects.push_back(rect);
+ }
+
+ XFillRectangles(xdisplay, new_pixmap, gc, &rects[0], rects.size());
XFreeGC( xdisplay, gc );
}
// Draw XPixmap or XBitmap, depending on what the wxBitmap contains. For
// drawing a mono-bitmap (XBitmap) we use the current text GC
if (is_mono)
- XCopyPlane( (Display*) m_display, (Pixmap) use_bitmap.GetBitmap(), (Window) m_window,
+ XCopyPlane( (Display*) m_display, (Pixmap) use_bitmap.GetBitmap(), (Window) m_x11window,
(GC) m_textGC, 0, 0, ww, hh, xx, yy, 1 );
else
- XCopyArea( (Display*) m_display, (Pixmap) use_bitmap.GetPixmap(), (Window) m_window,
+ XCopyArea( (Display*) m_display, (Pixmap) use_bitmap.GetPixmap(), (Window) m_x11window,
(GC) m_penGC, 0, 0, ww, hh, xx, yy );
// remove mask again if any
#endif
// wxUSE_NANOX/!wxUSE_NANOX
-bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
- wxDC *source, wxCoord xsrc, wxCoord ysrc, int logical_func, bool useMask,
+bool wxWindowDCImpl::DoBlit( wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
+ wxDC *source, wxCoord xsrc, wxCoord ysrc,
+ wxRasterOperationMode logical_func, bool useMask,
wxCoord xsrcMask, wxCoord ysrcMask )
{
/* this is the nth try to get this utterly useless function to
of the source dc, but scales correctly on the target dc and
knows about possible mask information in a memory dc. */
- 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;
+ if (!m_x11window) 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);
wxClientDC *srcDC = (wxClientDC*)source;
wxMemoryDC *memDC = (wxMemoryDC*)source;
+ wxWindowDCImpl *src_impl = (wxWindowDCImpl*) srcDC->GetImpl();
bool use_bitmap_method = false;
bool is_mono = false;
ysrcMask = ysrc;
}
- if (srcDC->m_isMemDC)
+ if (src_impl->m_isMemDC)
{
- if (!memDC->m_selected.Ok()) return false;
+ wxBitmap selected = memDC->GetSelectedBitmap();
+
+ if (!selected.IsOk()) return false;
/* we use the "XCopyArea" way to copy a memory dc into
y different window if the memory dc BOTH
b) it is clipped
c) is not 1-bit */
- if (useMask && (memDC->m_selected.GetMask()))
+ if (useMask && (selected.GetMask()))
{
/* we HAVE TO use the direct way for memory dcs
that have mask since the XCopyArea doesn't know
about masks */
use_bitmap_method = true;
}
- else if (memDC->m_selected.GetDepth() == 1)
+ else if (selected.GetDepth() == 1)
{
/* we HAVE TO use the direct way for memory dcs
that are bitmaps because XCopyArea doesn't cope
use_bitmap_method = true;
}
else if ((xsrc == 0) && (ysrc == 0) &&
- (width == memDC->m_selected.GetWidth()) &&
- (height == memDC->m_selected.GetHeight()))
+ (width == selected.GetWidth()) &&
+ (height == selected.GetHeight()))
{
/* we SHOULD use the direct way if all of the bitmap
in the memory dc is copied in which case XCopyArea
return true;
}
- int old_logical_func = m_logicalFunction;
+ wxRasterOperationMode old_logical_func = m_logicalFunction;
SetLogicalFunction( logical_func );
if (use_bitmap_method)
{
+ wxBitmap selected = memDC->GetSelectedBitmap();
+
// scale/translate bitmap size
- wxCoord bm_width = memDC->m_selected.GetWidth();
- wxCoord bm_height = memDC->m_selected.GetHeight();
+ wxCoord bm_width = selected.GetWidth();
+ wxCoord bm_height = selected.GetHeight();
wxCoord bm_ww = XLOG2DEVREL( bm_width );
wxCoord bm_hh = YLOG2DEVREL( bm_height );
if ((bm_width != bm_ww) || (bm_height != bm_hh))
{
- wxImage image( memDC->m_selected.ConvertToImage() );
+ wxImage image( selected.ConvertToImage() );
image = image.Scale( bm_ww, bm_hh );
#if 0
}
else
{
- use_bitmap = memDC->m_selected;
+ use_bitmap = selected;
}
// apply mask if any
// Draw XPixmap or XBitmap, depending on what the wxBitmap contains. For
// drawing a mono-bitmap (XBitmap) we use the current text GC
-
if (is_mono)
- XCopyPlane( (Display*) m_display, (Pixmap) use_bitmap.GetBitmap(), (Window) m_window,
+ XCopyPlane( (Display*) m_display, (Pixmap) use_bitmap.GetBitmap(), (Window) m_x11window,
(GC) m_textGC, xsrc, ysrc, width, height, xx, yy, 1 );
else
- XCopyArea( (Display*) m_display, (Pixmap) use_bitmap.GetPixmap(), (Window) m_window,
+ XCopyArea( (Display*) m_display, (Pixmap) use_bitmap.GetPixmap(), (Window) m_x11window,
(GC) m_penGC, xsrc, ysrc, width, height, xx, yy );
// remove mask again if any
}
else // use_bitmap_method
{
+ wxDCImpl *impl = srcDC->GetImpl();
+ wxWindowDCImpl *x11_impl = wxDynamicCast(impl, wxWindowDCImpl);
+ if (!x11_impl)
+ {
+ SetLogicalFunction( old_logical_func );
+ return false;
+ }
+
if ((width != ww) || (height != hh))
{
/* Draw source window into a bitmap as we cannot scale
// copy including child window contents
XSetSubwindowMode( (Display*) m_display, (GC) m_penGC, IncludeInferiors );
- XCopyArea( (Display*) m_display, (Window) srcDC->GetWindow(), (Window) bitmap.GetPixmap(),
+ XCopyArea( (Display*) m_display, (Window) x11_impl->GetX11Window(), (Window) bitmap.GetPixmap(),
(GC) m_penGC, xsrc, ysrc, width, height, 0, 0 );
XSetSubwindowMode( (Display*) m_display, (GC) m_penGC, ClipByChildren );
bitmap = image;
// draw scaled bitmap
- XCopyArea( (Display*) m_display, (Window) bitmap.GetPixmap(), (Window) m_window,
+ XCopyArea( (Display*) m_display, (Window) bitmap.GetPixmap(), (Window) m_x11window,
(GC) m_penGC, 0, 0, width, height, xx, yy );
}
else
{
// No scaling and not a memory dc with a mask either
-
// copy including child window contents
XSetSubwindowMode( (Display*) m_display, (GC) m_penGC, IncludeInferiors );
- XCopyArea( (Display*) m_display, (Window) srcDC->GetWindow(), (Window) m_window,
+ XCopyArea( (Display*) m_display, (Window) x11_impl->GetX11Window(), (Window) m_x11window,
(GC) m_penGC, xsrc, ysrc, width, height, xx, yy );
XSetSubwindowMode( (Display*) m_display, (GC) m_penGC, ClipByChildren );
}
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;
+ if (!m_x11window) return;
x = XLOG2DEV(x);
y = YLOG2DEV(y);
wxCoord height = h;
// Draw layout.
- x11_draw_layout( (Drawable) m_window, (GC) m_textGC, x, y, layout, m_textForegroundColour );
+ x11_draw_layout( (Drawable) m_x11window, (GC) m_textGC, x, y, layout, m_textForegroundColour );
g_object_unref( G_OBJECT( layout ) );
// First draw a rectangle representing the text background, if a text
// background is specified
- if (m_textBackgroundColour.Ok () && (m_backgroundMode != wxTRANSPARENT))
+ if (m_textBackgroundColour.IsOk () && (m_backgroundMode != wxTRANSPARENT))
{
// Since X draws from the baseline of the text, must add the text height
int cx = 0;
slen = strlen(text);
XCharStruct overall_return;
- (void)XTextExtents(xfont, (char*) text.c_str(), slen, &direction,
+ (void)XTextExtents(xfont, (const char*) text.c_str(), slen, &direction,
&ascent, &descent, &overall_return);
cx = overall_return.width;
m_textBackgroundColour.CalcPixel(m_cmap);
m_textForegroundColour.CalcPixel(m_cmap);
XSetForeground ((Display*) m_display, (GC) m_textGC, m_textBackgroundColour.GetPixel());
- XFillRectangle( (Display*) m_display, (Window) m_window,
+ XFillRectangle( (Display*) m_display, (Window) m_x11window,
(GC) m_textGC, x, y, cx, cy );
XSetForeground ((Display*) m_display, (GC) m_textGC, m_textForegroundColour.GetPixel());
if (1) // (xfont->min_byte1 == 0) && (xfont->max_byte1 == 0))
#endif
{
- XDrawString( (Display*) m_display, (Window) m_window,
+ XDrawString( (Display*) m_display, (Window) m_x11window,
(GC) m_textGC, x, y + XFontStructGetAscent(xfont), text.c_str(), text.length() );
}
{
wxCoord ul_y = y + XFontStructGetAscent(font);
if (font->descent > 0) ul_y++;
- gdk_draw_line( m_window, m_textGC, x, ul_y, x + width, ul_y);
+ gdk_draw_line( m_x11window, m_textGC, x, ul_y, x + width, ul_y);
}
width = wxCoord(width / m_scaleX);
#endif
}
-void wxWindowDC::DoDrawRotatedText( const wxString &text, wxCoord x, wxCoord y, double angle )
+void wxWindowDCImpl::DoDrawRotatedText(const wxString& WXUNUSED(text),
+ wxCoord WXUNUSED(x), wxCoord WXUNUSED(y),
+ double WXUNUSED(angle))
{
- // later
+ wxFAIL_MSG( "not implemented" );
}
-void wxWindowDC::DoGetTextExtent( const wxString &string, wxCoord *width, wxCoord *height,
+void wxWindowDCImpl::DoGetTextExtent( const wxString &string, wxCoord *width, wxCoord *height,
wxCoord *descent, wxCoord *externalLeading,
- wxFont *font ) const
+ const wxFont *font ) const
{
- wxCHECK_RET( Ok(), wxT("invalid dc") );
+ wxCHECK_RET( IsOk(), wxT("invalid dc") );
if (string.empty())
{
wxFont fontToUse = m_font;
if (font) fontToUse = *font;
- wxCHECK_RET( fontToUse.Ok(), wxT("invalid font") );
+ wxCHECK_RET( fontToUse.IsOk(), wxT("invalid font") );
XFontStruct *xfont = (XFontStruct*) fontToUse.GetFontStruct( m_scaleY, m_display );
int direction, ascent, descent2;
XCharStruct overall;
- XTextExtents( xfont, (char*) string.c_str(), string.length(), &direction,
+ XTextExtents( xfont, (const char*) string.c_str(), string.length(), &direction,
&ascent, &descent2, &overall);
if (width)
#endif
}
-wxCoord wxWindowDC::GetCharWidth() const
+wxCoord wxWindowDCImpl::GetCharWidth() const
{
- wxCHECK_MSG( Ok(), 0, wxT("invalid dc") );
+ wxCHECK_MSG( IsOk(), 0, wxT("invalid dc") );
#if wxUSE_UNICODE
PangoLayout *layout = pango_layout_new( m_context );
return w;
#else
- wxCHECK_MSG( m_font.Ok(), 0, wxT("invalid font") );
+ wxCHECK_MSG( m_font.IsOk(), 0, wxT("invalid font") );
XFontStruct *xfont = (XFontStruct*) m_font.GetFontStruct( m_scaleY, m_display );
#endif
}
-wxCoord wxWindowDC::GetCharHeight() const
+wxCoord wxWindowDCImpl::GetCharHeight() const
{
- wxCHECK_MSG( Ok(), 0, wxT("invalid dc") );
+ wxCHECK_MSG( IsOk(), 0, wxT("invalid dc") );
#if wxUSE_UNICODE
PangoLayout *layout = pango_layout_new( m_context );
return h;
#else
- wxCHECK_MSG( m_font.Ok(), 0, wxT("invalid font") );
+ wxCHECK_MSG( m_font.IsOk(), 0, wxT("invalid font") );
XFontStruct *xfont = (XFontStruct*) m_font.GetFontStruct( m_scaleY, m_display );
#endif
}
-void wxWindowDC::Clear()
+void wxWindowDCImpl::Clear()
{
- wxCHECK_RET( Ok(), wxT("invalid window dc") );
+ wxCHECK_RET( IsOk(), wxT("invalid window dc") );
- if (!m_window) return;
+ if (!m_x11window) return;
/* - we either are a memory dc or have a window as the
owner. anything else shouldn't happen.
much pain to keep the DC's and the window's back-
ground colour in synch. */
- if (m_owner)
+ if (m_window)
{
int width,height;
- m_owner->GetSize( &width, &height );
- XFillRectangle( (Display*) m_display, (Window) m_window, (GC) m_bgGC, 0, 0, width, height );
+ m_window->GetSize( &width, &height );
+ XFillRectangle( (Display*) m_display, (Window) m_x11window, (GC) m_bgGC, 0, 0, width, height );
return;
}
if (m_isMemDC)
{
int width,height;
- GetSize( &width, &height );
- XFillRectangle( (Display*) m_display, (Window) m_window, (GC) m_bgGC, 0, 0, width, height );
+ DoGetSize( &width, &height );
+ XFillRectangle( (Display*) m_display, (Window) m_x11window, (GC) m_bgGC, 0, 0, width, height );
return;
}
}
-void wxWindowDC::SetFont( const wxFont &font )
+void wxWindowDCImpl::SetFont( const wxFont &font )
{
- wxCHECK_RET( Ok(), wxT("invalid dc") );
+ wxCHECK_RET( IsOk(), wxT("invalid dc") );
m_font = font;
- return;
-
#if wxUSE_UNICODE
m_fontdesc = font.GetNativeFontInfo()->description;
#endif
}
-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;
m_pen = pen;
- if (!m_pen.Ok()) return;
+ if (!m_pen.IsOk()) return;
- if (!m_window) return;
+ if (!m_x11window) return;
int width = m_pen.GetWidth();
if (width <= 0)
default:
{
lineStyle = LineSolid;
- req_dash = (wxX11Dash*)NULL;
+ req_dash = NULL;
req_nb_dash = 0;
break;
}
XSetForeground( (Display*) m_display, (GC) m_penGC, m_pen.GetColour().GetPixel() );
}
-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;
m_brush = brush;
- if (!m_brush.Ok()) return;
+ if (!m_brush.IsOk()) return;
- if (!m_window) return;
+ if (!m_x11window) return;
m_brush.GetColour().CalcPixel( m_cmap );
XSetForeground( (Display*) m_display, (GC) m_brushGC, m_brush.GetColour().GetPixel() );
XSetFillStyle( (Display*) m_display, (GC) m_brushGC, FillSolid );
- if ((m_brush.GetStyle() == wxSTIPPLE) && (m_brush.GetStipple()->Ok()))
+ if ((m_brush.GetStyle() == wxSTIPPLE) && (m_brush.GetStipple()->IsOk()))
{
if (m_brush.GetStipple()->GetPixmap())
{
}
}
-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;
m_backgroundBrush = brush;
- if (!m_backgroundBrush.Ok()) return;
+ if (!m_backgroundBrush.IsOk()) return;
- if (!m_window) return;
+ if (!m_x11window) return;
m_backgroundBrush.GetColour().CalcPixel( m_cmap );
XSetBackground( (Display*) m_display, (GC) m_brushGC, m_backgroundBrush.GetColour().GetPixel() );
XSetFillStyle( (Display*) m_display, (GC) m_bgGC, FillSolid );
- if ((m_backgroundBrush.GetStyle() == wxSTIPPLE) && (m_backgroundBrush.GetStipple()->Ok()))
+ if ((m_backgroundBrush.GetStyle() == wxSTIPPLE) && (m_backgroundBrush.GetStipple()->IsOk()))
{
if (m_backgroundBrush.GetStipple()->GetPixmap())
{
}
}
-void wxWindowDC::SetLogicalFunction( int function )
+void wxWindowDCImpl::SetLogicalFunction( wxRasterOperationMode function )
{
- wxCHECK_RET( Ok(), wxT("invalid dc") );
+ wxCHECK_RET( IsOk(), wxT("invalid dc") );
int x_function;
return;
// VZ: shouldn't this be a CHECK?
- if (!m_window)
+ if (!m_x11window)
return;
switch (function)
m_logicalFunction = function;
}
-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
// in a few places)
- if ( !col.Ok() || (m_textForegroundColour == col) )
+ if ( !col.IsOk() || (m_textForegroundColour == col) )
return;
m_textForegroundColour = col;
- if (m_window)
+ if (m_x11window)
{
m_textForegroundColour.CalcPixel( m_cmap );
XSetForeground( (Display*) m_display, (GC) m_textGC, m_textForegroundColour.GetPixel() );
}
}
-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) )
+ if ( !col.IsOk() || (m_textBackgroundColour == col) )
return;
m_textBackgroundColour = col;
- if (m_window)
+ if (m_x11window)
{
m_textBackgroundColour.CalcPixel( m_cmap );
XSetBackground( (Display*) m_display, (GC) m_textGC, m_textBackgroundColour.GetPixel() );
}
}
-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;
GrSetGCUseBackground((GC) m_textGC, mode == wxTRANSPARENT ? FALSE : TRUE);
#endif
- if (!m_window) return;
+ if (!m_x11window) return;
// CMB 21/7/98: fill style of cross-hatch brushes is affected by
// transparent/solid background mode
}
}
-void wxWindowDC::SetPalette( const wxPalette& palette )
+void wxWindowDCImpl::SetPalette( const wxPalette& WXUNUSED(palette) )
{
#if 0
- if (m_window)
+ if (m_x11window)
{
- if (palette.Ok())
+ if (palette.IsOk())
/* Use GetXColormap */
- XSetWindowColormap ((Display*) m_display, (Window) m_window->GetXWindow(),
+ XSetWindowColormap ((Display*) m_display, (Window) m_x11window->GetXWindow(),
(Colormap) palette.GetXColormap());
else
/* Use wxGetMainColormap */
- XSetWindowColormap ((Display*) m_display, (Window) m_window->GetXWindow(),
+ XSetWindowColormap ((Display*) m_display, (Window) m_x11window->GetXWindow(),
(Colormap) wxTheApp->GetMainColormap(m_display));
}
#endif
}
-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;
+ if (!m_x11window) return;
+
+ if (width <= 0)
+ width = 1;
+
+ if (height <= 0)
+ height = 1;
wxRect rect;
rect.x = XLOG2DEV(x);
rect.width = XLOG2DEVREL(width);
rect.height = YLOG2DEVREL(height);
- if (!m_currentClippingRegion.IsNull())
+ if (!m_currentClippingRegion.IsEmpty())
m_currentClippingRegion.Intersect( rect );
else
- m_currentClippingRegion.Union( rect );
+ m_currentClippingRegion = rect;
#if USE_PAINT_REGION
- if (!m_paintClippingRegion.IsNull())
+ if (!m_paintClippingRegion.IsEmpty())
m_currentClippingRegion.Intersect( m_paintClippingRegion );
#endif
wxCoord xx, yy, ww, hh;
m_currentClippingRegion.GetBox( xx, yy, ww, hh );
- wxDC::DoSetClippingRegion( xx, yy, ww, hh );
+ wxX11DCImpl::DoSetClippingRegion( xx, yy, ww, hh );
XSetRegion( (Display*) m_display, (GC) m_penGC, (Region) m_currentClippingRegion.GetX11Region() );
XSetRegion( (Display*) m_display, (GC) m_brushGC, (Region) m_currentClippingRegion.GetX11Region() );
XSetRegion( (Display*) m_display, (GC) m_bgGC, (Region) m_currentClippingRegion.GetX11Region() );
}
-void wxWindowDC::DoSetClippingRegionAsRegion( const wxRegion& region )
+void wxWindowDCImpl::DoSetDeviceClippingRegion( const wxRegion& region )
{
- wxCHECK_RET( Ok(), wxT("invalid window dc") );
+ wxCHECK_RET( IsOk(), wxT("invalid window dc") );
if (region.Empty())
{
return;
}
- if (!m_window) return;
+ if (!m_x11window) return;
- if (!m_currentClippingRegion.IsNull())
+ if (!m_currentClippingRegion.IsEmpty())
m_currentClippingRegion.Intersect( region );
else
- m_currentClippingRegion.Union( region );
+ m_currentClippingRegion = region;
#if USE_PAINT_REGION
- if (!m_paintClippingRegion.IsNull())
+ if (!m_paintClippingRegion.IsEmpty())
m_currentClippingRegion.Intersect( m_paintClippingRegion );
#endif
wxCoord xx, yy, ww, hh;
m_currentClippingRegion.GetBox( xx, yy, ww, hh );
- wxDC::DoSetClippingRegion( xx, yy, ww, hh );
+ wxX11DCImpl::DoSetClippingRegion( xx, yy, ww, hh );
XSetRegion( (Display*) m_display, (GC) m_penGC, (Region) m_currentClippingRegion.GetX11Region() );
XSetRegion( (Display*) m_display, (GC) m_brushGC, (Region) m_currentClippingRegion.GetX11Region() );
XSetRegion( (Display*) m_display, (GC) m_bgGC, (Region) m_currentClippingRegion.GetX11Region() );
}
-void wxWindowDC::DestroyClippingRegion()
+void wxWindowDCImpl::DestroyClippingRegion()
{
- wxCHECK_RET( Ok(), wxT("invalid window dc") );
+ wxCHECK_RET( IsOk(), wxT("invalid window dc") );
- wxDC::DestroyClippingRegion();
+ wxDCImpl::DestroyClippingRegion();
m_currentClippingRegion.Clear();
m_currentClippingRegion.Union( m_paintClippingRegion );
#endif
- if (!m_window) return;
+ if (!m_x11window) return;
if (m_currentClippingRegion.IsEmpty())
{
}
}
-void wxWindowDC::Destroy()
+void wxWindowDCImpl::Destroy()
{
if (m_penGC) wxFreePoolGC( (GC) m_penGC );
m_penGC = NULL;
m_bgGC = NULL;
}
-void wxWindowDC::ComputeScaleAndOrigin()
+void wxWindowDCImpl::ComputeScaleAndOrigin()
{
/* CMB: copy scale to see if it changes */
double origScaleX = m_scaleX;
double origScaleY = m_scaleY;
- wxDC::ComputeScaleAndOrigin();
+ wxDCImpl::ComputeScaleAndOrigin();
/* CMB: if scale has changed call SetPen to recalulate the line width */
if ((m_scaleX != origScaleX || m_scaleY != origScaleY) &&
- (m_pen.Ok()))
+ (m_pen.IsOk()))
{
/* this is a bit artificial, but we need to force wxDC to think
the pen has changed */
}
}
-wxSize wxWindowDC::GetPPI() const
+wxSize wxWindowDCImpl::GetPPI() const
{
return wxSize(100, 100);
}
-int wxWindowDC::GetDepth() const
+int wxWindowDCImpl::GetDepth() const
{
wxFAIL_MSG(wxT("not implemented"));
// wxClientDC
//-----------------------------------------------------------------------------
-IMPLEMENT_DYNAMIC_CLASS(wxClientDC, wxWindowDC)
+IMPLEMENT_ABSTRACT_CLASS(wxClientDCImpl, wxWindowDCImpl)
-wxClientDC::wxClientDC( wxWindow *window )
- : wxWindowDC( window )
+wxClientDCImpl::wxClientDCImpl( wxDC *owner, wxWindow *window )
+ : wxWindowDCImpl( owner, window )
{
- wxCHECK_RET( window, _T("NULL window in wxClientDC::wxClientDC") );
+ wxCHECK_RET( window, wxT("NULL window in wxClientDC::wxClientDC") );
- m_window = (WXWindow*) window->GetClientAreaWindow();
+ m_x11window = (WXWindow*) window->GetClientAreaWindow();
// Adjust the client area when the wxWindow is not using 2 X11 windows.
- if (m_window == (WXWindow*) window->GetMainWindow())
+ if (m_x11window == (WXWindow*) window->GetMainWindow())
{
wxPoint ptOrigin = window->GetClientAreaOrigin();
SetDeviceOrigin(ptOrigin.x, ptOrigin.y);
wxSize size = window->GetClientSize();
- SetClippingRegion(wxPoint(0, 0), size);
+ DoSetClippingRegion( 0, 0, size.x, size.y );
}
}
-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") );
+ wxCHECK_RET( m_window, wxT("GetSize() doesn't work without window") );
- m_owner->GetClientSize( width, height );
+ m_window->GetClientSize( width, height );
}
// ----------------------------------------------------------------------------
// wxPaintDC
// ----------------------------------------------------------------------------
-IMPLEMENT_DYNAMIC_CLASS(wxPaintDC, wxClientDC)
+IMPLEMENT_ABSTRACT_CLASS(wxPaintDCImpl, wxClientDCImpl)
-wxPaintDC::wxPaintDC(wxWindow* window)
- : wxClientDC(window)
+wxPaintDCImpl::wxPaintDCImpl(wxDC *owner, wxWindow* window)
+ : wxClientDCImpl(owner, window)
{
#if USE_PAINT_REGION
if (!window->GetClipPaintRegion())
// display
wxDCModule()
{
- AddDependency(wxClassInfo::FindClass(_T("wxX11DisplayModule")));
+ AddDependency(wxClassInfo::FindClass(wxT("wxX11DisplayModule")));
}
bool OnInit() { wxInitGCPool(); return true; }