git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@50701
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
12 files changed:
/////////////////////////////////////////////////////////////////////////////
// Name: wx/motif/dc.h
/////////////////////////////////////////////////////////////////////////////
// Name: wx/motif/dc.h
+// Purpose: wxMotifDCImpl class
// Author: Julian Smart
// Modified by:
// Created: 17/09/98
// Author: Julian Smart
// Modified by:
// Created: 17/09/98
#ifndef _WX_DC_H_
#define _WX_DC_H_
#ifndef _WX_DC_H_
#define _WX_DC_H_
-#include "wx/pen.h"
-#include "wx/brush.h"
-#include "wx/icon.h"
-#include "wx/font.h"
-#include "wx/gdicmn.h"
-//-----------------------------------------------------------------------------
-// constants
-//-----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+// wxMotifDCImpl
+// ----------------------------------------------------------------------------
-#ifndef MM_TEXT
-#define MM_TEXT 0
-#define MM_ISOTROPIC 1
-#define MM_ANISOTROPIC 2
-#define MM_LOMETRIC 3
-#define MM_HIMETRIC 4
-#define MM_TWIPS 5
-#define MM_POINTS 6
-#define MM_METRIC 7
-#endif
-
-//-----------------------------------------------------------------------------
-// wxDC
-//-----------------------------------------------------------------------------
-
-class WXDLLEXPORT wxDC : public wxDCBase
+class WXDLLEXPORT wxMotifDCImpl : public wxDCImpl
- DECLARE_DYNAMIC_CLASS(wxDC)
-
- wxDC();
- virtual ~wxDC() { }
+ wxMotifDCImpl(wxDC *owner);
virtual wxSize GetPPI() const;
protected:
virtual void DoDrawIcon(const wxIcon& icon, wxCoord x, wxCoord y);
virtual void DoDrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y,
virtual wxSize GetPPI() const;
protected:
virtual void DoDrawIcon(const wxIcon& icon, wxCoord x, wxCoord y);
virtual void DoDrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y,
virtual void DoSetClippingRegion(wxCoord x, wxCoord y,
virtual void DoSetClippingRegion(wxCoord x, wxCoord y,
- wxCoord width, wxCoord height);
+ wxCoord width, wxCoord height);
virtual void DoGetSize(int *width, int *height) const;
virtual void DoGetSizeMM(int* width, int* height) const;
virtual void DoGetSize(int *width, int *height) const;
virtual void DoGetSizeMM(int* width, int* height) const;
wxCoord XLOG2DEVREL(wxCoord x) const { return LogicalToDeviceXRel(x); }
wxCoord YLOG2DEV(wxCoord y) const { return LogicalToDeviceY(y); }
wxCoord YLOG2DEVREL(wxCoord y) const { return LogicalToDeviceYRel(y); }
wxCoord XLOG2DEVREL(wxCoord x) const { return LogicalToDeviceXRel(x); }
wxCoord YLOG2DEV(wxCoord y) const { return LogicalToDeviceY(y); }
wxCoord YLOG2DEVREL(wxCoord y) const { return LogicalToDeviceYRel(y); }
// Without device translation, for backing pixmap purposes
wxCoord XLOG2DEV_2(wxCoord x) const
{
// Without device translation, for backing pixmap purposes
wxCoord XLOG2DEV_2(wxCoord x) const
{
return wxRound((double)(y - m_logicalOriginY) * m_scaleY) * m_signY;
}
return wxRound((double)(y - m_logicalOriginY) * m_scaleY) * m_signY;
}
+ DECLARE_DYNAMIC_CLASS(wxMotifDCImpl)
/////////////////////////////////////////////////////////////////////////////
// Name: wx/motif/dcclient.h
/////////////////////////////////////////////////////////////////////////////
// Name: wx/motif/dcclient.h
-// Purpose: wxClientDC, wxPaintDC and wxWindowDC classes
+// Purpose: wxClientDCImpl, wxPaintDCImpl and wxWindowDCImpl classes
// Author: Julian Smart
// Modified by:
// Created: 17/09/98
// Author: Julian Smart
// Modified by:
// Created: 17/09/98
#ifndef _WX_DCCLIENT_H_
#define _WX_DCCLIENT_H_
#ifndef _WX_DCCLIENT_H_
#define _WX_DCCLIENT_H_
+#include "wx/motif/dc.h"
-// ----------------------------------------------------------------------------
-// fwd declarations
-// ----------------------------------------------------------------------------
-
-class WXDLLIMPEXP_FWD_CORE wxWindowDC;
class WXDLLIMPEXP_FWD_CORE wxWindow;
class WXDLLIMPEXP_FWD_CORE wxWindow;
-// Under Windows, wxClientDC, wxPaintDC and wxWindowDC are implemented
-// differently. On many platforms, however, they will be the same.
-
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
-class WXDLLEXPORT wxWindowDC : public wxDC
+class WXDLLEXPORT wxWindowDCImpl : public wxMotifDCImpl
- DECLARE_DYNAMIC_CLASS(wxWindowDC)
-
- wxWindowDC();
- wxWindowDC( wxWindow *win );
+ wxWindowDCImpl(wxDC *owner);
+ wxWindowDCImpl(wxDC *owner, wxWindow *win);
+ virtual ~wxWindowDCImpl();
// TODO this function is Motif-only for now - should it go into base class?
void Clear(const wxRect& rect);
// TODO this function is Motif-only for now - should it go into base class?
void Clear(const wxRect& rect);
int m_currentStyle ;
int m_currentFill ;
int m_autoSetting ; // See comment in dcclient.cpp
int m_currentStyle ;
int m_currentFill ;
int m_autoSetting ; // See comment in dcclient.cpp
+
+ DECLARE_DYNAMIC_CLASS(wxWindowDCImpl)
-class WXDLLEXPORT wxPaintDC: public wxWindowDC
+class WXDLLEXPORT wxPaintDCImpl: public wxWindowDCImpl
- DECLARE_DYNAMIC_CLASS(wxPaintDC)
-
- wxPaintDC() { }
- wxPaintDC(wxWindow* win);
+ wxPaintDCImpl(wxDC *owner) : wxWindowDCImpl(owner) { }
+ wxPaintDCImpl(wxDC *owner, wxWindow* win);
+
+ virtual ~wxPaintDCImpl();
+ DECLARE_DYNAMIC_CLASS(wxPaintDCImpl)
-class WXDLLEXPORT wxClientDC: public wxWindowDC
+class WXDLLEXPORT wxClientDCImpl: public wxWindowDCImpl
- DECLARE_DYNAMIC_CLASS(wxClientDC)
-
- wxClientDC() { }
- wxClientDC(wxWindow* win) : wxWindowDC(win) { }
+ wxClientDCImpl(wxDC *owner) : wxWindowDCImpl(owner) { }
+ wxClientDCImpl(wxDC *owner, wxWindow* win)
+ : wxWindowDCImpl(owner, win) { }
+
+ DECLARE_DYNAMIC_CLASS(wxClientDCImpl)
};
#endif // _WX_DCCLIENT_H_
};
#endif // _WX_DCCLIENT_H_
/////////////////////////////////////////////////////////////////////////////
// Name: wx/motif/dcmemory.h
/////////////////////////////////////////////////////////////////////////////
// Name: wx/motif/dcmemory.h
-// Purpose: wxMemoryDC class
+// Purpose: wxMemoryDCImpl class
// Author: Julian Smart
// Modified by:
// Created: 17/09/98
// Author: Julian Smart
// Modified by:
// Created: 17/09/98
#ifndef _WX_DCMEMORY_H_
#define _WX_DCMEMORY_H_
#ifndef _WX_DCMEMORY_H_
#define _WX_DCMEMORY_H_
-#include "wx/dcclient.h"
+#include "wx/motif/dcclient.h"
-class WXDLLIMPEXP_CORE wxMemoryDC : public wxWindowDC, public wxMemoryDCBase
+class WXDLLIMPEXP_CORE wxMemoryDCImpl : public wxWindowDCImpl
- DECLARE_DYNAMIC_CLASS(wxMemoryDC)
-
- wxMemoryDC() { Init(); }
- wxMemoryDC(wxBitmap& bitmap) { Init(); SelectObject(bitmap); }
- wxMemoryDC( wxDC *dc ); // Create compatible DC
- virtual ~wxMemoryDC();
-
- void DoGetSize( int *width, int *height ) const;
-
- wxBitmap& GetBitmap() const { return (wxBitmap&) m_bitmap; }
-
-protected:
+ wxMemoryDCImpl(wxMemoryDC *owner) : wxWindowDCImpl(owner) { Init(); }
+ wxMemoryDCImpl(wxMemoryDC *owner, wxBitmap& bitmap)
+ : wxWindowDCImpl(owner)
+ {
+ Init();
+ DoSelect(bitmap);
+ }
+
+ wxMemoryDCImpl(wxMemoryDC *owner, wxDC *dc);
+ virtual ~wxMemoryDCImpl();
+
+ virtual void DoGetSize( int *width, int *height ) const;
virtual void DoSelect(const wxBitmap& bitmap);
private:
virtual void DoSelect(const wxBitmap& bitmap);
private:
+ wxBitmap m_bitmap;
+
+ DECLARE_DYNAMIC_CLASS(wxMemoryDCImpl)
#ifndef _WX_DCPRINT_H_
#define _WX_DCPRINT_H_
#ifndef _WX_DCPRINT_H_
#define _WX_DCPRINT_H_
+#include "wx/motif/dc.h"
-class WXDLLEXPORT wxPrinterDC: public wxDC
+class WXDLLEXPORT wxPrinterDC : public wxMotifDCImpl
- DECLARE_CLASS(wxPrinterDC)
-
- wxPrinterDC(const wxString& driver, const wxString& device, const wxString& output, bool interactive = true, int orientation = wxPORTRAIT);
+ wxPrinterDCImpl(const wxString& driver, const wxString& device,
+ const wxString& output,
+ bool interactive = true,
+ int orientation = wxPORTRAIT);
+ virtual ~wxPrinterDC();
- virtual ~wxPrinterDC();
+ DECLARE_CLASS(wxPrinterDCImpl)
-#endif
-// _WX_DCPRINT_H_
+#endif // _WX_DCPRINT_H_
/////////////////////////////////////////////////////////////////////////////
// Name: wx/motif/dcscreen.h
/////////////////////////////////////////////////////////////////////////////
// Name: wx/motif/dcscreen.h
-// Purpose: wxScreenDC class
+// Purpose: wxScreenDCImpl class
// Author: Julian Smart
// Modified by:
// Created: 17/09/98
// Author: Julian Smart
// Modified by:
// Created: 17/09/98
#ifndef _WX_DCSCREEN_H_
#define _WX_DCSCREEN_H_
#ifndef _WX_DCSCREEN_H_
#define _WX_DCSCREEN_H_
-#include "wx/dcclient.h"
+#include "wx/motif/dcclient.h"
-class WXDLLEXPORT wxScreenDC: public wxWindowDC
+class WXDLLEXPORT wxScreenDCImpl : public wxWindowDCImpl
- DECLARE_DYNAMIC_CLASS(wxScreenDC)
-
public:
// Create a DC representing the whole screen
public:
// Create a DC representing the whole screen
- wxScreenDC();
- virtual ~wxScreenDC();
+ wxScreenDCImpl(wxScreenDC *owner);
+ virtual ~wxScreenDCImpl();
// Compatibility with X's requirements for
// drawing on top of all windows
// Compatibility with X's requirements for
// drawing on top of all windows
// constructor.
static int sm_overlayWindowX;
static int sm_overlayWindowY;
// constructor.
static int sm_overlayWindowX;
static int sm_overlayWindowY;
+
+ DECLARE_DYNAMIC_CLASS(wxScreenDCImpl)
-#endif
-// _WX_DCSCREEN_H_
+#endif // _WX_DCSCREEN_H_
#include "wx/cocoa/dcscreen.h"
#endif
#include "wx/cocoa/dcscreen.h"
#endif
+#ifdef __WXMOTIF__
+ #include "wx/motif/dcclient.h"
+ #include "wx/motif/dcmemory.h"
+ #include "wx/motif/dcscreen.h"
+#endif
+
#ifdef __WXX11__
#include "wx/x11/dcclient.h"
#include "wx/x11/dcmemory.h"
#ifdef __WXX11__
#include "wx/x11/dcclient.h"
#include "wx/x11/dcmemory.h"
wxDCImpl* wxNativePrintFactory::CreatePrinterDCImpl( wxPrinterDC *owner, const wxPrintData& data )
{
wxDCImpl* wxNativePrintFactory::CreatePrinterDCImpl( wxPrinterDC *owner, const wxPrintData& data )
{
-#if defined(__WXGTK__) || defined(__WXUNIVERSAL__)
+#if defined(__WXGTK__) || defined(__WXMOTIF__) || defined(__WXUNIVERSAL__)
return new wxPostScriptDCImpl( owner, data );
#else
return new wxPrinterDCImpl( owner, data );
return new wxPostScriptDCImpl( owner, data );
#else
return new wxPrinterDCImpl( owner, data );
/////////////////////////////////////////////////////////////////////////////
// Name: src/motif/dc.cpp
/////////////////////////////////////////////////////////////////////////////
// Name: src/motif/dc.cpp
+// Purpose: wxMotifDCImpl class
// Author: Julian Smart
// Modified by:
// Created: 01/02/97
// Author: Julian Smart
// Modified by:
// Created: 01/02/97
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifndef WX_PRECOMP
#include "wx/dcmemory.h"
#endif
#ifndef WX_PRECOMP
#include "wx/dcmemory.h"
#endif
-IMPLEMENT_ABSTRACT_CLASS(wxDC, wxObject)
+#include "wx/motif/dc.h"
+
+IMPLEMENT_ABSTRACT_CLASS(wxMotifDCImpl, wxDCImpl)
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
+wxMotifDCImpl::wxMotifDCImpl(wxDC *owner)
+ : wxDCImpl(owner)
{
m_ok = false;
m_backgroundMode = wxTRANSPARENT;
{
m_ok = false;
m_backgroundMode = wxTRANSPARENT;
-
- m_isInteractive = false;
-void wxDC::DoDrawIcon( const wxIcon &icon, wxCoord x, wxCoord y)
+void wxMotifDCImpl::DoDrawIcon( const wxIcon &icon, wxCoord x, wxCoord y)
- wxCHECK_RET( Ok(), "invalid dc" );
+ wxCHECK_RET( IsOk(), "invalid dc" );
wxCHECK_RET( icon.Ok(), "invalid icon" );
DoDrawBitmap(icon, x, y, true);
}
wxCHECK_RET( icon.Ok(), "invalid icon" );
DoDrawBitmap(icon, x, y, true);
}
-void wxDC::DoDrawBitmap( const wxBitmap& bitmap, wxCoord x, wxCoord y, bool useMask )
+void wxMotifDCImpl::DoDrawBitmap( const wxBitmap& bitmap, wxCoord x, wxCoord y, bool useMask )
{
wxCHECK_RET( bitmap.Ok(), "invalid bitmap" );
{
wxCHECK_RET( bitmap.Ok(), "invalid bitmap" );
- Blit(x, y, bitmap.GetWidth(), bitmap.GetHeight(), &memDC, 0, 0, wxCOPY, useMask);
+ DoBlit(x, y, bitmap.GetWidth(), bitmap.GetHeight(), &memDC, 0, 0, wxCOPY, useMask);
memDC.SelectObject(wxNullBitmap);
}
memDC.SelectObject(wxNullBitmap);
}
-void wxDC::DoSetClippingRegion( wxCoord x, wxCoord y, wxCoord width, wxCoord height )
+void wxMotifDCImpl::DoSetClippingRegion( wxCoord x, wxCoord y, wxCoord width, wxCoord height )
{
m_clipping = true;
m_clipX1 = x;
{
m_clipping = true;
m_clipX1 = x;
-void wxDC::DoGetSize( int* width, int* height ) const
+void wxMotifDCImpl::DoGetSize( int* width, int* height ) const
{
if ( width )
*width = m_maxX - m_minX;
{
if ( width )
*width = m_maxX - m_minX;
*height = m_maxY - m_minY;
}
*height = m_maxY - m_minY;
}
-void wxDC::DoGetSizeMM( int* width, int* height ) const
+void wxMotifDCImpl::DoGetSizeMM( int* width, int* height ) const
{
int w, h;
GetSize( &w, &h );
{
int w, h;
GetSize( &w, &h );
}
// Resolution in pixels per logical inch
}
// Resolution in pixels per logical inch
-wxSize wxDC::GetPPI() const
+wxSize wxMotifDCImpl::GetPPI() const
{
// TODO (should probably be pure virtual)
return wxSize(0, 0);
{
// TODO (should probably be pure virtual)
return wxSize(0, 0);
/////////////////////////////////////////////////////////////////////////////
// Name: src/motif/dcclient.cpp
/////////////////////////////////////////////////////////////////////////////
// Name: src/motif/dcclient.cpp
-// Purpose: wxClientDC class
+// Purpose: wxClientDCImpl class
// Author: Julian Smart
// Modified by:
// Created: 01/02/97
// Author: Julian Smart
// Modified by:
// Created: 01/02/97
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
-#include "wx/dcclient.h"
-
#ifndef WX_PRECOMP
#include "wx/log.h"
#include "wx/app.h"
#ifndef WX_PRECOMP
#include "wx/log.h"
#include "wx/app.h"
#endif
#include "wx/motif/private.h"
#endif
#include "wx/motif/private.h"
+#include "wx/motif/dcclient.h"
#ifdef __EMX__
#include <float.h> // for M_PI
#ifdef __EMX__
#include <float.h> // for M_PI
// macros
// ----------------------------------------------------------------------------
// macros
// ----------------------------------------------------------------------------
-IMPLEMENT_DYNAMIC_CLASS(wxClientDC, wxWindowDC)
-IMPLEMENT_DYNAMIC_CLASS(wxPaintDC, wxWindowDC)
-IMPLEMENT_DYNAMIC_CLASS(wxWindowDC, wxDC)
+IMPLEMENT_ABSTRACT_CLASS(wxClientDCImpl, wxWindowDCImpl)
+IMPLEMENT_ABSTRACT_CLASS(wxPaintDCImpl, wxWindowDCImpl)
+IMPLEMENT_ABSTRACT_CLASS(wxWindowDCImpl, wxMotifDCImpl)
#define IS_HATCH(s) ((s)>=wxFIRST_HATCH && (s)<=wxLAST_HATCH)
#define IS_HATCH(s) ((s)>=wxFIRST_HATCH && (s)<=wxLAST_HATCH)
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
+void wxWindowDCImpl::Init()
{
m_gc = (WXGC) 0;
m_gcBacking = (WXGC) 0;
{
m_gc = (WXGC) 0;
m_gcBacking = (WXGC) 0;
m_clipRegion = (WXRegion) 0;
}
m_clipRegion = (WXRegion) 0;
}
-wxWindowDC::wxWindowDC()
+wxWindowDCImpl::wxWindowDCImpl(wxDC *owner)
+ : wxMotifDCImpl(owner)
-wxWindowDC::wxWindowDC( wxWindow *window )
+wxWindowDCImpl::wxWindowDCImpl(wxDC *owner, wxWindow *window)
+ : wxMotifDCImpl(owner)
- wxASSERT_MSG( (window != (wxWindow*) NULL), "You must pass a valid wxWindow to wxWindowDC/wxClientDC/wxPaintDC constructor." );
+ wxASSERT_MSG( (window != (wxWindow*) NULL), "You must pass a valid wxWindow to wxWindowDCImpl/wxClientDCImpl/wxPaintDCImpl constructor." );
SetBackground(wxBrush(m_window->GetBackgroundColour(), wxSOLID));
}
SetBackground(wxBrush(m_window->GetBackgroundColour(), wxSOLID));
}
-wxWindowDC::~wxWindowDC()
+wxWindowDCImpl::~wxWindowDCImpl()
{
if (m_gc)
XFreeGC ((Display*) m_display, (GC) m_gc);
{
if (m_gc)
XFreeGC ((Display*) m_display, (GC) m_gc);
extern bool wxDoFloodFill(wxDC *dc, wxCoord x, wxCoord y,
const wxColour & col, int style);
extern bool wxDoFloodFill(wxDC *dc, wxCoord x, wxCoord y,
const wxColour & col, int style);
-bool wxWindowDC::DoFloodFill(wxCoord x, wxCoord y,
+bool wxWindowDCImpl::DoFloodFill(wxCoord x, wxCoord y,
const wxColour& col, int style)
{
const wxColour& col, int style)
{
- return wxDoFloodFill(this, x, y, col, style);
+ return wxDoFloodFill(GetOwner(), x, y, col, style);
-bool wxWindowDC::DoGetPixel( wxCoord x1, wxCoord y1, wxColour *col ) const
+bool wxWindowDCImpl::DoGetPixel( wxCoord x1, wxCoord y1, wxColour *col ) const
{
// Generic (and therefore rather inefficient) method.
// Could be improved.
{
// Generic (and therefore rather inefficient) method.
// Could be improved.
-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(), "invalid dc" );
+ wxCHECK_RET( IsOk(), "invalid dc" );
CalcBoundingBox(x2, y2);
}
CalcBoundingBox(x2, y2);
}
-void wxWindowDC::DoCrossHair( wxCoord x, wxCoord y )
+void wxWindowDCImpl::DoCrossHair( wxCoord x, wxCoord y )
- wxCHECK_RET( Ok(), "invalid dc" );
+ wxCHECK_RET( IsOk(), "invalid dc" );
if (m_autoSetting)
SetPen (m_pen);
if (m_autoSetting)
SetPen (m_pen);
-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(), "invalid dc" );
+ wxCHECK_RET( IsOk(), "invalid dc" );
int xx1 = XLOG2DEV (x1);
int yy1 = YLOG2DEV (y1);
int xx1 = XLOG2DEV (x1);
int yy1 = YLOG2DEV (y1);
while (alpha2 > 360 * 64)
alpha2 -= 360 * 64;
while (alpha2 > 360 * 64)
alpha2 -= 360 * 64;
- if (m_brush.Ok() && m_brush.GetStyle () != wxTRANSPARENT)
+ if (m_brush.IsOk() && m_brush.GetStyle () != wxTRANSPARENT)
{
SetBrush (m_brush);
XFillArc ((Display*) m_display, (Pixmap) m_pixmap, (GC) (GC) m_gc,
{
SetBrush (m_brush);
XFillArc ((Display*) m_display, (Pixmap) m_pixmap, (GC) (GC) m_gc,
- if (m_pen.Ok() && m_pen.GetStyle () != wxTRANSPARENT)
+ if (m_pen.IsOk() && m_pen.GetStyle () != wxTRANSPARENT)
{
if (m_autoSetting)
SetPen (m_pen);
{
if (m_autoSetting)
SetPen (m_pen);
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(), "invalid dc" );
+ wxCHECK_RET( IsOk(), "invalid dc" );
if (end>start) end-=start;
else end+=360*64-start;
if (end>start) end-=start;
else end+=360*64-start;
- if (m_brush.Ok() && m_brush.GetStyle () != wxTRANSPARENT)
+ if (m_brush.IsOk() && m_brush.GetStyle () != wxTRANSPARENT)
{
m_autoSetting = true; // must be reset
{
m_autoSetting = true; // must be reset
XLOG2DEV_2 (x), YLOG2DEV_2 (y),wd,hd,start,end);
}
XLOG2DEV_2 (x), YLOG2DEV_2 (y),wd,hd,start,end);
}
- if (m_pen.Ok() && m_pen.GetStyle () != wxTRANSPARENT)
+ if (m_pen.IsOk() && m_pen.GetStyle () != wxTRANSPARENT)
{
if (m_autoSetting)
SetPen (m_pen);
{
if (m_autoSetting)
SetPen (m_pen);
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(), "invalid dc" );
+ wxCHECK_RET( IsOk(), "invalid dc" );
- if (m_pen.Ok() && m_autoSetting)
+ if (m_pen.IsOk() && m_autoSetting)
SetPen (m_pen);
XDrawPoint ((Display*) m_display, (Pixmap) m_pixmap, (GC) m_gc, XLOG2DEV (x), YLOG2DEV (y));
SetPen (m_pen);
XDrawPoint ((Display*) m_display, (Pixmap) m_pixmap, (GC) m_gc, XLOG2DEV (x), YLOG2DEV (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(), "invalid dc" );
+ wxCHECK_RET( IsOk(), "invalid dc" );
- if (m_pen.Ok() && m_pen.GetStyle () != wxTRANSPARENT)
+ if (m_pen.IsOk() && m_pen.GetStyle () != wxTRANSPARENT)
{
if (m_autoSetting)
SetPen (m_pen);
{
if (m_autoSetting)
SetPen (m_pen);
-void wxWindowDC::DoDrawPolygon( int n, wxPoint points[],
+void wxWindowDCImpl::DoDrawPolygon( int n, wxPoint points[],
wxCoord xoffset, wxCoord yoffset, int fillStyle )
{
wxCoord xoffset, wxCoord yoffset, int fillStyle )
{
- wxCHECK_RET( Ok(), "invalid dc" );
+ wxCHECK_RET( IsOk(), "invalid dc" );
XPoint *xpoints1 = new XPoint[n + 1];
XPoint *xpoints2 = new XPoint[n + 1];
XPoint *xpoints1 = new XPoint[n + 1];
XPoint *xpoints2 = new XPoint[n + 1];
xpoints2[i].x = xpoints2[0].x;
xpoints2[i].y = xpoints2[0].y;
xpoints2[i].x = xpoints2[0].x;
xpoints2[i].y = xpoints2[0].y;
- if (m_brush.Ok() && m_brush.GetStyle () != wxTRANSPARENT)
+ if (m_brush.IsOk() && m_brush.GetStyle () != wxTRANSPARENT)
{
SetBrush (m_brush);
XSetFillRule ((Display*) m_display, (GC) m_gc, fillStyle == wxODDEVEN_RULE ? EvenOddRule : WindingRule);
{
SetBrush (m_brush);
XSetFillRule ((Display*) m_display, (GC) m_gc, fillStyle == wxODDEVEN_RULE ? EvenOddRule : WindingRule);
- if (m_pen.Ok() && m_pen.GetStyle () != wxTRANSPARENT)
+ if (m_pen.IsOk() && m_pen.GetStyle () != wxTRANSPARENT)
{
if (m_autoSetting)
SetPen (m_pen);
{
if (m_autoSetting)
SetPen (m_pen);
-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(), "invalid dc" );
+ wxCHECK_RET( IsOk(), "invalid dc" );
int xd, yd, wfd, hfd, wd, hd;
int xd, yd, wfd, hfd, wd, hd;
if (wd < 0) { wd = - wd; xd = xd - wd; }
if (hd < 0) { hd = - hd; yd = yd - hd; }
if (wd < 0) { wd = - wd; xd = xd - wd; }
if (hd < 0) { hd = - hd; yd = yd - hd; }
- if (m_brush.Ok() && m_brush.GetStyle () != wxTRANSPARENT)
+ if (m_brush.IsOk() && m_brush.GetStyle () != wxTRANSPARENT)
{
SetBrush (m_brush);
XFillRectangle ((Display*) m_display, (Pixmap) m_pixmap, (GC) m_gc, xd, yd, wfd, hfd);
{
SetBrush (m_brush);
XFillRectangle ((Display*) m_display, (Pixmap) m_pixmap, (GC) m_gc, xd, yd, wfd, hfd);
- if (m_pen.Ok() && m_pen.GetStyle () != wxTRANSPARENT)
+ if (m_pen.IsOk() && m_pen.GetStyle () != wxTRANSPARENT)
{
if (m_autoSetting)
SetPen (m_pen);
{
if (m_autoSetting)
SetPen (m_pen);
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(), "invalid dc" );
+ wxCHECK_RET( IsOk(), "invalid dc" );
// If radius is negative, it's a proportion of the smaller dimension.
// If radius is negative, it's a proportion of the smaller dimension.
// X drawing errors with small radii
if (rd == 0)
{
// X drawing errors with small radii
if (rd == 0)
{
- DrawRectangle( x, y, width, height );
+ DoDrawRectangle( x, y, width, height );
int rw_d2 = rd2 * 2;
int rh_d2 = rw_d2;
int rw_d2 = rd2 * 2;
int rh_d2 = rw_d2;
- if (m_brush.Ok() && m_brush.GetStyle () != wxTRANSPARENT)
+ if (m_brush.IsOk() && m_brush.GetStyle () != wxTRANSPARENT)
- if (m_pen.Ok() && m_pen.GetStyle () != wxTRANSPARENT)
+ if (m_pen.IsOk() && m_pen.GetStyle () != wxTRANSPARENT)
{
SetPen (m_pen);
XDrawLine ((Display*) m_display, (Pixmap) m_pixmap, (GC) m_gc, xd + rd, yd,
{
SetPen (m_pen);
XDrawLine ((Display*) m_display, (Pixmap) m_pixmap, (GC) m_gc, xd + rd, yd,
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(), "invalid dc" );
+ wxCHECK_RET( IsOk(), "invalid dc" );
// Check for negative width and height
if (height < 0)
// Check for negative width and height
if (height < 0)
wd = XLOG2DEVREL(width) ;
hd = YLOG2DEVREL(height) ;
wd = XLOG2DEVREL(width) ;
hd = YLOG2DEVREL(height) ;
- if (m_brush.Ok() && m_brush.GetStyle () != wxTRANSPARENT)
+ if (m_brush.IsOk() && m_brush.GetStyle () != wxTRANSPARENT)
{
SetBrush (m_brush);
XFillArc ((Display*) m_display, (Pixmap) m_pixmap, (GC) m_gc, xd, yd, wd, hd, 0, angle);
{
SetBrush (m_brush);
XFillArc ((Display*) m_display, (Pixmap) m_pixmap, (GC) m_gc, xd, yd, wd, hd, 0, angle);
YLOG2DEVREL (height) - WX_GC_CF, 0, angle);
}
YLOG2DEVREL (height) - WX_GC_CF, 0, angle);
}
- if (m_pen.Ok() && m_pen.GetStyle () != wxTRANSPARENT)
+ if (m_pen.IsOk() && m_pen.GetStyle () != wxTRANSPARENT)
{
if (m_autoSetting)
SetPen (m_pen);
{
if (m_autoSetting)
SetPen (m_pen);
-bool wxWindowDC::CanDrawBitmap() const
+bool wxWindowDCImpl::CanDrawBitmap() const
- wxCHECK_MSG( Ok(), false, "invalid dc" );
+ wxCHECK_MSG( IsOk(), false, "invalid dc" );
return true;
}
// TODO: use scaled Blit e.g. as per John Price's implementation
// in Contrib/Utilities
return true;
}
// TODO: use scaled Blit e.g. as per John Price's implementation
// in Contrib/Utilities
-bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest,
+bool wxWindowDCImpl::DoBlit( wxCoord xdest, wxCoord ydest,
wxCoord width, wxCoord height,
wxDC *source, wxCoord xsrc, wxCoord ysrc,
int rop, bool useMask,
wxCoord xsrcMask, wxCoord ysrcMask )
{
wxCoord width, wxCoord height,
wxDC *source, wxCoord xsrc, wxCoord ysrc,
int rop, bool useMask,
wxCoord xsrcMask, wxCoord ysrcMask )
{
- wxCHECK_MSG( Ok(), false, "invalid dc" );
+ wxCHECK_MSG( IsOk(), false, "invalid dc" );
+
+ wxWindowDC const * sourceDC = wxDynamicCast(source, wxWindowDC);
+ wxCHECK_MSG( sourceDC, false, "Blit source DC must be wxWindowDCImpl or derived class." );
- wxWindowDC* sourceDC = wxDynamicCast(source, wxWindowDC);
+ // cast is safe in virtue of the above wxCHECK_MSG()
+ const wxWindowDCImpl * const
+ srcImpl = static_cast<const wxWindowDCImpl *>(sourceDC->GetImpl());
+ WXDisplay * const srcDpy = srcImpl->m_display;
- wxASSERT_MSG( sourceDC, "Blit source DC must be wxWindowDC or derived class." );
// Be sure that foreground pixels (1) of the Icon will be painted with
// foreground colour. [m_textForegroundColour] Background pixels (0)
// Be sure that foreground pixels (1) of the Icon will be painted with
// foreground colour. [m_textForegroundColour] Background pixels (0)
WXPixel oldBackgroundPixel = -1;
WXPixel oldForegroundPixel = -1;
WXPixel oldBackgroundPixel = -1;
WXPixel oldForegroundPixel = -1;
- if (m_textBackgroundColour.Ok())
+ if (m_textBackgroundColour.IsOk())
{
oldBackgroundPixel = m_backgroundPixel;
WXPixel pixel = m_textBackgroundColour.AllocColour(m_display);
{
oldBackgroundPixel = m_backgroundPixel;
WXPixel pixel = m_textBackgroundColour.AllocColour(m_display);
XSetBackground ((Display*) m_display,(GC) m_gcBacking,
pixel);
}
XSetBackground ((Display*) m_display,(GC) m_gcBacking,
pixel);
}
- if (m_textForegroundColour.Ok())
+ if (m_textForegroundColour.IsOk())
{
oldForegroundPixel = m_currentColour.GetPixel();
{
oldForegroundPixel = m_currentColour.GetPixel();
if (!useMask && (scaleX != 1.0 || scaleY != 1.0) && sourceDC->IsKindOf(CLASSINFO(wxMemoryDC)))
{
wxMemoryDC* memDC = (wxMemoryDC*) sourceDC;
if (!useMask && (scaleX != 1.0 || scaleY != 1.0) && sourceDC->IsKindOf(CLASSINFO(wxMemoryDC)))
{
wxMemoryDC* memDC = (wxMemoryDC*) sourceDC;
- wxBitmap& bitmap = memDC->GetBitmap();
+ wxBitmap& bitmap = memDC->GetSelectedBitmap();
- wxASSERT_MSG( (bitmap.Ok()), "Bad source bitmap in wxWindowDC::Blit");
+ wxASSERT_MSG( (bitmap.IsOk()), "Bad source bitmap in wxWindowDCImpl::Blit");
wxImage image = bitmap.ConvertToImage();
wxImage image = bitmap.ConvertToImage();
{
sourcePixmap = (Pixmap) bitmap.GetDrawable();
}
{
sourcePixmap = (Pixmap) bitmap.GetDrawable();
}
- sourcePixmap = (Pixmap) sourceDC->m_pixmap;
+ {
+ sourcePixmap = (Pixmap) srcImpl->m_pixmap;
+ }
if (m_pixmap && sourcePixmap)
{
if (m_pixmap && sourcePixmap)
{
SetLogicalFunction (rop);
SetLogicalFunction (rop);
- if (m_display != sourceDC->m_display)
+ if (m_display != srcDpy)
{
XImage *cache = NULL;
if (m_window && m_window->GetBackingPixmap())
{
XImage *cache = NULL;
if (m_window && m_window->GetBackingPixmap())
- XCopyRemote((Display*) sourceDC->m_display, (Display*) m_display,
+ XCopyRemote((Display*) srcDpy, (Display*) m_display,
(Pixmap) sourcePixmap, (Pixmap) m_window->GetBackingPixmap(),
(GC) m_gcBacking,
source->LogicalToDeviceX (xsrc),
(Pixmap) sourcePixmap, (Pixmap) m_window->GetBackingPixmap(),
(GC) m_gcBacking,
source->LogicalToDeviceX (xsrc),
if ( useMask && source->IsKindOf(CLASSINFO(wxMemoryDC)) )
{
wxMemoryDC *memDC = (wxMemoryDC *)source;
if ( useMask && source->IsKindOf(CLASSINFO(wxMemoryDC)) )
{
wxMemoryDC *memDC = (wxMemoryDC *)source;
- wxBitmap& sel = memDC->GetBitmap();
- if ( sel.Ok() && sel.GetMask() && sel.GetMask()->GetBitmap() )
+ wxBitmap& sel = memDC->GetSelectedBitmap();
+ if ( sel.IsOk() && sel.GetMask() && sel.GetMask()->GetBitmap() )
{
XSetClipMask ((Display*) m_display, (GC) m_gc, (Pixmap) sel.GetMask()->GetBitmap());
XSetClipOrigin ((Display*) m_display, (GC) m_gc, XLOG2DEV (xdest), YLOG2DEV (ydest));
}
}
{
XSetClipMask ((Display*) m_display, (GC) m_gc, (Pixmap) sel.GetMask()->GetBitmap());
XSetClipOrigin ((Display*) m_display, (GC) m_gc, XLOG2DEV (xdest), YLOG2DEV (ydest));
}
}
- XCopyRemote((Display*) sourceDC->m_display, (Display*) m_display, (Pixmap) sourcePixmap, (Pixmap) m_pixmap, (GC) m_gc,
+ XCopyRemote((Display*) srcDpy, (Display*) m_display, (Pixmap) sourcePixmap, (Pixmap) m_pixmap, (GC) m_gc,
source->LogicalToDeviceX (xsrc),
source->LogicalToDeviceY (ysrc),
source->LogicalToDeviceXRel(width),
source->LogicalToDeviceX (xsrc),
source->LogicalToDeviceY (ysrc),
source->LogicalToDeviceXRel(width),
if (m_window && m_window->GetBackingPixmap())
{
// +++ MARKUS (mho@comnets.rwth-aachen): error on blitting bitmaps with depth 1
if (m_window && m_window->GetBackingPixmap())
{
// +++ MARKUS (mho@comnets.rwth-aachen): error on blitting bitmaps with depth 1
- if (source->IsKindOf(CLASSINFO(wxMemoryDC)) && ((wxMemoryDC*) source)->GetBitmap().GetDepth() == 1)
+ if (source->IsKindOf(CLASSINFO(wxMemoryDC)) && ((wxMemoryDC*) source)->GetSelectedBitmap().GetDepth() == 1)
{
XCopyPlane ((Display*) m_display, (Pixmap) sourcePixmap, (Pixmap) m_window->GetBackingPixmap(),(GC) m_gcBacking,
source->LogicalToDeviceX (xsrc),
{
XCopyPlane ((Display*) m_display, (Pixmap) sourcePixmap, (Pixmap) m_window->GetBackingPixmap(),(GC) m_gcBacking,
source->LogicalToDeviceX (xsrc),
if ( useMask && source->IsKindOf(CLASSINFO(wxMemoryDC)) )
{
wxMemoryDC *memDC = (wxMemoryDC *)source;
if ( useMask && source->IsKindOf(CLASSINFO(wxMemoryDC)) )
{
wxMemoryDC *memDC = (wxMemoryDC *)source;
- wxBitmap& sel = memDC->GetBitmap();
- if ( sel.Ok() && sel.GetMask() && sel.GetMask()->GetBitmap() )
+ wxBitmap& sel = memDC->GetSelectedBitmap();
+ if ( sel.IsOk() && sel.GetMask() && sel.GetMask()->GetBitmap() )
{
XSetClipMask ((Display*) m_display, (GC) m_gc, (Pixmap) sel.GetMask()->GetBitmap());
XSetClipOrigin ((Display*) m_display, (GC) m_gc, XLOG2DEV (xdest), YLOG2DEV (ydest));
{
XSetClipMask ((Display*) m_display, (GC) m_gc, (Pixmap) sel.GetMask()->GetBitmap());
XSetClipOrigin ((Display*) m_display, (GC) m_gc, XLOG2DEV (xdest), YLOG2DEV (ydest));
// Check if we're copying from a mono bitmap
if (source->IsKindOf(CLASSINFO(wxMemoryDC)) &&
// Check if we're copying from a mono bitmap
if (source->IsKindOf(CLASSINFO(wxMemoryDC)) &&
- ((wxMemoryDC*)source)->GetBitmap().Ok() && (((wxMemoryDC*)source)->GetBitmap().GetDepth () == 1))
+ ((wxMemoryDC*)source)->GetSelectedBitmap().IsOk() &&
+ (((wxMemoryDC*)source)->GetSelectedBitmap().GetDepth () == 1))
{
XCopyPlane ((Display*) m_display, (Pixmap) sourcePixmap, (Pixmap) m_pixmap, (GC) m_gc,
source->LogicalToDeviceX (xsrc),
{
XCopyPlane ((Display*) m_display, (Pixmap) sourcePixmap, (Pixmap) m_pixmap, (GC) m_gc,
source->LogicalToDeviceX (xsrc),
-void wxWindowDC::DoDrawText( const wxString &text, wxCoord x, wxCoord y )
+void wxWindowDCImpl::DoDrawText( const wxString &text, wxCoord x, wxCoord y )
- wxCHECK_RET( Ok(), "invalid dc" );
+ wxCHECK_RET( IsOk(), "invalid dc" );
// Since X draws from the baseline of the text, must add the text height
int cx = 0;
// Since X draws from the baseline of the text, must add the text height
int cx = 0;
XSetFillStyle ((Display*) m_display, (GC) m_gcBacking, FillSolid);
}
XSetFillStyle ((Display*) m_display, (GC) m_gcBacking, FillSolid);
}
wxGetTextExtent (m_display, m_font, m_userScaleY * m_logicalScaleY,
text, &cx, &cy, &ascent, NULL);
// First draw a rectangle representing the text background, if a text
// background is specified
wxGetTextExtent (m_display, m_font, m_userScaleY * m_logicalScaleY,
text, &cx, &cy, &ascent, NULL);
// 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))
{
wxColour oldPenColour = m_currentColour;
m_currentColour = m_textBackgroundColour;
{
wxColour oldPenColour = m_currentColour;
m_currentColour = m_textBackgroundColour;
- bool sameColour = (oldPenColour.Ok () && m_textBackgroundColour.Ok () &&
+ bool sameColour = (oldPenColour.IsOk () && m_textBackgroundColour.IsOk () &&
(oldPenColour.Red () == m_textBackgroundColour.Red ()) &&
(oldPenColour.Blue () == m_textBackgroundColour.Blue ()) &&
(oldPenColour.Green () == m_textBackgroundColour.Green ()));
(oldPenColour.Red () == m_textBackgroundColour.Red ()) &&
(oldPenColour.Blue () == m_textBackgroundColour.Blue ()) &&
(oldPenColour.Green () == m_textBackgroundColour.Green ()));
}
// Now set the text foreground and draw the text
}
// Now set the text foreground and draw the text
- if (m_textForegroundColour.Ok ())
+ if (m_textForegroundColour.IsOk ())
{
wxColour oldPenColour = m_currentColour;
m_currentColour = m_textForegroundColour;
{
wxColour oldPenColour = m_currentColour;
m_currentColour = m_textForegroundColour;
- bool sameColour = (oldPenColour.Ok () && m_currentColour.Ok () &&
+ bool sameColour = (oldPenColour.IsOk () && m_currentColour.IsOk () &&
(oldPenColour.Red () == m_currentColour.Red ()) &&
(oldPenColour.Blue () == m_currentColour.Blue ()) &&
(oldPenColour.Green () == m_currentColour.Green ()) &&
(oldPenColour.Red () == m_currentColour.Red ()) &&
(oldPenColour.Blue () == m_currentColour.Blue ()) &&
(oldPenColour.Green () == m_currentColour.Green ()) &&
gcBackingV.fill_style);
wxCoord w, h;
gcBackingV.fill_style);
wxCoord w, h;
- GetTextExtent (text, &w, &h);
+ DoGetTextExtent (text, &w, &h);
CalcBoundingBox (x + w, y + h);
CalcBoundingBox (x, y);
}
CalcBoundingBox (x + w, y + h);
CalcBoundingBox (x, y);
}
-void wxWindowDC::DoDrawRotatedText( const wxString &text, wxCoord x, wxCoord y,
+void wxWindowDCImpl::DoDrawRotatedText( const wxString &text, wxCoord x, wxCoord y,
double angle )
{
if (angle == 0.0)
{
double angle )
{
if (angle == 0.0)
{
+ DoDrawText(text, x, y);
- wxCHECK_RET( Ok(), "invalid dc" );
+ wxCHECK_RET( IsOk(), "invalid dc" );
WXPixel oldBackgroundPixel = -1;
WXPixel oldForegroundPixel = -1;
WXPixel foregroundPixel = -1;
WXPixel backgroundPixel = -1;
WXPixel oldBackgroundPixel = -1;
WXPixel oldForegroundPixel = -1;
WXPixel foregroundPixel = -1;
WXPixel backgroundPixel = -1;
- if (m_textBackgroundColour.Ok())
+ if (m_textBackgroundColour.IsOk())
{
oldBackgroundPixel = m_backgroundPixel;
backgroundPixel = m_textBackgroundColour.AllocColour(m_display);
}
{
oldBackgroundPixel = m_backgroundPixel;
backgroundPixel = m_textBackgroundColour.AllocColour(m_display);
}
- if (m_textForegroundColour.Ok())
+ if (m_textForegroundColour.IsOk())
{
oldForegroundPixel = m_currentColour.GetPixel();
{
oldForegroundPixel = m_currentColour.GetPixel();
int cy = 0;
int ascent = 0;
int cy = 0;
int ascent = 0;
wxGetTextExtent (m_display, m_font, m_userScaleY * m_logicalScaleY,
text, &cx, &cy, &ascent, NULL);
wxGetTextExtent (m_display, m_font, m_userScaleY * m_logicalScaleY,
text, &cx, &cy, &ascent, NULL);
CalcBoundingBox (maxx, maxy);
}
CalcBoundingBox (maxx, maxy);
}
-bool wxWindowDC::CanGetTextExtent() const
+bool wxWindowDCImpl::CanGetTextExtent() const
-void wxWindowDC::DoGetTextExtent( const wxString &string, wxCoord *width, wxCoord *height,
+void wxWindowDCImpl::DoGetTextExtent( const wxString &string, wxCoord *width, wxCoord *height,
wxCoord *descent, wxCoord *externalLeading,
const wxFont *font ) const
{
wxCoord *descent, wxCoord *externalLeading,
const wxFont *font ) const
{
- wxCHECK_RET( Ok(), "invalid dc" );
+ wxCHECK_RET( IsOk(), "invalid dc" );
const wxFont* theFont = font ? font : &m_font;
const wxFont* theFont = font ? font : &m_font;
{
// TODO: this should be an error log function
wxFAIL_MSG("set a valid font before calling GetTextExtent!");
{
// TODO: this should be an error log function
wxFAIL_MSG("set a valid font before calling GetTextExtent!");
-wxCoord wxWindowDC::GetCharWidth() const
+wxCoord wxWindowDCImpl::GetCharWidth() const
- wxCHECK_MSG( Ok(), 0, "invalid dc" );
- wxCHECK_MSG( m_font.Ok(), 0, "invalid font" );
+ wxCHECK_MSG( IsOk(), 0, "invalid dc" );
+ wxCHECK_MSG( m_font.IsOk(), 0, "invalid font" );
return XDEV2LOGREL(width);
}
return XDEV2LOGREL(width);
}
-wxCoord wxWindowDC::GetCharHeight() const
+wxCoord wxWindowDCImpl::GetCharHeight() const
- wxCHECK_MSG( Ok(), 0, "invalid dc" );
- wxCHECK_MSG( m_font.Ok(), 0, "invalid font" );
+ wxCHECK_MSG( IsOk(), 0, "invalid dc" );
+ wxCHECK_MSG( m_font.IsOk(), 0, "invalid font" );
return XDEV2LOGREL(height);
}
return XDEV2LOGREL(height);
}
-void wxWindowDC::DoGetSize( int *width, int *height ) const
+void wxWindowDCImpl::DoGetSize( int *width, int *height ) const
if( height ) *height = h;
}
if( height ) *height = h;
}
-void wxWindowDC::Clear()
+void wxWindowDCImpl::Clear()
- wxCHECK_RET( Ok(), "invalid dc" );
+ wxCHECK_RET( IsOk(), "invalid dc" );
wxRect rect( GetSize() );
Clear( rect );
}
wxRect rect( GetSize() );
Clear( rect );
}
-void wxWindowDC::Clear(const wxRect& rect)
+void wxWindowDCImpl::Clear(const wxRect& rect)
- wxCHECK_RET( Ok(), "invalid dc" );
+ wxCHECK_RET( IsOk(), "invalid dc" );
int x = rect.x; int y = rect.y;
int w = rect.width; int h = rect.height;
int x = rect.x; int y = rect.y;
int w = rect.width; int h = rect.height;
-void wxWindowDC::SetFont( const wxFont &font )
+void wxWindowDCImpl::SetFont( const wxFont &font )
- wxCHECK_RET( Ok(), "invalid dc" );
+ wxCHECK_RET( IsOk(), "invalid dc" );
-void wxWindowDC::SetForegroundPixelWithLogicalFunction(WXPixel pixel)
+void wxWindowDCImpl::SetForegroundPixelWithLogicalFunction(WXPixel pixel)
{
if (m_logicalFunction == wxXOR)
{
{
if (m_logicalFunction == wxXOR)
{
-WXPixel wxWindowDC::CalculatePixel(wxColour& colour, wxColour& curCol,
+WXPixel wxWindowDCImpl::CalculatePixel(wxColour& colour, wxColour& curCol,
bool roundToWhite) const
{
const unsigned char wp = (unsigned char)255;
bool roundToWhite) const
{
const unsigned char wp = (unsigned char)255;
-void wxWindowDC::SetPen( const wxPen &pen )
+void wxWindowDCImpl::SetPen( const wxPen &pen )
- wxCHECK_RET( Ok(), "invalid dc" );
+ wxCHECK_RET( IsOk(), "invalid dc" );
return;
wxBitmap oldStipple = m_currentStipple;
return;
wxBitmap oldStipple = m_currentStipple;
old_pen_dash == m_currentPenDash &&
old_pen_width == m_currentPenWidth);
old_pen_dash == m_currentPenDash &&
old_pen_width == m_currentPenWidth);
- bool sameColour = (oldPenColour.Ok () &&
+ bool sameColour = (oldPenColour.IsOk () &&
(oldPenColour.Red () == m_currentColour.Red ()) &&
(oldPenColour.Blue () == m_currentColour.Blue ()) &&
(oldPenColour.Green () == m_currentColour.Green ()) &&
(oldPenColour.Red () == m_currentColour.Red ()) &&
(oldPenColour.Blue () == m_currentColour.Blue ()) &&
(oldPenColour.Green () == m_currentColour.Green ()) &&
if (m_window && m_window->GetBackingPixmap())
XSetStipple ((Display*) m_display,(GC) m_gcBacking, myStipple);
}
if (m_window && m_window->GetBackingPixmap())
XSetStipple ((Display*) m_display,(GC) m_gcBacking, myStipple);
}
- else if (m_currentStyle == wxSTIPPLE && m_currentStipple.Ok()
+ else if (m_currentStyle == wxSTIPPLE && m_currentStipple.IsOk()
&& ((!m_currentStipple.IsSameAs(oldStipple)) || !GET_OPTIMIZATION))
{
XSetStipple ((Display*) m_display, (GC) m_gc, (Pixmap) m_currentStipple.GetDrawable());
&& ((!m_currentStipple.IsSameAs(oldStipple)) || !GET_OPTIMIZATION))
{
XSetStipple ((Display*) m_display, (GC) m_gc, (Pixmap) m_currentStipple.GetDrawable());
-void wxWindowDC::SetBrush( const wxBrush &brush )
+void wxWindowDCImpl::SetBrush( const wxBrush &brush )
- wxCHECK_RET( Ok(), "invalid dc" );
+ wxCHECK_RET( IsOk(), "invalid dc" );
- if (!m_brush.Ok() || m_brush.GetStyle () == wxTRANSPARENT)
+ if (!m_brush.IsOk() || m_brush.GetStyle () == wxTRANSPARENT)
return;
int oldFill = m_currentFill;
return;
int oldFill = m_currentFill;
wxColour oldBrushColour(m_currentColour);
m_currentColour = m_brush.GetColour ();
wxColour oldBrushColour(m_currentColour);
m_currentColour = m_brush.GetColour ();
- bool sameColour = (oldBrushColour.Ok () &&
+ bool sameColour = (oldBrushColour.IsOk () &&
(oldBrushColour.Red () == m_currentColour.Red ()) &&
(oldBrushColour.Blue () == m_currentColour.Blue ()) &&
(oldBrushColour.Green () == m_currentColour.Green ()) &&
(oldBrushColour.Red () == m_currentColour.Red ()) &&
(oldBrushColour.Blue () == m_currentColour.Blue ()) &&
(oldBrushColour.Green () == m_currentColour.Green ()) &&
// X can forget the stipple value when resizing a window (apparently)
// so always set the stipple.
else if (m_currentFill != wxSOLID && m_currentFill != wxTRANSPARENT &&
// X can forget the stipple value when resizing a window (apparently)
// so always set the stipple.
else if (m_currentFill != wxSOLID && m_currentFill != wxTRANSPARENT &&
- m_currentStipple.Ok()) // && m_currentStipple != oldStipple)
+ m_currentStipple.IsOk()) // && m_currentStipple != oldStipple)
{
if (m_currentStipple.GetDepth() == 1)
{
{
if (m_currentStipple.GetDepth() == 1)
{
m_brush.GetColour().SetPixel(oldBrushColour.GetPixel());
}
m_brush.GetColour().SetPixel(oldBrushColour.GetPixel());
}
-void wxWindowDC::SetBackground( const wxBrush &brush )
+void wxWindowDCImpl::SetBackground( const wxBrush &brush )
- wxCHECK_RET( Ok(), "invalid dc" );
+ wxCHECK_RET( IsOk(), "invalid dc" );
m_backgroundBrush = brush;
m_backgroundBrush = brush;
- if (!m_backgroundBrush.Ok())
+ if (!m_backgroundBrush.IsOk())
return;
m_backgroundPixel = m_backgroundBrush.GetColour().AllocColour(m_display);
return;
m_backgroundPixel = m_backgroundBrush.GetColour().AllocColour(m_display);
-void wxWindowDC::SetLogicalFunction( int function )
+void wxWindowDCImpl::SetLogicalFunction( int function )
- wxCHECK_RET( Ok(), "invalid dc" );
+ wxCHECK_RET( IsOk(), "invalid dc" );
-void wxWindowDC::SetTextForeground( const wxColour &col )
+void wxWindowDCImpl::SetTextForeground( const wxColour &col )
- wxCHECK_RET( Ok(), "invalid dc" );
+ wxCHECK_RET( IsOk(), "invalid dc" );
m_textForegroundColour = col;
}
m_textForegroundColour = col;
}
-void wxWindowDC::SetTextBackground( const wxColour &col )
+void wxWindowDCImpl::SetTextBackground( const wxColour &col )
- wxCHECK_RET( Ok(), "invalid dc" );
+ wxCHECK_RET( IsOk(), "invalid dc" );
m_textBackgroundColour = col;
}
m_textBackgroundColour = col;
}
-void wxWindowDC::SetBackgroundMode( int mode )
+void wxWindowDCImpl::SetBackgroundMode( int mode )
{
m_backgroundMode = mode;
}
{
m_backgroundMode = mode;
}
-void wxWindowDC::SetPalette( const wxPalette& palette )
+void wxWindowDCImpl::SetPalette( const wxPalette& palette )
/* Use GetXColormap */
XSetWindowColormap ((Display*) m_display, (Window) m_window->GetXWindow(),
(Colormap) palette.GetXColormap());
/* Use GetXColormap */
XSetWindowColormap ((Display*) m_display, (Window) m_window->GetXWindow(),
(Colormap) palette.GetXColormap());
}
// Helper function; userRegion is the region set by calling SetClippingRegion
}
// Helper function; userRegion is the region set by calling SetClippingRegion
-void wxWindowDC::SetDCClipping( WXRegion userRegion )
+void wxWindowDCImpl::SetDCClipping( WXRegion userRegion )
- bool hasUpdateRegion = m_window && m_window->GetUpdateRegion().Ok();
+ bool hasUpdateRegion = m_window && m_window->GetUpdateRegion().IsOk();
// this means that we should start the clip region from scratch,
// or from the update region, if any
if( !userRegion )
// this means that we should start the clip region from scratch,
// or from the update region, if any
if( !userRegion )
XSetClipMask( (Display*)m_display, (GC)m_gc, None );
}
XSetClipMask( (Display*)m_display, (GC)m_gc, None );
}
-void wxWindowDC::DoSetClippingRegion( wxCoord x, wxCoord y,
+void wxWindowDCImpl::DoSetClippingRegion( wxCoord x, wxCoord y,
wxCoord width, wxCoord height )
{
wxCoord width, wxCoord height )
{
- wxDC::DoSetClippingRegion( x, y, width, height );
+ wxMotifDCImpl::DoSetClippingRegion( x, y, width, height );
wxRegion temp(XLOG2DEV(x), YLOG2DEV(y),
XLOG2DEVREL(width), YLOG2DEVREL(height));
wxRegion temp(XLOG2DEV(x), YLOG2DEV(y),
XLOG2DEVREL(width), YLOG2DEVREL(height));
-void wxWindowDC::DoSetClippingRegionAsRegion( const wxRegion& region )
+void wxWindowDCImpl::DoSetClippingRegionAsRegion( const wxRegion& region )
{
SetDCClipping(region.GetX11Region());
{
SetDCClipping(region.GetX11Region());
-void wxWindowDC::DestroyClippingRegion()
+void wxWindowDCImpl::DestroyClippingRegion()
- wxDC::DestroyClippingRegion();
+ wxMotifDCImpl::DestroyClippingRegion();
}
// Resolution in pixels per logical inch
}
// Resolution in pixels per logical inch
-wxSize wxWindowDC::GetPPI() const
+wxSize wxWindowDCImpl::GetPPI() const
{
// TODO
return wxSize(100, 100);
}
{
// TODO
return wxSize(100, 100);
}
-int wxWindowDC::GetDepth() const
+int wxWindowDCImpl::GetDepth() const
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
-wxPaintDC::wxPaintDC(wxWindow* win) : wxWindowDC(win)
+wxPaintDCImpl::wxPaintDCImpl(wxDC *owner, wxWindow* win)
+ : wxWindowDCImpl(owner, win)
{
// Set the clipping region.to the update region
SetDCClipping((WXRegion)NULL);
}
{
// Set the clipping region.to the update region
SetDCClipping((WXRegion)NULL);
}
+wxPaintDCImpl::~wxPaintDCImpl()
{
if (m_window)
m_window->ClearUpdateRegion();
{
if (m_window)
m_window->ClearUpdateRegion();
-#if 0
-
-/* Helper function for 16-bit fonts */
-static int str16len(const char *s)
-{
- int count = 0;
-
- while (s[0] && s[1]) {
- count++;
- s += 2;
- }
-
- return count;
-}
-
-#endif // 0
/////////////////////////////////////////////////////////////////////////////
// Name: src/motif/dcmemory.cpp
/////////////////////////////////////////////////////////////////////////////
// Name: src/motif/dcmemory.cpp
-// Purpose: wxMemoryDC class
+// Purpose: wxMemoryDCImpl class
// Author: Julian Smart
// Modified by:
// Created: 01/02/97
// Author: Julian Smart
// Modified by:
// Created: 01/02/97
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
-#include "wx/dcmemory.h"
-
#ifndef WX_PRECOMP
#include "wx/utils.h"
#include "wx/settings.h"
#ifndef WX_PRECOMP
#include "wx/utils.h"
#include "wx/settings.h"
#endif
#include "wx/motif/private.h"
#endif
#include "wx/motif/private.h"
+#include "wx/motif/dcmemory.h"
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
-IMPLEMENT_DYNAMIC_CLASS(wxMemoryDC, wxWindowDC)
+IMPLEMENT_ABSTRACT_CLASS(wxMemoryDCImpl, wxWindowDCImpl)
+void wxMemoryDCImpl::Init()
{
m_ok = true;
m_display = wxGetDisplay();
{
m_ok = true;
m_display = wxGetDisplay();
SetFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT));
}
SetFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT));
}
-wxMemoryDC::wxMemoryDC( wxDC* dc )
+wxMemoryDCImpl::wxMemoryDCImpl(wxMemoryDC *owner, wxDC* dc)
+ : wxWindowDCImpl(owner)
{
m_ok = true;
if (dc && dc->IsKindOf(CLASSINFO(wxWindowDC)))
{
m_ok = true;
if (dc && dc->IsKindOf(CLASSINFO(wxWindowDC)))
- m_display = ((wxWindowDC*)dc)->GetDisplay();
+ m_display = ((wxWindowDCImpl *)dc->GetImpl())->GetDisplay();
else
m_display = wxGetDisplay();
else
m_display = wxGetDisplay();
SetPen (* wxBLACK_PEN);
}
SetPen (* wxBLACK_PEN);
}
-wxMemoryDC::~wxMemoryDC(void)
+wxMemoryDCImpl::~wxMemoryDCImpl(void)
-void wxMemoryDC::DoSelect( const wxBitmap& bitmap )
+void wxMemoryDCImpl::DoSelect( const wxBitmap& bitmap )
-void wxMemoryDC::DoGetSize( int *width, int *height ) const
+void wxMemoryDCImpl::DoGetSize( int *width, int *height ) const
/////////////////////////////////////////////////////////////////////////////
// Name: src/motif/dcscreen.cpp
/////////////////////////////////////////////////////////////////////////////
// Name: src/motif/dcscreen.cpp
-// Purpose: wxScreenDC class
+// Purpose: wxScreenDCImpl class
// Author: Julian Smart
// Modified by:
// Created: 17/09/98
// Author: Julian Smart
// Modified by:
// Created: 17/09/98
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
-#include "wx/dcscreen.h"
-
#ifndef WX_PRECOMP
#include "wx/utils.h"
#include "wx/window.h"
#ifndef WX_PRECOMP
#include "wx/utils.h"
#include "wx/window.h"
#endif
#include "wx/motif/private.h"
#endif
#include "wx/motif/private.h"
+#include "wx/motif/dcscreen.h"
-IMPLEMENT_DYNAMIC_CLASS(wxScreenDC, wxWindowDC)
+IMPLEMENT_ABSTRACT_CLASS(wxScreenDCImpl, wxWindowDCImpl)
-WXWindow wxScreenDC::sm_overlayWindow = 0;
-int wxScreenDC::sm_overlayWindowX = 0;
-int wxScreenDC::sm_overlayWindowY = 0;
+WXWindow wxScreenDCImpl::sm_overlayWindow = 0;
+int wxScreenDCImpl::sm_overlayWindowX = 0;
+int wxScreenDCImpl::sm_overlayWindowY = 0;
// Create a DC representing the whole screen
// Create a DC representing the whole screen
-wxScreenDC::wxScreenDC()
+wxScreenDCImpl::wxScreenDCImpl(wxScreenDC *owner)
+ : wxWindowDCImpl(owner)
{
m_display = wxGetDisplay();
Display* display = (Display*) m_display;
{
m_display = wxGetDisplay();
Display* display = (Display*) m_display;
-wxScreenDC::~wxScreenDC()
+wxScreenDCImpl::~wxScreenDCImpl()
-bool wxScreenDC::StartDrawingOnTop(wxWindow* window)
+bool wxScreenDCImpl::StartDrawingOnTop(wxWindow* window)
{
wxRect rect;
int x, y, width, height;
{
wxRect rect;
int x, y, width, height;
return StartDrawingOnTop(& rect);
}
return StartDrawingOnTop(& rect);
}
-bool wxScreenDC::StartDrawingOnTop(wxRect* rect)
+bool wxScreenDCImpl::StartDrawingOnTop(wxRect* rect)
{
if (sm_overlayWindow)
return false;
{
if (sm_overlayWindow)
return false;
-bool wxScreenDC::EndDrawingOnTop()
+bool wxScreenDCImpl::EndDrawingOnTop()
{
if (sm_overlayWindow)
{
{
if (sm_overlayWindow)
{
#endif
#include "wx/motif/private.h"
#endif
#include "wx/motif/private.h"
+#include "wx/motif/dcclient.h"
int y2 = (dy >= 0) ? y + dy : y;
wxClientDC dc(this);
int y2 = (dy >= 0) ? y + dy : y;
wxClientDC dc(this);
+ wxClientDCImpl * const
+ dcimpl = static_cast<wxClientDCImpl *>(dc.GetImpl());
+ GC const gc = (GC) dcimpl->GetGC();
dc.SetLogicalFunction (wxCOPY);
dc.SetLogicalFunction (wxCOPY);
Window window = XtWindow(widget);
Display* display = XtDisplay(widget);
Window window = XtWindow(widget);
Display* display = XtDisplay(widget);
- XCopyArea(display, window, window, (GC) dc.GetGC(),
- x1, y1, w1, h1, x2, y2);
+ XCopyArea(display, window, window, gc, x1, y1, w1, h1, x2, y2);
- dc.SetAutoSetting(true);
+ dcimpl->SetAutoSetting(true);
wxBrush brush(GetBackgroundColour(), wxSOLID);
dc.SetBrush(brush); // FIXME: needed?
wxBrush brush(GetBackgroundColour(), wxSOLID);
dc.SetBrush(brush); // FIXME: needed?
rect->width = dx;
rect->height = h;
rect->width = dx;
rect->height = h;
- XFillRectangle(display, window,
- (GC) dc.GetGC(), rect->x, rect->y, rect->width, rect->height);
+ XFillRectangle(display, window, gc, rect->x, rect->y, rect->width, rect->height);
rect->x = rect->x;
rect->y = rect->y;
rect->x = rect->x;
rect->y = rect->y;
rect->width = -dx;
rect->height = h;
rect->width = -dx;
rect->height = h;
- XFillRectangle(display, window,
- (GC) dc.GetGC(), rect->x, rect->y, rect->width,
- rect->height);
+ XFillRectangle(display, window, gc, rect->x, rect->y, rect->width, rect->height);
rect->x = rect->x;
rect->y = rect->y;
rect->x = rect->x;
rect->y = rect->y;
rect->width = w;
rect->height = dy;
rect->width = w;
rect->height = dy;
- XFillRectangle(display, window,
- (GC) dc.GetGC(), rect->x, rect->y, rect->width, rect->height);
+ XFillRectangle(display, window, gc, rect->x, rect->y, rect->width, rect->height);
rect->x = rect->x;
rect->y = rect->y;
rect->x = rect->x;
rect->y = rect->y;
rect->width = w;
rect->height = -dy;
rect->width = w;
rect->height = -dy;
- XFillRectangle(display, window,
- (GC) dc.GetGC(), rect->x, rect->y, rect->width, rect->height);
+ XFillRectangle(display, window, gc, rect->x, rect->y, rect->width, rect->height);
rect->x = rect->x;
rect->y = rect->y;
rect->x = rect->x;
rect->y = rect->y;
wxClientDC dc(this);
wxBrush backgroundBrush(GetBackgroundColour(), wxSOLID);
dc.SetBackground(backgroundBrush);
wxClientDC dc(this);
wxBrush backgroundBrush(GetBackgroundColour(), wxSOLID);
dc.SetBackground(backgroundBrush);
+
+ wxClientDCImpl * const
+ dcimpl = static_cast<wxClientDCImpl *>(dc.GetImpl());
}
XSendEvent(display, thisWindow, False, ExposureMask, (XEvent *)&dummyEvent);
}
XSendEvent(display, thisWindow, False, ExposureMask, (XEvent *)&dummyEvent);
- GC tempGC = (GC) dc.GetBackingGC();
+ wxPaintDCImpl * const
+ dcimpl = static_cast<wxPaintDCImpl *>(dc.GetImpl());
+
+ GC tempGC = (GC) dcimpl->GetBackingGC();
Widget widget = (Widget) GetMainWidget();
Widget widget = (Widget) GetMainWidget();