fixed wxGTK1 compilation after wxDC changes (still doesn't work)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@50728 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2007-12-15 18:20:59 +00:00
parent 8f884a0dcc
commit 10d302224e
12 changed files with 218 additions and 233 deletions

View File

@@ -10,21 +10,17 @@
#ifndef __GTKDCH__ #ifndef __GTKDCH__
#define __GTKDCH__ #define __GTKDCH__
//----------------------------------------------------------------------------- #include "wx/dc.h"
// classes
//-----------------------------------------------------------------------------
class WXDLLIMPEXP_FWD_CORE wxDC;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// wxDC // wxDC
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxDC : public wxDCBase class WXDLLIMPEXP_CORE wxGTKDCImpl : public wxDCImpl
{ {
public: public:
wxDC(); wxGTKDCImpl(wxDC *owner);
virtual ~wxDC() { } virtual ~wxGTKDCImpl() { }
#if wxUSE_PALETTE #if wxUSE_PALETTE
void SetColourMap( const wxPalette& palette ) { SetPalette(palette); }; void SetColourMap( const wxPalette& palette ) { SetPalette(palette); };

View File

@@ -10,28 +10,28 @@
#ifndef __GTKDCCLIENTH__ #ifndef __GTKDCCLIENTH__
#define __GTKDCCLIENTH__ #define __GTKDCCLIENTH__
#include "wx/dc.h" #include "wx/gtk1/dc.h"
#include "wx/window.h" #include "wx/window.h"
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// classes // classes
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
class WXDLLIMPEXP_FWD_CORE wxWindowDC; class WXDLLIMPEXP_FWD_CORE wxWindowDCImpl;
class WXDLLIMPEXP_FWD_CORE wxPaintDC; class WXDLLIMPEXP_FWD_CORE wxPaintDCImpl;
class WXDLLIMPEXP_FWD_CORE wxClientDC; class WXDLLIMPEXP_FWD_CORE wxClientDCImpl;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// wxWindowDC // wxWindowDCImpl
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxWindowDC : public wxDC class WXDLLIMPEXP_CORE wxWindowDCImpl : public wxGTKDCImpl
{ {
public: public:
wxWindowDC(); wxWindowDCImpl(wxDC *owner);
wxWindowDC( wxWindow *win ); wxWindowDCImpl(wxDC *owner, wxWindow *win);
virtual ~wxWindowDC(); virtual ~wxWindowDCImpl();
virtual bool CanDrawBitmap() const { return true; } virtual bool CanDrawBitmap() const { return true; }
virtual bool CanGetTextExtent() const { return true; } virtual bool CanGetTextExtent() const { return true; }
@@ -124,38 +124,38 @@ public:
GdkWindow *GetWindow() { return m_window; } GdkWindow *GetWindow() { return m_window; }
private: private:
DECLARE_DYNAMIC_CLASS(wxWindowDC) DECLARE_DYNAMIC_CLASS(wxWindowDCImpl)
}; };
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// wxClientDC // wxClientDCImpl
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxClientDC : public wxWindowDC class WXDLLIMPEXP_CORE wxClientDCImpl : public wxWindowDCImpl
{ {
public: public:
wxClientDC() { } wxClientDCImpl(wxDC *owner) : wxWindowDCImpl(owner) { }
wxClientDC( wxWindow *win ); wxClientDCImpl(wxDC *owner, wxWindow *win);
protected: protected:
virtual void DoGetSize(int *width, int *height) const; virtual void DoGetSize(int *width, int *height) const;
private: private:
DECLARE_DYNAMIC_CLASS(wxClientDC) DECLARE_DYNAMIC_CLASS(wxClientDCImpl)
}; };
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// wxPaintDC // wxPaintDCImpl
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxPaintDC : public wxClientDC class WXDLLIMPEXP_CORE wxPaintDCImpl : public wxClientDCImpl
{ {
public: public:
wxPaintDC() { } wxPaintDCImpl(wxDC *owner) : wxClientDCImpl(owner) { }
wxPaintDC( wxWindow *win ); wxPaintDCImpl(wxDC *owner, wxWindow *win);
private: private:
DECLARE_DYNAMIC_CLASS(wxPaintDC) DECLARE_DYNAMIC_CLASS(wxPaintDCImpl)
}; };
#endif // __GTKDCCLIENTH__ #endif // __GTKDCCLIENTH__

View File

@@ -10,27 +10,40 @@
#ifndef __GTKDCMEMORYH__ #ifndef __GTKDCMEMORYH__
#define __GTKDCMEMORYH__ #define __GTKDCMEMORYH__
#include "wx/defs.h" #include "wx/gtk1/dcclient.h"
#include "wx/dcclient.h"
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// classes // classes
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
class WXDLLIMPEXP_FWD_CORE wxMemoryDC; class WXDLLIMPEXP_FWD_CORE wxMemoryDCImpl;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// wxMemoryDC // wxMemoryDCImpl
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxMemoryDC : public wxWindowDC, public wxMemoryDCBase class WXDLLIMPEXP_CORE wxMemoryDCImpl : public wxWindowDCImpl
{ {
public: public:
wxMemoryDC() { Init(); } wxMemoryDCImpl(wxMemoryDC *owner)
wxMemoryDC(wxBitmap& bitmap) { Init(); SelectObject(bitmap); } : wxWindowDCImpl(owner)
wxMemoryDC( wxDC *dc ); // Create compatible DC {
virtual ~wxMemoryDC(); Init();
void DoGetSize( int *width, int *height ) const; }
wxMemoryDCImpl(wxMemoryDC *owner, wxBitmap& bitmap)
: wxWindowDCImpl(owner)
{
Init();
DoSelect(bitmap);
}
wxMemoryDCImpl(wxMemoryDC *owner, wxDC *dc);
virtual ~wxMemoryDCImpl();
virtual void DoSelect(const wxBitmap& bitmap);
virtual void DoGetSize( int *width, int *height ) const;
// these get reimplemented for mono-bitmaps to behave // these get reimplemented for mono-bitmaps to behave
// more like their Win32 couterparts. They now interpret // more like their Win32 couterparts. They now interpret
@@ -45,15 +58,11 @@ public:
// implementation // implementation
wxBitmap m_selected; wxBitmap m_selected;
protected:
virtual void DoSelect(const wxBitmap& bitmap);
private: private:
void Init(); void Init();
DECLARE_DYNAMIC_CLASS(wxMemoryDC) DECLARE_DYNAMIC_CLASS(wxMemoryDCImpl)
}; };
#endif #endif // __GTKDCMEMORYH__
// __GTKDCMEMORYH__

View File

@@ -10,27 +10,17 @@
#ifndef __GTKDCSCREENH__ #ifndef __GTKDCSCREENH__
#define __GTKDCSCREENH__ #define __GTKDCSCREENH__
#include "wx/dcclient.h" #include "wx/gtk1/dcclient.h"
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// classes // wxScreenDCImpl
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
class WXDLLIMPEXP_FWD_CORE wxScreenDC; class WXDLLIMPEXP_CORE wxScreenDCImpl : public wxPaintDCImpl
//-----------------------------------------------------------------------------
// wxScreenDC
//-----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxScreenDC : public wxPaintDC
{ {
public: public:
wxScreenDC(); wxScreenDCImpl(wxScreenDC *owner);
virtual ~wxScreenDC(); virtual ~wxScreenDCImpl();
static bool StartDrawingOnTop( wxWindow *window );
static bool StartDrawingOnTop( wxRect *rect = (wxRect *) NULL );
static bool EndDrawingOnTop();
// implementation // implementation
@@ -42,10 +32,8 @@ protected:
virtual void DoGetSize(int *width, int *height) const; virtual void DoGetSize(int *width, int *height) const;
private: private:
DECLARE_DYNAMIC_CLASS(wxScreenDC) DECLARE_DYNAMIC_CLASS(wxScreenDCImpl)
}; };
#endif #endif // __GTKDCSCREENH__
// __GTKDCSCREENH__

View File

@@ -42,10 +42,14 @@
#include "wx/msw/dcscreen.h" #include "wx/msw/dcscreen.h"
#endif #endif
#ifdef __WXGTK__ #ifdef __WXGTK20__
#include "wx/gtk/dcclient.h" #include "wx/gtk/dcclient.h"
#include "wx/gtk/dcmemory.h" #include "wx/gtk/dcmemory.h"
#include "wx/gtk/dcscreen.h" #include "wx/gtk/dcscreen.h"
#elif defined(__WXGTK__)
#include "wx/gtk1/dcclient.h"
#include "wx/gtk1/dcmemory.h"
#include "wx/gtk1/dcscreen.h"
#endif #endif
#ifdef __WXMAC__ #ifdef __WXMAC__

View File

@@ -10,18 +10,19 @@
// For compilers that support precompilation, includes "wx.h". // For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h" #include "wx/wxprec.h"
#include "wx/dc.h" #include "wx/gtk1/dc.h"
#include <gdk/gdk.h> #include <gdk/gdk.h>
#include <gtk/gtk.h> #include <gtk/gtk.h>
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// wxDC // wxGTKDCImpl
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
IMPLEMENT_ABSTRACT_CLASS(wxDC, wxDCBase) IMPLEMENT_ABSTRACT_CLASS(wxGTKDCImpl, wxDCImpl)
wxDC::wxDC() wxGTKDCImpl::wxGTKDCImpl(wxDC *owner)
: wxDCImpl(owner)
{ {
m_ok = FALSE; m_ok = FALSE;
@@ -32,7 +33,7 @@ wxDC::wxDC()
m_brush = *wxWHITE_BRUSH; m_brush = *wxWHITE_BRUSH;
} }
void wxDC::DoSetClippingRegion( wxCoord x, wxCoord y, wxCoord width, wxCoord height ) void wxGTKDCImpl::DoSetClippingRegion( wxCoord x, wxCoord y, wxCoord width, wxCoord height )
{ {
m_clipping = TRUE; m_clipping = TRUE;
m_clipX1 = x; m_clipX1 = x;
@@ -45,7 +46,7 @@ void wxDC::DoSetClippingRegion( wxCoord x, wxCoord y, wxCoord width, wxCoord hei
// get DC capabilities // get DC capabilities
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
void wxDC::DoGetSizeMM( int* width, int* height ) const void wxGTKDCImpl::DoGetSizeMM( int* width, int* height ) const
{ {
int w = 0; int w = 0;
int h = 0; int h = 0;
@@ -55,7 +56,7 @@ void wxDC::DoGetSizeMM( int* width, int* height ) const
} }
// Resolution in pixels per logical inch // Resolution in pixels per logical inch
wxSize wxDC::GetPPI() const wxSize wxGTKDCImpl::GetPPI() const
{ {
// TODO (should probably be pure virtual) // TODO (should probably be pure virtual)
return wxSize(0, 0); return wxSize(0, 0);

View File

@@ -14,11 +14,8 @@
#define XCopyPlane XCOPYPLANE #define XCopyPlane XCOPYPLANE
#endif #endif
#include "wx/dcclient.h"
#ifndef WX_PRECOMP #ifndef WX_PRECOMP
#include "wx/log.h" #include "wx/log.h"
#include "wx/dcmemory.h"
#include "wx/math.h" // for floating-point functions #include "wx/math.h" // for floating-point functions
#include "wx/image.h" #include "wx/image.h"
#include "wx/module.h" #include "wx/module.h"
@@ -27,6 +24,8 @@
#include "wx/fontutil.h" #include "wx/fontutil.h"
#include "wx/gtk1/win_gtk.h" #include "wx/gtk1/win_gtk.h"
#include "wx/gtk1/dcclient.h"
#include "wx/gtk1/dcmemory.h"
#include <gdk/gdk.h> #include <gdk/gdk.h>
#include <gdk/gdkx.h> #include <gdk/gdkx.h>
@@ -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_penGC = (GdkGC *) NULL;
m_brushGC = (GdkGC *) NULL; m_brushGC = (GdkGC *) NULL;
@@ -277,7 +277,8 @@ wxWindowDC::wxWindowDC()
m_owner = (wxWindow *)NULL; m_owner = (wxWindow *)NULL;
} }
wxWindowDC::wxWindowDC( wxWindow *window ) wxWindowDCImpl::wxWindowDCImpl(wxDC *owner, wxWindow *window)
: wxGTKDCImpl(owner)
{ {
wxASSERT_MSG( window, wxT("DC needs a window") ); wxASSERT_MSG( window, wxT("DC needs a window") );
@@ -330,12 +331,12 @@ wxWindowDC::wxWindowDC( wxWindow *window )
m_owner = window; m_owner = window;
} }
wxWindowDC::~wxWindowDC() wxWindowDCImpl::~wxWindowDCImpl()
{ {
Destroy(); Destroy();
} }
void wxWindowDC::SetUpDC() void wxWindowDCImpl::SetUpDC()
{ {
m_ok = true; m_ok = true;
@@ -348,8 +349,7 @@ void wxWindowDC::SetUpDC()
m_textGC = wxGetPoolGC( m_window, wxTEXT_SCREEN ); m_textGC = wxGetPoolGC( m_window, wxTEXT_SCREEN );
m_bgGC = wxGetPoolGC( m_window, wxBG_SCREEN ); m_bgGC = wxGetPoolGC( m_window, wxBG_SCREEN );
} }
else else if (m_isMemDC && (((wxMemoryDCImpl*)this)->m_selected.GetDepth() == 1))
if (m_isMemDC && (((wxMemoryDC*)this)->m_selected.GetDepth() == 1))
{ {
m_penGC = wxGetPoolGC( m_window, wxPEN_MONO ); m_penGC = wxGetPoolGC( m_window, wxPEN_MONO );
m_brushGC = wxGetPoolGC( m_window, wxBRUSH_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") ); wxCHECK_RET( m_owner, _T("GetSize() doesn't work without window") );
@@ -431,13 +431,13 @@ void wxWindowDC::DoGetSize( int* width, int* height ) const
extern bool wxDoFloodFill(wxDC *dc, wxCoord x, wxCoord y, extern bool wxDoFloodFill(wxDC *dc, wxCoord x, wxCoord y,
const wxColour & col, int style); const wxColour & col, int style);
bool wxWindowDC::DoFloodFill(wxCoord x, wxCoord y, bool wxWindowDCImpl::DoFloodFill(wxCoord x, wxCoord y,
const wxColour& col, int style) 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. // Generic (and therefore rather inefficient) method.
// Could be improved. // Could be improved.
@@ -452,9 +452,9 @@ bool wxWindowDC::DoGetPixel( wxCoord x1, wxCoord y1, wxColour *col ) const
return true; 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_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) 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 ) wxCoord xc, wxCoord yc )
{ {
wxCHECK_RET( Ok(), wxT("invalid window dc") ); wxCHECK_RET( IsOk(), wxT("invalid window dc") );
wxCoord xx1 = XLOG2DEV(x1); wxCoord xx1 = XLOG2DEV(x1);
wxCoord yy1 = YLOG2DEV(y1); wxCoord yy1 = YLOG2DEV(y1);
@@ -577,9 +577,9 @@ void wxWindowDC::DoDrawArc( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2,
CalcBoundingBox (x2, 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 xx = XLOG2DEV(x);
wxCoord yy = YLOG2DEV(y); wxCoord yy = YLOG2DEV(y);
@@ -639,9 +639,9 @@ void wxWindowDC::DoDrawEllipticArc( wxCoord x, wxCoord y, wxCoord width, wxCoord
CalcBoundingBox (x + width, y + height); 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) if ((m_pen.GetStyle() != wxTRANSPARENT) && m_window)
gdk_draw_point( m_window, m_penGC, XLOG2DEV(x), YLOG2DEV(y) ); gdk_draw_point( m_window, m_penGC, XLOG2DEV(x), YLOG2DEV(y) );
@@ -649,9 +649,9 @@ void wxWindowDC::DoDrawPoint( wxCoord x, wxCoord y )
CalcBoundingBox (x, 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 (m_pen.GetStyle() == wxTRANSPARENT) return;
if (n <= 0) return; if (n <= 0) return;
@@ -680,9 +680,9 @@ void wxWindowDC::DoDrawLines( int n, wxPoint points[], wxCoord xoffset, wxCoord
delete[] gpts; 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; if (n <= 0) return;
@@ -748,9 +748,9 @@ void wxWindowDC::DoDrawPolygon( int n, wxPoint points[], wxCoord xoffset, wxCoor
delete[] gpts; 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 xx = XLOG2DEV(x);
wxCoord yy = YLOG2DEV(y); wxCoord yy = YLOG2DEV(y);
@@ -810,9 +810,9 @@ void wxWindowDC::DoDrawRectangle( wxCoord x, wxCoord y, wxCoord width, wxCoord h
CalcBoundingBox( x + width, y + height ); 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); if (radius < 0.0) radius = - radius * ((width < height) ? width : height);
@@ -830,7 +830,7 @@ void wxWindowDC::DoDrawRoundedRectangle( wxCoord x, wxCoord y, wxCoord width, wx
// X drawing errors with small radii // X drawing errors with small radii
if (rr == 0) if (rr == 0)
{ {
DrawRectangle( x, y, width, height ); DoDrawRectangle( x, y, width, height );
return; return;
} }
@@ -933,9 +933,9 @@ void wxWindowDC::DoDrawRoundedRectangle( wxCoord x, wxCoord y, wxCoord width, wx
CalcBoundingBox( x + width, y + height ); 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 xx = XLOG2DEV(x);
wxCoord yy = YLOG2DEV(y); wxCoord yy = YLOG2DEV(y);
@@ -992,17 +992,17 @@ void wxWindowDC::DoDrawEllipse( wxCoord x, wxCoord y, wxCoord width, wxCoord hei
CalcBoundingBox( x + width, y + height ); 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 // VZ: egcs 1.0.3 refuses to compile this without cast, no idea why
DoDrawBitmap( (const wxBitmap&)icon, x, y, true ); DoDrawBitmap( (const wxBitmap&)icon, x, y, true );
} }
void wxWindowDC::DoDrawBitmap( const wxBitmap &bitmap, void wxWindowDCImpl::DoDrawBitmap( const wxBitmap &bitmap,
wxCoord x, wxCoord y, wxCoord x, wxCoord y,
bool useMask ) 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.Ok(), wxT("invalid bitmap") );
@@ -1125,26 +1125,26 @@ void wxWindowDC::DoDrawBitmap( const wxBitmap &bitmap,
gdk_bitmap_unref( new_mask ); gdk_bitmap_unref( new_mask );
} }
bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest, bool wxWindowDCImpl::DoBlit( wxCoord xdest, wxCoord ydest,
wxCoord width, wxCoord height, wxCoord width, wxCoord height,
wxDC *source, wxDC *source,
wxCoord xsrc, wxCoord ysrc, wxCoord xsrc, wxCoord ysrc,
int logical_func, int logical_func,
bool useMask, bool useMask,
wxCoord xsrcMask, wxCoord ysrcMask ) 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") ); wxCHECK_MSG( source, false, wxT("invalid source dc") );
if (!m_window) return false; if (!m_window) return false;
// transform the source DC coords to the device ones // transform the source DC coords to the device ones
xsrc = source->XLOG2DEV(xsrc); xsrc = source->LogicalToDeviceX(xsrc);
ysrc = source->YLOG2DEV(ysrc); ysrc = source->LogicalToDeviceY(ysrc);
wxClientDC *srcDC = (wxClientDC*)source; wxClientDCImpl *srcDC = (wxClientDCImpl*)source->GetImpl();
wxMemoryDC *memDC = (wxMemoryDC*)source; wxMemoryDCImpl *memDC = (wxMemoryDCImpl*)source;
bool use_bitmap_method = false; bool use_bitmap_method = false;
bool is_mono = false; bool is_mono = false;
@@ -1392,9 +1392,9 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest,
return true; 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_window) return;
@@ -1439,15 +1439,15 @@ void wxWindowDC::DoDrawText( const wxString &text, wxCoord x, wxCoord y )
// a better approach here: // a better approach here:
// http://www.daa.com.au/pipermail/pygtk/2003-April/005052.html // 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) ) if ( wxIsNullDouble(angle) )
{ {
DrawText(text, x, y); DoDrawText(text, x, y);
return; return;
} }
wxCHECK_RET( Ok(), wxT("invalid window dc") ); wxCHECK_RET( IsOk(), wxT("invalid window dc") );
if (!m_window) return; if (!m_window) return;
@@ -1545,7 +1545,7 @@ void wxWindowDC::DoDrawRotatedText( const wxString &text, wxCoord x, wxCoord y,
CalcBoundingBox(x + maxX, y + maxY); CalcBoundingBox(x + maxX, y + maxY);
} }
void wxWindowDC::DoGetTextExtent(const wxString &string, void wxWindowDCImpl::DoGetTextExtent(const wxString &string,
wxCoord *width, wxCoord *height, wxCoord *width, wxCoord *height,
wxCoord *descent, wxCoord *externalLeading, wxCoord *descent, wxCoord *externalLeading,
const wxFont *theFont) const const wxFont *theFont) const
@@ -1580,7 +1580,7 @@ void wxWindowDC::DoGetTextExtent(const wxString &string,
*descent = wxCoord(font->descent / m_scaleY); *descent = wxCoord(font->descent / m_scaleY);
} }
wxCoord wxWindowDC::GetCharWidth() const wxCoord wxWindowDCImpl::GetCharWidth() const
{ {
GdkFont *font = m_font.GetInternalFont( m_scaleY ); GdkFont *font = m_font.GetInternalFont( m_scaleY );
wxCHECK_MSG( font, -1, wxT("invalid font") ); wxCHECK_MSG( font, -1, wxT("invalid font") );
@@ -1588,7 +1588,7 @@ wxCoord wxWindowDC::GetCharWidth() const
return wxCoord(gdk_string_width( font, "H" ) / m_scaleX); return wxCoord(gdk_string_width( font, "H" ) / m_scaleX);
} }
wxCoord wxWindowDC::GetCharHeight() const wxCoord wxWindowDCImpl::GetCharHeight() const
{ {
GdkFont *font = m_font.GetInternalFont( m_scaleY ); GdkFont *font = m_font.GetInternalFont( m_scaleY );
wxCHECK_MSG( font, -1, wxT("invalid font") ); wxCHECK_MSG( font, -1, wxT("invalid font") );
@@ -1596,9 +1596,9 @@ wxCoord wxWindowDC::GetCharHeight() const
return wxCoord((font->ascent + font->descent) / m_scaleY); 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; if (!m_window) return;
@@ -1634,14 +1634,14 @@ void wxWindowDC::Clear()
#endif // 0/1 #endif // 0/1
} }
void wxWindowDC::SetFont( const wxFont &font ) void wxWindowDCImpl::SetFont( const wxFont &font )
{ {
m_font = 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; if (m_pen == pen) return;
@@ -1789,9 +1789,9 @@ void wxWindowDC::SetPen( const wxPen &pen )
gdk_gc_set_foreground( m_penGC, m_pen.GetColour().GetColor() ); 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; if (m_brush == brush) return;
@@ -1834,12 +1834,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 /* CMB 21/7/98: Added SetBackground. Sets background brush
* for Clear() and bg colour for shapes filled with cross-hatch 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; if (m_backgroundBrush == brush) return;
@@ -1879,9 +1879,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) if (m_logicalFunction == function)
return; return;
@@ -1927,9 +1927,9 @@ void wxWindowDC::SetLogicalFunction( int function )
gdk_gc_set_function( m_textGC, mode ); 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 // don't set m_textForegroundColour to an invalid colour as we'd crash
// later then (we use m_textForegroundColour.GetColor() without checking // later then (we use m_textForegroundColour.GetColor() without checking
@@ -1946,9 +1946,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 // same as above
if ( !col.Ok() || (m_textBackgroundColour == col) ) if ( !col.Ok() || (m_textBackgroundColour == col) )
@@ -1963,9 +1963,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; m_backgroundMode = mode;
@@ -1981,14 +1981,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; if (!m_window) return;
@@ -2010,7 +2010,7 @@ void wxWindowDC::DoSetClippingRegion( wxCoord x, wxCoord y, wxCoord width, wxCoo
wxCoord xx, yy, ww, hh; wxCoord xx, yy, ww, hh;
m_currentClippingRegion.GetBox( 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_penGC, m_currentClippingRegion.GetRegion() );
gdk_gc_set_clip_region( m_brushGC, m_currentClippingRegion.GetRegion() ); gdk_gc_set_clip_region( m_brushGC, m_currentClippingRegion.GetRegion() );
@@ -2018,9 +2018,9 @@ void wxWindowDC::DoSetClippingRegion( wxCoord x, wxCoord y, wxCoord width, wxCoo
gdk_gc_set_clip_region( m_bgGC, m_currentClippingRegion.GetRegion() ); gdk_gc_set_clip_region( m_bgGC, m_currentClippingRegion.GetRegion() );
} }
void wxWindowDC::DoSetClippingRegionAsRegion( const wxRegion &region ) void wxWindowDCImpl::DoSetClippingRegionAsRegion( const wxRegion &region )
{ {
wxCHECK_RET( Ok(), wxT("invalid window dc") ); wxCHECK_RET( IsOk(), wxT("invalid window dc") );
if (region.Empty()) if (region.Empty())
{ {
@@ -2042,7 +2042,7 @@ void wxWindowDC::DoSetClippingRegionAsRegion( const wxRegion &region )
wxCoord xx, yy, ww, hh; wxCoord xx, yy, ww, hh;
m_currentClippingRegion.GetBox( 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_penGC, m_currentClippingRegion.GetRegion() );
gdk_gc_set_clip_region( m_brushGC, m_currentClippingRegion.GetRegion() ); gdk_gc_set_clip_region( m_brushGC, m_currentClippingRegion.GetRegion() );
@@ -2050,11 +2050,11 @@ void wxWindowDC::DoSetClippingRegionAsRegion( const wxRegion &region )
gdk_gc_set_clip_region( m_bgGC, m_currentClippingRegion.GetRegion() ); 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(); m_currentClippingRegion.Clear();
@@ -2081,7 +2081,7 @@ void wxWindowDC::DestroyClippingRegion()
} }
} }
void wxWindowDC::Destroy() void wxWindowDCImpl::Destroy()
{ {
if (m_penGC) wxFreePoolGC( m_penGC ); if (m_penGC) wxFreePoolGC( m_penGC );
m_penGC = (GdkGC*) NULL; m_penGC = (GdkGC*) NULL;
@@ -2093,11 +2093,11 @@ void wxWindowDC::Destroy()
m_bgGC = (GdkGC*) NULL; m_bgGC = (GdkGC*) NULL;
} }
void wxWindowDC::ComputeScaleAndOrigin() void wxWindowDCImpl::ComputeScaleAndOrigin()
{ {
const wxRealPoint origScale(m_scaleX, m_scaleY); const wxRealPoint origScale(m_scaleX, m_scaleY);
wxDC::ComputeScaleAndOrigin(); wxGTKDCImpl::ComputeScaleAndOrigin();
// if scale has changed call SetPen to recalulate the line width // if scale has changed call SetPen to recalulate the line width
if ( wxRealPoint(m_scaleX, m_scaleY) != origScale && m_pen.Ok() ) if ( wxRealPoint(m_scaleX, m_scaleY) != origScale && m_pen.Ok() )
@@ -2111,12 +2111,12 @@ void wxWindowDC::ComputeScaleAndOrigin()
} }
// Resolution in pixels per logical inch // 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)); 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")); wxFAIL_MSG(wxT("not implemented"));
@@ -2125,10 +2125,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 // Limit the paint region to the window size. Sometimes
// the paint region is too big, and this risks X11 errors // the paint region is too big, and this risks X11 errors
@@ -2149,8 +2149,8 @@ static void wxLimitRegionToSize(wxRegion& region, const wxSize& sz)
} }
} }
wxPaintDC::wxPaintDC( wxWindow *win ) wxPaintDCImpl::wxPaintDCImpl(wxDC *owner, wxWindow *win)
: wxClientDC( win ) : wxClientDCImpl(owner, win)
{ {
#if USE_PAINT_REGION #if USE_PAINT_REGION
if (!win->m_clipPaintRegion) if (!win->m_clipPaintRegion)
@@ -2178,15 +2178,15 @@ wxPaintDC::wxPaintDC( wxWindow *win )
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// wxClientDC // wxClientDCImpl
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxClientDC, wxWindowDC) IMPLEMENT_ABSTRACT_CLASS(wxClientDCImpl, wxWindowDCImpl)
wxClientDC::wxClientDC( wxWindow *win ) wxClientDCImpl::wxClientDCImpl(wxDC *owner, wxWindow *win)
: wxWindowDC( win ) : wxWindowDCImpl(owner, win)
{ {
wxCHECK_RET( win, _T("NULL window in wxClientDC::wxClientDC") ); wxCHECK_RET( win, _T("NULL window in wxClientDCImpl::wxClientDCImpl") );
#ifdef __WXUNIVERSAL__ #ifdef __WXUNIVERSAL__
wxPoint ptOrigin = win->GetClientAreaOrigin(); wxPoint ptOrigin = win->GetClientAreaOrigin();
@@ -2196,7 +2196,7 @@ wxClientDC::wxClientDC( wxWindow *win )
#endif // __WXUNIVERSAL__ #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") ); wxCHECK_RET( m_owner, _T("GetSize() doesn't work without window") );

View File

@@ -10,35 +10,35 @@
// For compilers that support precompilation, includes "wx.h". // For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h" #include "wx/wxprec.h"
#include "wx/dcmemory.h" #include "wx/gtk1/dcmemory.h"
#include <gdk/gdk.h> #include <gdk/gdk.h>
#include <gtk/gtk.h> #include <gtk/gtk.h>
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// wxMemoryDC // wxMemoryDCImpl
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxMemoryDC,wxWindowDC) IMPLEMENT_ABSTRACT_CLASS(wxMemoryDCImpl, wxWindowDCImpl)
void wxMemoryDC::Init() void wxMemoryDCImpl::Init()
{ {
m_ok = false; m_ok = false;
m_cmap = gtk_widget_get_default_colormap(); m_cmap = gtk_widget_get_default_colormap();
} }
wxMemoryDC::wxMemoryDC( wxDC *WXUNUSED(dc) ) wxMemoryDCImpl::wxMemoryDCImpl(wxMemoryDC *owner, wxDC *WXUNUSED(dc))
: wxWindowDC() : wxWindowDCImpl(owner)
{ {
Init(); Init();
} }
wxMemoryDC::~wxMemoryDC() wxMemoryDCImpl::~wxMemoryDCImpl()
{ {
} }
void wxMemoryDC::DoSelect( const wxBitmap& bitmap ) void wxMemoryDCImpl::DoSelect( const wxBitmap& bitmap )
{ {
Destroy(); Destroy();
@@ -65,7 +65,7 @@ void wxMemoryDC::DoSelect( const wxBitmap& bitmap )
} }
} }
void wxMemoryDC::SetPen( const wxPen& penOrig ) void wxMemoryDCImpl::SetPen( const wxPen& penOrig )
{ {
wxPen pen( penOrig ); wxPen pen( penOrig );
if ( m_selected.Ok() && if ( m_selected.Ok() &&
@@ -75,10 +75,10 @@ void wxMemoryDC::SetPen( const wxPen& penOrig )
pen.SetColour( pen.GetColour() == *wxWHITE ? *wxBLACK : *wxWHITE ); pen.SetColour( pen.GetColour() == *wxWHITE ? *wxBLACK : *wxWHITE );
} }
wxWindowDC::SetPen( pen ); wxWindowDCImpl::SetPen( pen );
} }
void wxMemoryDC::SetBrush( const wxBrush& brushOrig ) void wxMemoryDCImpl::SetBrush( const wxBrush& brushOrig )
{ {
wxBrush brush( brushOrig ); wxBrush brush( brushOrig );
if ( m_selected.Ok() && if ( m_selected.Ok() &&
@@ -88,10 +88,10 @@ void wxMemoryDC::SetBrush( const wxBrush& brushOrig )
brush.SetColour( brush.GetColour() == *wxWHITE ? *wxBLACK : *wxWHITE); brush.SetColour( brush.GetColour() == *wxWHITE ? *wxBLACK : *wxWHITE);
} }
wxWindowDC::SetBrush( brush ); wxWindowDCImpl::SetBrush( brush );
} }
void wxMemoryDC::SetBackground( const wxBrush& brushOrig ) void wxMemoryDCImpl::SetBackground( const wxBrush& brushOrig )
{ {
wxBrush brush(brushOrig); wxBrush brush(brushOrig);
@@ -102,34 +102,34 @@ void wxMemoryDC::SetBackground( const wxBrush& brushOrig )
brush.SetColour( brush.GetColour() == *wxWHITE ? *wxBLACK : *wxWHITE ); brush.SetColour( brush.GetColour() == *wxWHITE ? *wxBLACK : *wxWHITE );
} }
wxWindowDC::SetBackground( brush ); wxWindowDCImpl::SetBackground( brush );
} }
void wxMemoryDC::SetTextForeground( const wxColour& col ) void wxMemoryDCImpl::SetTextForeground( const wxColour& col )
{ {
if ( m_selected.Ok() && m_selected.GetBitmap() ) if ( m_selected.Ok() && m_selected.GetBitmap() )
{ {
wxWindowDC::SetTextForeground( col == *wxWHITE ? *wxBLACK : *wxWHITE); wxWindowDCImpl::SetTextForeground( col == *wxWHITE ? *wxBLACK : *wxWHITE);
} }
else else
{ {
wxWindowDC::SetTextForeground( col ); wxWindowDCImpl::SetTextForeground( col );
} }
} }
void wxMemoryDC::SetTextBackground( const wxColour &col ) void wxMemoryDCImpl::SetTextBackground( const wxColour &col )
{ {
if (m_selected.Ok() && m_selected.GetBitmap()) if (m_selected.Ok() && m_selected.GetBitmap())
{ {
wxWindowDC::SetTextBackground( col == *wxWHITE ? *wxBLACK : *wxWHITE ); wxWindowDCImpl::SetTextBackground( col == *wxWHITE ? *wxBLACK : *wxWHITE );
} }
else else
{ {
wxWindowDC::SetTextBackground( col ); wxWindowDCImpl::SetTextBackground( col );
} }
} }
void wxMemoryDC::DoGetSize( int *width, int *height ) const void wxMemoryDCImpl::DoGetSize( int *width, int *height ) const
{ {
if (m_selected.Ok()) if (m_selected.Ok())
{ {

View File

@@ -10,8 +10,6 @@
// For compilers that support precompilation, includes "wx.h". // For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h" #include "wx/wxprec.h"
#include "wx/dcscreen.h"
#ifndef WX_PRECOMP #ifndef WX_PRECOMP
#include "wx/window.h" #include "wx/window.h"
#endif #endif
@@ -20,21 +18,24 @@
#include <gdk/gdkx.h> #include <gdk/gdkx.h>
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include "wx/gtk1/dcscreen.h"
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// global data initialization // global data initialization
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
GdkWindow *wxScreenDC::sm_overlayWindow = (GdkWindow*) NULL; GdkWindow *wxScreenDCImpl::sm_overlayWindow = (GdkWindow*) NULL;
int wxScreenDC::sm_overlayWindowX = 0; int wxScreenDCImpl::sm_overlayWindowX = 0;
int wxScreenDC::sm_overlayWindowY = 0; int wxScreenDCImpl::sm_overlayWindowY = 0;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// wxScreenDC // wxScreenDCImpl
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxScreenDC,wxPaintDC) IMPLEMENT_ABSTRACT_CLASS(wxScreenDCImpl, wxPaintDCImpl)
wxScreenDC::wxScreenDC() wxScreenDCImpl::wxScreenDCImpl(wxScreenDC *owner)
: wxPaintDCImpl(owner)
{ {
m_ok = false; m_ok = false;
m_cmap = gdk_colormap_get_system(); m_cmap = gdk_colormap_get_system();
@@ -50,32 +51,15 @@ wxScreenDC::wxScreenDC()
gdk_gc_set_subwindow( m_bgGC, GDK_INCLUDE_INFERIORS ); gdk_gc_set_subwindow( m_bgGC, GDK_INCLUDE_INFERIORS );
} }
wxScreenDC::~wxScreenDC() wxScreenDCImpl::~wxScreenDCImpl()
{ {
gdk_gc_set_subwindow( m_penGC, GDK_CLIP_BY_CHILDREN ); gdk_gc_set_subwindow( m_penGC, GDK_CLIP_BY_CHILDREN );
gdk_gc_set_subwindow( m_brushGC, GDK_CLIP_BY_CHILDREN ); gdk_gc_set_subwindow( m_brushGC, GDK_CLIP_BY_CHILDREN );
gdk_gc_set_subwindow( m_textGC, GDK_CLIP_BY_CHILDREN ); gdk_gc_set_subwindow( m_textGC, GDK_CLIP_BY_CHILDREN );
gdk_gc_set_subwindow( m_bgGC, GDK_CLIP_BY_CHILDREN ); gdk_gc_set_subwindow( m_bgGC, GDK_CLIP_BY_CHILDREN );
EndDrawingOnTop();
} }
bool wxScreenDC::StartDrawingOnTop( wxWindow * ) void wxScreenDCImpl::DoGetSize(int *width, int *height) const
{
return true;
}
bool wxScreenDC::StartDrawingOnTop( wxRect * )
{
return true;
}
bool wxScreenDC::EndDrawingOnTop()
{
return true;
}
void wxScreenDC::DoGetSize(int *width, int *height) const
{ {
wxDisplaySize(width, height); wxDisplaySize(width, height);
} }

View File

@@ -21,6 +21,7 @@
#include "gtk/gtk.h" #include "gtk/gtk.h"
#include "wx/gtk1/win_gtk.h" #include "wx/gtk1/win_gtk.h"
#include "wx/gtk1/private.h" #include "wx/gtk1/private.h"
#include "wx/gtk1/dcclient.h"
#include <gdk/gdk.h> #include <gdk/gdk.h>
#include <gdk/gdkprivate.h> #include <gdk/gdkprivate.h>
@@ -103,7 +104,7 @@ static void gtk_window_own_expose_callback( GtkWidget *widget, GdkEventExpose *g
gdk_gc_unref( gc ); gdk_gc_unref( gc );
// Hack alert // Hack alert
dc.m_window = pizza->bin_window; wx_static_cast(wxClientDCImpl *, dc.GetImpl())->m_window = pizza->bin_window;
dc.SetTextForeground( *wxWHITE ); dc.SetTextForeground( *wxWHITE );
dc.DrawText( win->GetTitle(), 6, 3 ); dc.DrawText( win->GetTitle(), 6, 3 );
} }
@@ -149,7 +150,7 @@ static void gtk_window_own_draw_callback( GtkWidget *widget, GdkRectangle *WXUNU
gdk_gc_unref( gc ); gdk_gc_unref( gc );
// Hack alert // Hack alert
dc.m_window = pizza->bin_window; wx_static_cast(wxClientDCImpl *, dc.GetImpl())->m_window = pizza->bin_window;
dc.SetTextForeground( *wxWHITE ); dc.SetTextForeground( *wxWHITE );
dc.DrawText( win->GetTitle(), 6, 3 ); dc.DrawText( win->GetTitle(), 6, 3 );
} }

View File

@@ -22,7 +22,7 @@
// wxPen // wxPen
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
class wxPenRefData: public wxObjectRefData class wxPenRefData : public wxGDIRefData
{ {
public: public:
wxPenRefData() wxPenRefData()
@@ -36,7 +36,7 @@ public:
} }
wxPenRefData( const wxPenRefData& data ) wxPenRefData( const wxPenRefData& data )
: wxObjectRefData() : wxGDIRefData()
{ {
m_style = data.m_style; m_style = data.m_style;
m_width = data.m_width; m_width = data.m_width;

View File

@@ -29,11 +29,11 @@
#ifndef WX_PRECOMP #ifndef WX_PRECOMP
#include "wx/window.h" #include "wx/window.h"
#include "wx/dc.h" #include "wx/dc.h"
#include "wx/dcclient.h"
#endif #endif
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include "wx/gtk1/win_gtk.h" #include "wx/gtk1/win_gtk.h"
#include "wx/gtk1/dcclient.h"
// RR: After a correction to the orientation of the sash // RR: After a correction to the orientation of the sash
// this doesn't seem to be required anymore and it // this doesn't seem to be required anymore and it
@@ -141,7 +141,7 @@ wxRendererGTK::DrawHeaderButton(wxWindow *win,
NULL, NULL,
button, button,
"button", "button",
dc.XLOG2DEV(rect.x) -1, rect.y -1, rect.width +2, rect.height +2 dc.LogicalToDeviceX(rect.x) -1, rect.y -1, rect.width +2, rect.height +2
); );
} }
@@ -309,9 +309,10 @@ wxRendererGTK::DrawDropArrow(wxWindow *WXUNUSED(win),
// work for wxMemoryDC. So that is why we assume wxDC // work for wxMemoryDC. So that is why we assume wxDC
// is wxWindowDC (wxClientDC, wxMemoryDC and wxPaintDC // is wxWindowDC (wxClientDC, wxMemoryDC and wxPaintDC
// are derived from it) and use its m_window. // are derived from it) and use its m_window.
GdkWindow* gdk_window = dc.GetGDKWindow(); wxWindowDCImpl * const impl = wxDynamicCast(dc.GetImpl(), wxWindowDCImpl);
wxASSERT_MSG( gdk_window, wxCHECK_RET( impl, "must have a window DC" );
wxT("cannot use wxRendererNative on wxDC of this type") );
GdkWindow* gdk_window = impl->GetGDKWindow();
// draw arrow so that there is even space horizontally // draw arrow so that there is even space horizontally
// on both sides // on both sides
@@ -362,9 +363,10 @@ wxRendererGTK::DrawComboBoxDropButton(wxWindow *win,
GtkWidget *button = GetButtonWidget(); GtkWidget *button = GetButtonWidget();
// for reason why we do this, see DrawDropArrow // for reason why we do this, see DrawDropArrow
GdkWindow* gdk_window = dc.GetGDKWindow(); wxWindowDCImpl * const impl = wxDynamicCast(dc.GetImpl(), wxWindowDCImpl);
wxASSERT_MSG( gdk_window, wxCHECK_RET( impl, "must have a window DC" );
wxT("cannot use wxRendererNative on wxDC of this type") );
GdkWindow* gdk_window = impl->GetGDKWindow();
// draw button // draw button
GtkStateType state; GtkStateType state;