#include "wx/dynarray.h"
#include "wx/math.h"
#include "wx/image.h"
+#include "wx/cmndata.h"
- // 1 if using the reorganized DC code
-#define wxUSE_NEW_DC 0
-
+#define wxUSE_NEW_DC 1
-#if wxUSE_NEW_DC
class WXDLLIMPEXP_FWD_CORE wxDC;
class WXDLLIMPEXP_FWD_CORE wxClientDC;
class WXDLLIMPEXP_FWD_CORE wxPaintDC;
class WXDLLIMPEXP_FWD_CORE wxScreenDC;
class WXDLLIMPEXP_FWD_CORE wxMemoryDC;
class WXDLLIMPEXP_FWD_CORE wxPrinterDC;
-#include "wx/cmndata.h"
-#else
-class WXDLLIMPEXP_FWD_CORE wxDCBase;
-#endif
+
+//-----------------------------------------------------------------------------
+// wxDrawObject helper class
+//-----------------------------------------------------------------------------
class WXDLLEXPORT wxDrawObject
{
virtual ~wxDrawObject() { }
-#if wxUSE_NEW_DC
virtual void Draw(wxDC&) const { }
-#else
- virtual void Draw(wxDCBase&) const { }
-#endif
virtual void CalcBoundingBox(wxCoord x, wxCoord y)
{
};
-#if wxUSE_NEW_DC
-
//-----------------------------------------------------------------------------
// wxDCFactory
//-----------------------------------------------------------------------------
-class WXDLLIMPEXP_FWD_CORE wxImplDC;
+class WXDLLIMPEXP_FWD_CORE wxDCImpl;
class WXDLLIMPEXP_CORE wxDCFactory
{
wxDCFactory() {}
virtual ~wxDCFactory() {}
- virtual wxImplDC* CreateWindowDC( wxWindowDC *owner ) = 0;
- virtual wxImplDC* CreateWindowDC( wxWindowDC *owner, wxWindow *window ) = 0;
- virtual wxImplDC* CreateClientDC( wxClientDC *owner ) = 0;
- virtual wxImplDC* CreateClientDC( wxClientDC *owner, wxWindow *window ) = 0;
- virtual wxImplDC* CreatePaintDC( wxPaintDC *owner ) = 0;
- virtual wxImplDC* CreatePaintDC( wxPaintDC *owner, wxWindow *window ) = 0;
- virtual wxImplDC* CreateMemoryDC( wxMemoryDC *owner ) = 0;
- virtual wxImplDC* CreateMemoryDC( wxMemoryDC *owner, wxBitmap &bitmap ) = 0;
- virtual wxImplDC* CreateMemoryDC( wxMemoryDC *owner, wxDC *dc ) = 0;
- virtual wxImplDC* CreateScreenDC( wxScreenDC *owner ) = 0;
- virtual wxImplDC* CreatePrinterDC( wxPrinterDC *owner, const wxPrintData &data ) = 0;
+ virtual wxDCImpl* CreateWindowDC( wxWindowDC *owner ) = 0;
+ virtual wxDCImpl* CreateWindowDC( wxWindowDC *owner, wxWindow *window ) = 0;
+ virtual wxDCImpl* CreateClientDC( wxClientDC *owner ) = 0;
+ virtual wxDCImpl* CreateClientDC( wxClientDC *owner, wxWindow *window ) = 0;
+ virtual wxDCImpl* CreatePaintDC( wxPaintDC *owner ) = 0;
+ virtual wxDCImpl* CreatePaintDC( wxPaintDC *owner, wxWindow *window ) = 0;
+ virtual wxDCImpl* CreateMemoryDC( wxMemoryDC *owner ) = 0;
+ virtual wxDCImpl* CreateMemoryDC( wxMemoryDC *owner, wxBitmap &bitmap ) = 0;
+ virtual wxDCImpl* CreateMemoryDC( wxMemoryDC *owner, wxDC *dc ) = 0;
+ virtual wxDCImpl* CreateScreenDC( wxScreenDC *owner ) = 0;
+ virtual wxDCImpl* CreatePrinterDC( wxPrinterDC *owner, const wxPrintData &data ) = 0;
static void SetDCFactory( wxDCFactory *factory );
static wxDCFactory *GetFactory();
public:
wxNativeDCFactory() {}
- virtual wxImplDC* CreateWindowDC( wxWindowDC *owner );
- virtual wxImplDC* CreateWindowDC( wxWindowDC *owner, wxWindow *window );
- virtual wxImplDC* CreateClientDC( wxClientDC *owner );
- virtual wxImplDC* CreateClientDC( wxClientDC *owner, wxWindow *window );
- virtual wxImplDC* CreatePaintDC( wxPaintDC *owner );
- virtual wxImplDC* CreatePaintDC( wxPaintDC *owner, wxWindow *window );
- virtual wxImplDC* CreateMemoryDC( wxMemoryDC *owner );
- virtual wxImplDC* CreateMemoryDC( wxMemoryDC *owner, wxBitmap &bitmap );
- virtual wxImplDC* CreateMemoryDC( wxMemoryDC *owner, wxDC *dc );
- virtual wxImplDC* CreateScreenDC( wxScreenDC *owner );
- virtual wxImplDC* CreatePrinterDC( wxPrinterDC *owner, const wxPrintData &data );
+ virtual wxDCImpl* CreateWindowDC( wxWindowDC *owner );
+ virtual wxDCImpl* CreateWindowDC( wxWindowDC *owner, wxWindow *window );
+ virtual wxDCImpl* CreateClientDC( wxClientDC *owner );
+ virtual wxDCImpl* CreateClientDC( wxClientDC *owner, wxWindow *window );
+ virtual wxDCImpl* CreatePaintDC( wxPaintDC *owner );
+ virtual wxDCImpl* CreatePaintDC( wxPaintDC *owner, wxWindow *window );
+ virtual wxDCImpl* CreateMemoryDC( wxMemoryDC *owner );
+ virtual wxDCImpl* CreateMemoryDC( wxMemoryDC *owner, wxBitmap &bitmap );
+ virtual wxDCImpl* CreateMemoryDC( wxMemoryDC *owner, wxDC *dc );
+ virtual wxDCImpl* CreateScreenDC( wxScreenDC *owner );
+ virtual wxDCImpl* CreatePrinterDC( wxPrinterDC *owner, const wxPrintData &data );
};
//-----------------------------------------------------------------------------
-// wxImplDC
+// wxDCImpl
//-----------------------------------------------------------------------------
-class WXDLLIMPEXP_CORE wxImplDC: public wxObject
+class WXDLLIMPEXP_CORE wxDCImpl: public wxObject
{
public:
- wxImplDC( wxDC *owner );
- ~wxImplDC();
+ wxDCImpl( wxDC *owner );
+ ~wxDCImpl();
wxDC *GetOwner() const { return m_owner; }
+ wxWindow* GetWindow() const { return m_window; }
+
virtual bool IsOk() const { return m_ok; }
// query capabilities
{ return -1; }
private:
- wxDC *m_owner;
+ wxDC *m_owner;
protected:
// unset clipping variables (after clipping region was destroyed)
m_clipX1 = m_clipX2 = m_clipY1 = m_clipY2 = 0;
}
+ // window on which the DC draws or NULL
+ wxWindow *m_window;
+
// flags
bool m_colour:1;
bool m_ok:1;
#endif // wxUSE_PALETTE
private:
- DECLARE_ABSTRACT_CLASS(wxImplDC)
+ DECLARE_ABSTRACT_CLASS(wxDCImpl)
};
-class wxDC: public wxObject
+class WXDLLIMPEXP_CORE wxDC: public wxObject
{
public:
wxDC() { m_pimpl = NULL; }
+ ~wxDC() { if (m_pimpl) delete m_pimpl; }
- wxImplDC *GetImpl()
+ wxDCImpl *GetImpl()
{ return m_pimpl; }
- const wxImplDC *GetImpl() const
+ const wxDCImpl *GetImpl() const
{ return m_pimpl; }
+ wxWindow *GetWindow()
+ { return m_pimpl->GetWindow(); }
bool IsOk() const
{ return m_pimpl && m_pimpl->IsOk(); }
protected:
- wxImplDC *m_pimpl;
-
-private:
- DECLARE_ABSTRACT_CLASS(wxImplDC)
-};
-
-
-//-----------------------------------------------------------------------------
-// wxWindowDC
-//-----------------------------------------------------------------------------
-
-class WXDLLIMPEXP_CORE wxWindowDC : public wxDC
-{
-public:
- wxWindowDC();
- wxWindowDC( wxWindow *win );
-
-private:
- DECLARE_DYNAMIC_CLASS(wxWindowDC)
-};
-
-//-----------------------------------------------------------------------------
-// wxClientDC
-//-----------------------------------------------------------------------------
-
-class WXDLLIMPEXP_CORE wxClientDC : public wxDC
-{
-public:
- wxClientDC();
- wxClientDC( wxWindow *win );
-
-private:
- DECLARE_DYNAMIC_CLASS(wxClientDC)
-};
-
-//-----------------------------------------------------------------------------
-// wxPaintDC
-//-----------------------------------------------------------------------------
-
-class WXDLLIMPEXP_CORE wxPaintDC : public wxDC
-{
-public:
- wxPaintDC();
- wxPaintDC( wxWindow *win );
+ wxDCImpl *m_pimpl;
private:
- DECLARE_DYNAMIC_CLASS(wxPaintDC)
+ DECLARE_ABSTRACT_CLASS(wxDC)
};
-#else // wxUSE_NEW_DC
-
-
-class WXDLLIMPEXP_FWD_CORE wxDC;
-
-// ---------------------------------------------------------------------------
-// global variables
-// ---------------------------------------------------------------------------
-
-// ---------------------------------------------------------------------------
-// wxDC is the device context - object on which any drawing is done
-// ---------------------------------------------------------------------------
-
-class WXDLLEXPORT wxDCBase : public wxObject
-{
-public:
- wxDCBase();
- virtual ~wxDCBase();
-
- // graphic primitives
- // ------------------
-
- virtual void DrawObject(wxDrawObject* drawobject)
- {
- drawobject->Draw(*this);
- CalcBoundingBox(drawobject->MinX(),drawobject->MinY());
- CalcBoundingBox(drawobject->MaxX(),drawobject->MaxY());
- }
-
- wxDC *GetOwner() const { return (wxDC*) this; }
-
- bool FloodFill(wxCoord x, wxCoord y, const wxColour& col,
- int style = wxFLOOD_SURFACE)
- { return DoFloodFill(x, y, col, style); }
- bool FloodFill(const wxPoint& pt, const wxColour& col,
- int style = wxFLOOD_SURFACE)
- { return DoFloodFill(pt.x, pt.y, col, style); }
-
- // fill the area specified by rect with a radial gradient, starting from
- // initialColour in the centre of the cercle and fading to destColour.
- void GradientFillConcentric(const wxRect& rect,
- const wxColour& initialColour,
- const wxColour& destColour)
- { GradientFillConcentric(rect, initialColour, destColour,
- wxPoint(rect.GetWidth() / 2,
- rect.GetHeight() / 2)); }
-
- void GradientFillConcentric(const wxRect& rect,
- const wxColour& initialColour,
- const wxColour& destColour,
- const wxPoint& circleCenter)
- { DoGradientFillConcentric(rect, initialColour, destColour, circleCenter); }
-
- // fill the area specified by rect with a linear gradient
- void GradientFillLinear(const wxRect& rect,
- const wxColour& initialColour,
- const wxColour& destColour,
- wxDirection nDirection = wxEAST)
- { DoGradientFillLinear(rect, initialColour, destColour, nDirection); }
-
- bool GetPixel(wxCoord x, wxCoord y, wxColour *col) const
- { return DoGetPixel(x, y, col); }
- bool GetPixel(const wxPoint& pt, wxColour *col) const
- { return DoGetPixel(pt.x, pt.y, col); }
-
- void DrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2)
- { DoDrawLine(x1, y1, x2, y2); }
- void DrawLine(const wxPoint& pt1, const wxPoint& pt2)
- { DoDrawLine(pt1.x, pt1.y, pt2.x, pt2.y); }
-
- void CrossHair(wxCoord x, wxCoord y)
- { DoCrossHair(x, y); }
- void CrossHair(const wxPoint& pt)
- { DoCrossHair(pt.x, pt.y); }
-
- void DrawArc(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2,
- wxCoord xc, wxCoord yc)
- { DoDrawArc(x1, y1, x2, y2, xc, yc); }
- void DrawArc(const wxPoint& pt1, const wxPoint& pt2, const wxPoint& centre)
- { DoDrawArc(pt1.x, pt1.y, pt2.x, pt2.y, centre.x, centre.y); }
-
- void DrawCheckMark(wxCoord x, wxCoord y,
- wxCoord width, wxCoord height)
- { DoDrawCheckMark(x, y, width, height); }
- void DrawCheckMark(const wxRect& rect)
- { DoDrawCheckMark(rect.x, rect.y, rect.width, rect.height); }
-
- void DrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h,
- double sa, double ea)
- { DoDrawEllipticArc(x, y, w, h, sa, ea); }
- void DrawEllipticArc(const wxPoint& pt, const wxSize& sz,
- double sa, double ea)
- { DoDrawEllipticArc(pt.x, pt.y, sz.x, sz.y, sa, ea); }
-
- void DrawPoint(wxCoord x, wxCoord y)
- { DoDrawPoint(x, y); }
- void DrawPoint(const wxPoint& pt)
- { DoDrawPoint(pt.x, pt.y); }
-
- void DrawLines(int n, wxPoint points[],
- wxCoord xoffset = 0, wxCoord yoffset = 0)
- { DoDrawLines(n, points, xoffset, yoffset); }
- void DrawLines(const wxPointList *list,
- wxCoord xoffset = 0, wxCoord yoffset = 0);
-
-#if WXWIN_COMPATIBILITY_2_8
- wxDEPRECATED( void DrawLines(const wxList *list,
- wxCoord xoffset = 0, wxCoord yoffset = 0) );
-#endif // WXWIN_COMPATIBILITY_2_8
-
-
- void DrawPolygon(int n, wxPoint points[],
- wxCoord xoffset = 0, wxCoord yoffset = 0,
- int fillStyle = wxODDEVEN_RULE)
- { DoDrawPolygon(n, points, xoffset, yoffset, fillStyle); }
-
- void DrawPolygon(const wxPointList *list,
- wxCoord xoffset = 0, wxCoord yoffset = 0,
- int fillStyle = wxODDEVEN_RULE);
-
-#if WXWIN_COMPATIBILITY_2_8
- wxDEPRECATED( void DrawPolygon(const wxList *list,
- wxCoord xoffset = 0, wxCoord yoffset = 0,
- int fillStyle = wxODDEVEN_RULE) );
-#endif // WXWIN_COMPATIBILITY_2_8
-
- void DrawPolyPolygon(int n, int count[], wxPoint points[],
- wxCoord xoffset = 0, wxCoord yoffset = 0,
- int fillStyle = wxODDEVEN_RULE)
- { DoDrawPolyPolygon(n, count, points, xoffset, yoffset, fillStyle); }
-
- void DrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
- { DoDrawRectangle(x, y, width, height); }
- void DrawRectangle(const wxPoint& pt, const wxSize& sz)
- { DoDrawRectangle(pt.x, pt.y, sz.x, sz.y); }
- void DrawRectangle(const wxRect& rect)
- { DoDrawRectangle(rect.x, rect.y, rect.width, rect.height); }
-
- void DrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height,
- double radius)
- { DoDrawRoundedRectangle(x, y, width, height, radius); }
- void DrawRoundedRectangle(const wxPoint& pt, const wxSize& sz,
- double radius)
- { DoDrawRoundedRectangle(pt.x, pt.y, sz.x, sz.y, radius); }
- void DrawRoundedRectangle(const wxRect& r, double radius)
- { DoDrawRoundedRectangle(r.x, r.y, r.width, r.height, radius); }
-
- void DrawCircle(wxCoord x, wxCoord y, wxCoord radius)
- { DoDrawEllipse(x - radius, y - radius, 2*radius, 2*radius); }
- void DrawCircle(const wxPoint& pt, wxCoord radius)
- { DrawCircle(pt.x, pt.y, radius); }
-
- void DrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
- { DoDrawEllipse(x, y, width, height); }
- void DrawEllipse(const wxPoint& pt, const wxSize& sz)
- { DoDrawEllipse(pt.x, pt.y, sz.x, sz.y); }
- void DrawEllipse(const wxRect& rect)
- { DoDrawEllipse(rect.x, rect.y, rect.width, rect.height); }
-
- void DrawIcon(const wxIcon& icon, wxCoord x, wxCoord y)
- { DoDrawIcon(icon, x, y); }
- void DrawIcon(const wxIcon& icon, const wxPoint& pt)
- { DoDrawIcon(icon, pt.x, pt.y); }
-
- void DrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y,
- bool useMask = false)
- { DoDrawBitmap(bmp, x, y, useMask); }
- void DrawBitmap(const wxBitmap &bmp, const wxPoint& pt,
- bool useMask = false)
- { DoDrawBitmap(bmp, pt.x, pt.y, useMask); }
-
- void DrawText(const wxString& text, wxCoord x, wxCoord y)
- { DoDrawText(text, x, y); }
- void DrawText(const wxString& text, const wxPoint& pt)
- { DoDrawText(text, pt.x, pt.y); }
-
- void DrawRotatedText(const wxString& text, wxCoord x, wxCoord y, double angle)
- { DoDrawRotatedText(text, x, y, angle); }
- void DrawRotatedText(const wxString& text, const wxPoint& pt, double angle)
- { DoDrawRotatedText(text, pt.x, pt.y, angle); }
-
- // this version puts both optional bitmap and the text into the given
- // rectangle and aligns is as specified by alignment parameter; it also
- // will emphasize the character with the given index if it is != -1 and
- // return the bounding rectangle if required
- virtual void DrawLabel(const wxString& text,
- const wxBitmap& image,
- const wxRect& rect,
- int alignment = wxALIGN_LEFT | wxALIGN_TOP,
- int indexAccel = -1,
- wxRect *rectBounding = NULL);
-
- void DrawLabel(const wxString& text, const wxRect& rect,
- int alignment = wxALIGN_LEFT | wxALIGN_TOP,
- int indexAccel = -1)
- { DrawLabel(text, wxNullBitmap, rect, alignment, indexAccel); }
-
- bool Blit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
- wxDC *source, wxCoord xsrc, wxCoord ysrc,
- int rop = wxCOPY, bool useMask = false, wxCoord xsrcMask = wxDefaultCoord, wxCoord ysrcMask = wxDefaultCoord)
- {
- return DoBlit(xdest, ydest, width, height,
- source, xsrc, ysrc, rop, useMask, xsrcMask, ysrcMask);
- }
- bool Blit(const wxPoint& destPt, const wxSize& sz,
- wxDC *source, const wxPoint& srcPt,
- int rop = wxCOPY, bool useMask = false, const wxPoint& srcPtMask = wxDefaultPosition)
- {
- return DoBlit(destPt.x, destPt.y, sz.x, sz.y,
- source, srcPt.x, srcPt.y, rop, useMask, srcPtMask.x, srcPtMask.y);
- }
-
- bool StretchBlit(wxCoord dstX, wxCoord dstY,
- wxCoord dstWidth, wxCoord dstHeight,
- wxDC *source,
- wxCoord srcX, wxCoord srcY,
- wxCoord srcWidth, wxCoord srcHeight,
- int rop = wxCOPY, bool useMask = false,
- wxCoord srcMaskX = wxDefaultCoord, wxCoord srcMaskY = wxDefaultCoord)
- {
- return DoStretchBlit(dstX, dstY, dstWidth, dstHeight,
- source, srcX, srcY, srcWidth, srcHeight, rop, useMask, srcMaskX, srcMaskY);
- }
- bool StretchBlit(const wxPoint& dstPt, const wxSize& dstSize,
- wxDC *source, const wxPoint& srcPt, const wxSize& srcSize,
- int rop = wxCOPY, bool useMask = false, const wxPoint& srcMaskPt = wxDefaultPosition)
- {
- return DoStretchBlit(dstPt.x, dstPt.y, dstSize.x, dstSize.y,
- source, srcPt.x, srcPt.y, srcSize.x, srcSize.y, rop, useMask, srcMaskPt.x, srcMaskPt.y);
- }
-
- wxBitmap GetAsBitmap(const wxRect *subrect = (const wxRect *) NULL) const
- {
- return DoGetAsBitmap(subrect);
- }
-
-#if wxUSE_SPLINES
- void DrawSpline(wxCoord x1, wxCoord y1,
- wxCoord x2, wxCoord y2,
- wxCoord x3, wxCoord y3);
- void DrawSpline(int n, wxPoint points[]);
-
- void DrawSpline(const wxPointList *points) { DoDrawSpline(points); }
-
-#if WXWIN_COMPATIBILITY_2_8
- wxDEPRECATED( void DrawSpline(const wxList *points) );
-#endif // WXWIN_COMPATIBILITY_2_8
-
-#endif // wxUSE_SPLINES
-
- // Eventually we will have wxUSE_GENERIC_DRAWELLIPSE
-#ifdef __WXWINCE__
- //! Generic method to draw ellipses, circles and arcs with current pen and brush.
- /*! \param x Upper left corner of bounding box.
- * \param y Upper left corner of bounding box.
- * \param w Width of bounding box.
- * \param h Height of bounding box.
- * \param sa Starting angle of arc
- * (counterclockwise, start at 3 o'clock, 360 is full circle).
- * \param ea Ending angle of arc.
- * \param angle Rotation angle, the Arc will be rotated after
- * calculating begin and end.
- */
- void DrawEllipticArcRot( wxCoord x, wxCoord y,
- wxCoord width, wxCoord height,
- double sa = 0, double ea = 0, double angle = 0 )
- { DoDrawEllipticArcRot( x, y, width, height, sa, ea, angle ); }
-
- void DrawEllipticArcRot( const wxPoint& pt,
- const wxSize& sz,
- double sa = 0, double ea = 0, double angle = 0 )
- { DoDrawEllipticArcRot( pt.x, pt.y, sz.x, sz.y, sa, ea, angle ); }
-
- void DrawEllipticArcRot( const wxRect& rect,
- double sa = 0, double ea = 0, double angle = 0 )
- { DoDrawEllipticArcRot( rect.x, rect.y, rect.width, rect.height, sa, ea, angle ); }
-
- virtual void DoDrawEllipticArcRot( wxCoord x, wxCoord y,
- wxCoord w, wxCoord h,
- double sa = 0, double ea = 0, double angle = 0 );
-
- //! Rotates points around center.
- /*! This is a quite straight method, it calculates in pixels
- * and so it produces rounding errors.
- * \param points The points inside will be rotated.
- * \param angle Rotating angle (counterclockwise, start at 3 o'clock, 360 is full circle).
- * \param center Center of rotation.
- */
- void Rotate( wxPointList* points, double angle, wxPoint center = wxPoint(0,0) );
-
- // used by DrawEllipticArcRot
- // Careful: wxList gets filled with points you have to delete later.
- void CalculateEllipticPoints( wxPointList* points,
- wxCoord xStart, wxCoord yStart,
- wxCoord w, wxCoord h,
- double sa, double ea );
-#endif
-
- // global DC operations
- // --------------------
-
- virtual void Clear() = 0;
-
- virtual bool StartDoc(const wxString& WXUNUSED(message)) { return true; }
- virtual void EndDoc() { }
-
- virtual void StartPage() { }
- virtual void EndPage() { }
-
-#if WXWIN_COMPATIBILITY_2_6
- wxDEPRECATED( void BeginDrawing() );
- wxDEPRECATED( void EndDrawing() );
-#endif // WXWIN_COMPATIBILITY_2_6
-
-
- // set objects to use for drawing
- // ------------------------------
-
- virtual void SetFont(const wxFont& font) = 0;
- virtual void SetPen(const wxPen& pen) = 0;
- virtual void SetBrush(const wxBrush& brush) = 0;
- virtual void SetBackground(const wxBrush& brush) = 0;
- virtual void SetBackgroundMode(int mode) = 0;
-#if wxUSE_PALETTE
- virtual void SetPalette(const wxPalette& palette) = 0;
-#endif // wxUSE_PALETTE
-
- // clipping region
- // ---------------
-
- void SetClippingRegion(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
- { DoSetClippingRegion(x, y, width, height); }
- void SetClippingRegion(const wxPoint& pt, const wxSize& sz)
- { DoSetClippingRegion(pt.x, pt.y, sz.x, sz.y); }
- void SetClippingRegion(const wxRect& rect)
- { DoSetClippingRegion(rect.x, rect.y, rect.width, rect.height); }
- void SetClippingRegion(const wxRegion& region)
- { DoSetClippingRegionAsRegion(region); }
-
- virtual void DestroyClippingRegion() { ResetClipping(); }
-
- void GetClippingBox(wxCoord *x, wxCoord *y, wxCoord *w, wxCoord *h) const
- { DoGetClippingBox(x, y, w, h); }
- void GetClippingBox(wxRect& rect) const
- {
- DoGetClippingBox(&rect.x, &rect.y, &rect.width, &rect.height);
- }
-
- // text extent
- // -----------
-
- virtual wxCoord GetCharHeight() const = 0;
- virtual wxCoord GetCharWidth() const = 0;
-
- // only works for single line strings
- void GetTextExtent(const wxString& string,
- wxCoord *x, wxCoord *y,
- wxCoord *descent = NULL,
- wxCoord *externalLeading = NULL,
- const wxFont *theFont = NULL) const
- { DoGetTextExtent(string, x, y, descent, externalLeading, theFont); }
-
- wxSize GetTextExtent(const wxString& string) const
- {
- wxCoord w, h;
- DoGetTextExtent(string, &w, &h);
- return wxSize(w, h);
- }
-
- // works for single as well as multi-line strings
- virtual void GetMultiLineTextExtent(const wxString& string,
- wxCoord *width,
- wxCoord *height,
- wxCoord *heightLine = NULL,
- const wxFont *font = NULL) const;
-
- wxSize GetMultiLineTextExtent(const wxString& string) const
- {
- wxCoord w, h;
- GetMultiLineTextExtent(string, &w, &h);
- return wxSize(w, h);
- }
-
- // Measure cumulative width of text after each character
- bool GetPartialTextExtents(const wxString& text, wxArrayInt& widths) const
- { return DoGetPartialTextExtents(text, widths); }
-
-
- // size and resolution
- // -------------------
-
- // in device units
- void GetSize(int *width, int *height) const
- { DoGetSize(width, height); }
- wxSize GetSize() const
- {
- int w, h;
- DoGetSize(&w, &h);
-
- return wxSize(w, h);
- }
-
- // in mm
- void GetSizeMM(int* width, int* height) const
- { DoGetSizeMM(width, height); }
- wxSize GetSizeMM() const
- {
- int w, h;
- DoGetSizeMM(&w, &h);
-
- return wxSize(w, h);
- }
-
- // query DC capabilities
- // ---------------------
-
- virtual bool CanDrawBitmap() const = 0;
- virtual bool CanGetTextExtent() const = 0;
-
- // colour depth
- virtual int GetDepth() const = 0;
-
- // Resolution in Pixels per inch
- virtual wxSize GetPPI() const = 0;
-
- virtual int GetResolution()
- { return -1; }
-
- virtual bool Ok() const { return IsOk(); }
- virtual bool IsOk() const { return m_ok; }
-
- // accessors and setters
- // ---------------------
-
- virtual int GetBackgroundMode() const { return m_backgroundMode; }
- virtual const wxBrush& GetBackground() const { return m_backgroundBrush; }
- virtual const wxBrush& GetBrush() const { return m_brush; }
- virtual const wxFont& GetFont() const { return m_font; }
- virtual const wxPen& GetPen() const { return m_pen; }
-
- virtual const wxColour& GetTextForeground() const { return m_textForegroundColour; }
- virtual const wxColour& GetTextBackground() const { return m_textBackgroundColour; }
- virtual void SetTextForeground(const wxColour& colour)
- { m_textForegroundColour = colour; }
- virtual void SetTextBackground(const wxColour& colour)
- { m_textBackgroundColour = colour; }
-
-
- // coordinates conversions and transforms
- // --------------------------------------
-
- virtual wxCoord DeviceToLogicalX(wxCoord x) const;
- virtual wxCoord DeviceToLogicalY(wxCoord y) const;
- virtual wxCoord DeviceToLogicalXRel(wxCoord x) const;
- virtual wxCoord DeviceToLogicalYRel(wxCoord y) const;
- virtual wxCoord LogicalToDeviceX(wxCoord x) const;
- virtual wxCoord LogicalToDeviceY(wxCoord y) const;
- virtual wxCoord LogicalToDeviceXRel(wxCoord x) const;
- virtual wxCoord LogicalToDeviceYRel(wxCoord y) const;
-
- virtual void SetMapMode(int mode);
- virtual int GetMapMode() const { return m_mappingMode; }
-
- virtual void SetUserScale(double x, double y);
- virtual void GetUserScale(double *x, double *y) const
- {
- if ( x ) *x = m_userScaleX;
- if ( y ) *y = m_userScaleY;
- }
-
- virtual void SetLogicalScale(double x, double y);
- virtual void GetLogicalScale(double *x, double *y)
- {
- if ( x ) *x = m_logicalScaleX;
- if ( y ) *y = m_logicalScaleY;
- }
-
- virtual void SetLogicalOrigin(wxCoord x, wxCoord y);
- void GetLogicalOrigin(wxCoord *x, wxCoord *y) const
- { DoGetLogicalOrigin(x, y); }
- wxPoint GetLogicalOrigin() const
- { wxCoord x, y; DoGetLogicalOrigin(&x, &y); return wxPoint(x, y); }
-
- virtual void SetDeviceOrigin(wxCoord x, wxCoord y);
- void GetDeviceOrigin(wxCoord *x, wxCoord *y) const
- { DoGetDeviceOrigin(x, y); }
- wxPoint GetDeviceOrigin() const
- { wxCoord x, y; DoGetDeviceOrigin(&x, &y); return wxPoint(x, y); }
-
- virtual void SetDeviceLocalOrigin( wxCoord x, wxCoord y );
-
- virtual void ComputeScaleAndOrigin();
-
- // this needs to overidden if the axis is inverted (such
- // as when using Postscript, where 0,0 is the lower left
- // corner, not the upper left).
- virtual void SetAxisOrientation(bool xLeftRight, bool yBottomUp);
-
- // logical functions
- // ---------------------------
-
- virtual int GetLogicalFunction() const { return m_logicalFunction; }
- virtual void SetLogicalFunction(int function) = 0;
-
- // bounding box
- // ------------
-
- virtual void CalcBoundingBox(wxCoord x, wxCoord y)
- {
- if ( m_isBBoxValid )
- {
- if ( x < m_minX ) m_minX = x;
- if ( y < m_minY ) m_minY = y;
- if ( x > m_maxX ) m_maxX = x;
- if ( y > m_maxY ) m_maxY = y;
- }
- else
- {
- m_isBBoxValid = true;
-
- m_minX = x;
- m_minY = y;
- m_maxX = x;
- m_maxY = y;
- }
- }
-
- void ResetBoundingBox()
- {
- m_isBBoxValid = false;
-
- m_minX = m_maxX = m_minY = m_maxY = 0;
- }
-
- // Get the final bounding box of the PostScript or Metafile picture.
- wxCoord MinX() const { return m_minX; }
- wxCoord MaxX() const { return m_maxX; }
- wxCoord MinY() const { return m_minY; }
- wxCoord MaxY() const { return m_maxY; }
-
- // misc old functions
- // ------------------
-
-#if WXWIN_COMPATIBILITY_2_8
- // for compatibility with the old code when wxCoord was long everywhere
- wxDEPRECATED( void GetTextExtent(const wxString& string,
- long *x, long *y,
- long *descent = NULL,
- long *externalLeading = NULL,
- const wxFont *theFont = NULL) const );
- wxDEPRECATED( void GetLogicalOrigin(long *x, long *y) const );
- wxDEPRECATED( void GetDeviceOrigin(long *x, long *y) const );
- wxDEPRECATED( void GetClippingBox(long *x, long *y, long *w, long *h) const );
-#endif // WXWIN_COMPATIBILITY_2_8
-
- // RTL related functions
- // ---------------------
-
- // get or change the layout direction (LTR or RTL) for this dc,
- // wxLayout_Default is returned if layout direction is not supported
- virtual wxLayoutDirection GetLayoutDirection() const
- { return wxLayout_Default; }
- virtual void SetLayoutDirection(wxLayoutDirection WXUNUSED(dir))
- { }
-
-protected:
- // the pure virtual functions which should be implemented by wxDC
- virtual bool DoFloodFill(wxCoord x, wxCoord y, const wxColour& col,
- int style = wxFLOOD_SURFACE) = 0;
-
- virtual void DoGradientFillLinear(const wxRect& rect,
- const wxColour& initialColour,
- const wxColour& destColour,
- wxDirection nDirection = wxEAST);
-
- virtual void DoGradientFillConcentric(const wxRect& rect,
- const wxColour& initialColour,
- const wxColour& destColour,
- const wxPoint& circleCenter);
-
- virtual bool DoGetPixel(wxCoord x, wxCoord y, wxColour *col) const = 0;
-
- virtual void DoDrawPoint(wxCoord x, wxCoord y) = 0;
- virtual void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2) = 0;
-
- virtual void DoDrawArc(wxCoord x1, wxCoord y1,
- wxCoord x2, wxCoord y2,
- wxCoord xc, wxCoord yc) = 0;
- virtual void DoDrawCheckMark(wxCoord x, wxCoord y,
- wxCoord width, wxCoord height);
- virtual void DoDrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h,
- double sa, double ea) = 0;
-
- virtual void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height) = 0;
- virtual void DoDrawRoundedRectangle(wxCoord x, wxCoord y,
- wxCoord width, wxCoord height,
- double radius) = 0;
- virtual void DoDrawEllipse(wxCoord x, wxCoord y,
- wxCoord width, wxCoord height) = 0;
-
- virtual void DoCrossHair(wxCoord x, wxCoord y) = 0;
-
- virtual void DoDrawIcon(const wxIcon& icon, wxCoord x, wxCoord y) = 0;
- virtual void DoDrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y,
- bool useMask = false) = 0;
-
- virtual void DoDrawText(const wxString& text, wxCoord x, wxCoord y) = 0;
- virtual void DoDrawRotatedText(const wxString& text,
- wxCoord x, wxCoord y, double angle) = 0;
-
- virtual bool DoBlit(wxCoord xdest, wxCoord ydest,
- wxCoord width, wxCoord height,
- wxDC *source,
- wxCoord xsrc, wxCoord ysrc,
- int rop = wxCOPY,
- bool useMask = false,
- wxCoord xsrcMask = wxDefaultCoord,
- wxCoord ysrcMask = wxDefaultCoord) = 0;
-
- virtual bool DoStretchBlit(wxCoord xdest, wxCoord ydest,
- wxCoord dstWidth, wxCoord dstHeight,
- wxDC *source,
- wxCoord xsrc, wxCoord ysrc,
- wxCoord srcWidth, wxCoord srcHeight,
- int rop = wxCOPY,
- bool useMask = false,
- wxCoord xsrcMask = wxDefaultCoord,
- wxCoord ysrcMask = wxDefaultCoord);
-
- virtual wxBitmap DoGetAsBitmap(const wxRect *WXUNUSED(subrect)) const
- { return wxNullBitmap; }
-
- virtual void DoGetSize(int *width, int *height) const = 0;
- virtual void DoGetSizeMM(int* width, int* height) const = 0;
-
- virtual void DoDrawLines(int n, wxPoint points[],
- wxCoord xoffset, wxCoord yoffset) = 0;
- virtual void DoDrawPolygon(int n, wxPoint points[],
- wxCoord xoffset, wxCoord yoffset,
- int fillStyle = wxODDEVEN_RULE) = 0;
- virtual void DoDrawPolyPolygon(int n, int count[], wxPoint points[],
- wxCoord xoffset, wxCoord yoffset,
- int fillStyle);
-
- virtual void DoSetClippingRegionAsRegion(const wxRegion& region) = 0;
- virtual void DoSetClippingRegion(wxCoord x, wxCoord y,
- wxCoord width, wxCoord height) = 0;
-
- virtual void DoGetClippingBox(wxCoord *x, wxCoord *y,
- wxCoord *w, wxCoord *h) const
- {
- if ( x )
- *x = m_clipX1;
- if ( y )
- *y = m_clipY1;
- if ( w )
- *w = m_clipX2 - m_clipX1;
- if ( h )
- *h = m_clipY2 - m_clipY1;
- }
-
- virtual void DoGetLogicalOrigin(wxCoord *x, wxCoord *y) const
- {
- if ( x ) *x = m_logicalOriginX;
- if ( y ) *y = m_logicalOriginY;
- }
-
- virtual void DoGetDeviceOrigin(wxCoord *x, wxCoord *y) const
- {
- if ( x ) *x = m_deviceOriginX;
- if ( y ) *y = m_deviceOriginY;
- }
-
- virtual void DoGetTextExtent(const wxString& string,
- wxCoord *x, wxCoord *y,
- wxCoord *descent = NULL,
- wxCoord *externalLeading = NULL,
- const wxFont *theFont = NULL) const = 0;
-
- virtual bool DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths) const;
-
-#if wxUSE_SPLINES
- virtual void DoDrawSpline(const wxPointList *points);
-#endif
-
-protected:
- // unset clipping variables (after clipping region was destroyed)
- void ResetClipping()
- {
- m_clipping = false;
-
- m_clipX1 = m_clipX2 = m_clipY1 = m_clipY2 = 0;
- }
-
- // flags
- bool m_colour:1;
- bool m_ok:1;
- bool m_clipping:1;
- bool m_isInteractive:1;
- bool m_isBBoxValid:1;
-
- // coordinate system variables
-
- // TODO short descriptions of what exactly they are would be nice...
-
- wxCoord m_logicalOriginX, m_logicalOriginY;
- wxCoord m_deviceOriginX, m_deviceOriginY; // Usually 0,0, can be change by user
-
- wxCoord m_deviceLocalOriginX, m_deviceLocalOriginY; // non-zero if native top-left corner
- // is not at 0,0. This was the case under
- // Mac's GrafPorts (coordinate system
- // used toplevel window's origin) and
- // e.g. for Postscript, where the native
- // origin in the bottom left corner.
- double m_logicalScaleX, m_logicalScaleY;
- double m_userScaleX, m_userScaleY;
- double m_scaleX, m_scaleY; // calculated from logical scale and user scale
-
- // Used by SetAxisOrientation() to invert the axes
- int m_signX, m_signY;
-
- // what is a mm on a screen you don't know the size of?
- double m_mm_to_pix_x,
- m_mm_to_pix_y;
-
- // bounding and clipping boxes
- wxCoord m_minX, m_minY, m_maxX, m_maxY;
- wxCoord m_clipX1, m_clipY1, m_clipX2, m_clipY2;
-
- int m_logicalFunction;
- int m_backgroundMode;
- int m_mappingMode;
-
- // GDI objects
- wxPen m_pen;
- wxBrush m_brush;
- wxBrush m_backgroundBrush;
- wxColour m_textForegroundColour;
- wxColour m_textBackgroundColour;
- wxFont m_font;
-
-#if wxUSE_PALETTE
- wxPalette m_palette;
- bool m_hasCustomPalette;
-#endif // wxUSE_PALETTE
-
-private:
- DECLARE_NO_COPY_CLASS(wxDCBase)
- DECLARE_ABSTRACT_CLASS(wxDCBase)
-};
-
-#endif // wxUSE_NEW_DC
-
-// ----------------------------------------------------------------------------
-// now include the declaration of wxDC class
-// ----------------------------------------------------------------------------
-
-#if defined(__WXPALMOS__)
- #include "wx/palmos/dc.h"
-#elif defined(__WXMSW__)
- #include "wx/msw/dc.h"
-#elif defined(__WXMOTIF__)
- #include "wx/motif/dc.h"
-#elif defined(__WXGTK20__)
- #include "wx/gtk/dc.h"
-#elif defined(__WXGTK__)
- #include "wx/gtk1/dc.h"
-#elif defined(__WXX11__)
- #include "wx/x11/dc.h"
-#elif defined(__WXMGL__)
- #include "wx/mgl/dc.h"
-#elif defined(__WXDFB__)
- #include "wx/dfb/dc.h"
-#elif defined(__WXMAC__)
- #include "wx/mac/dc.h"
-#elif defined(__WXCOCOA__)
- #include "wx/cocoa/dc.h"
-#elif defined(__WXPM__)
- #include "wx/os2/dc.h"
-#endif
-
-#if wxUSE_GRAPHICS_CONTEXT
- #include "wx/dcgraph.h"
-#endif
-
// ----------------------------------------------------------------------------
// helper class: you can use it to temporarily change the DC text colour and
// restore it automatically when the object goes out of scope
// is private style and not returned by GetStyle.
#define wxBUFFER_USES_SHARED_BUFFER 0x04
-class WXDLLEXPORT wxBufferedDC : public wxMemoryDC
+class WXDLLIMPEXP_CORE wxBufferedDC : public wxMemoryDC
{
public:
// Default ctor, must subsequently call Init for two stage construction.
// Creates a double buffered wxPaintDC, optionally allowing the
// user to specify their own buffer to use.
-class WXDLLEXPORT wxBufferedPaintDC : public wxBufferedDC
+class WXDLLIMPEXP_CORE wxBufferedPaintDC : public wxBufferedDC
{
public:
// If no bitmap is supplied by the user, a temporary one will be created.
#ifdef __WXDEBUG__
-class wxAutoBufferedPaintDC : public wxAutoBufferedPaintDCBase
+class WXDLLIMPEXP_CORE wxAutoBufferedPaintDC : public wxAutoBufferedPaintDCBase
{
public:
#else // !__WXDEBUG__
// In release builds, just use typedef
-typedef wxAutoBufferedPaintDCBase wxAutoBufferedPaintDC;
+typedef WXDLLIMPEXP_CORE wxAutoBufferedPaintDCBase wxAutoBufferedPaintDC;
#endif
#ifndef _WX_DCCLIENT_H_BASE_
#define _WX_DCCLIENT_H_BASE_
-#include "wx/defs.h"
-
-#if defined(__WXPALMOS__)
-#include "wx/palmos/dcclient.h"
-#elif defined(__WXMSW__)
-#include "wx/msw/dcclient.h"
-#elif defined(__WXMOTIF__)
-#include "wx/motif/dcclient.h"
-#elif defined(__WXGTK20__)
-#include "wx/gtk/dcclient.h"
-#elif defined(__WXGTK__)
-#include "wx/gtk1/dcclient.h"
-#elif defined(__WXX11__)
-#include "wx/x11/dcclient.h"
-#elif defined(__WXMGL__)
-#include "wx/mgl/dcclient.h"
-#elif defined(__WXDFB__)
-#include "wx/dfb/dcclient.h"
-#elif defined(__WXMAC__)
-#include "wx/mac/dcclient.h"
-#elif defined(__WXCOCOA__)
-#include "wx/cocoa/dcclient.h"
-#elif defined(__WXPM__)
-#include "wx/os2/dcclient.h"
-#endif
+#include "wx/dc.h"
+
+//-----------------------------------------------------------------------------
+// wxWindowDC
+//-----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxWindowDC : public wxDC
+{
+public:
+ wxWindowDC();
+ wxWindowDC( wxWindow *win );
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxWindowDC)
+};
+
+//-----------------------------------------------------------------------------
+// wxClientDC
+//-----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxClientDC : public wxWindowDC
+{
+public:
+ wxClientDC();
+ wxClientDC( wxWindow *win );
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxClientDC)
+};
+
+//-----------------------------------------------------------------------------
+// wxPaintDC
+//-----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxPaintDC : public wxClientDC
+{
+public:
+ wxPaintDC();
+ wxPaintDC( wxWindow *win );
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxPaintDC)
+};
#endif
// _WX_DCCLIENT_H_BASE_
class WXDLLIMPEXP_FWD_CORE wxWindowDC;
-#ifdef __WXMAC__
-#define wxGCDC wxDC
-#endif
-class WXDLLEXPORT wxGCDC:
-#ifdef __WXMAC__
- public wxDCBase
-#else
- public wxDC
-#endif
+class WXDLLEXPORT wxGCDC: public wxDC
{
+public:
+ wxGCDC( const wxWindowDC& dc );
+ wxGCDC( const wxMemoryDC& dc );
+ wxGCDC();
+
+ wxGraphicsContext* GetGraphicsContext();
+ void SetGraphicsContext( wxGraphicsContext* ctx );
+
+private:
DECLARE_DYNAMIC_CLASS(wxGCDC)
DECLARE_NO_COPY_CLASS(wxGCDC)
+};
+
+
+class WXDLLEXPORT wxGCDCImpl: public wxDCImpl
+{
public:
- wxGCDC(const wxWindowDC& dc);
-#ifdef __WXMSW__
- wxGCDC( const wxMemoryDC& dc);
-#endif
- wxGCDC();
- virtual ~wxGCDC();
+ wxGCDCImpl( wxDC *owner, const wxWindowDC& dc );
+ wxGCDCImpl( wxDC *owner, const wxMemoryDC& dc );
+ wxGCDCImpl( wxDC *owner );
+
+ virtual ~wxGCDCImpl();
void Init();
double m_formerScaleX, m_formerScaleY;
wxGraphicsContext* m_graphicContext;
+
+private:
+ DECLARE_CLASS(wxGCDCImpl)
+ DECLARE_NO_COPY_CLASS(wxGCDCImpl)
};
#endif
#include "wx/dc.h"
#include "wx/bitmap.h"
-
-#if wxUSE_NEW_DC
-
//-----------------------------------------------------------------------------
// wxMemoryDC
//-----------------------------------------------------------------------------
};
-
-#else
-
-// NOTE: different native implementations of wxMemoryDC will derive from
-// different wxDC classes (wxPaintDC, wxWindowDC, etc), so that
-// we cannot derive wxMemoryDCBase from wxDC and then use it as the
-// only base class for native impl of wxMemoryDC...
-class WXDLLEXPORT wxMemoryDCBase
-{
-public:
- wxMemoryDCBase() { }
-
- // avoid warnings about having virtual functions but non virtual dtor
- virtual ~wxMemoryDCBase() { }
-
- // select the given bitmap to draw on it
- void SelectObject(wxBitmap& bmp)
- {
- // make sure that the given wxBitmap is not sharing its data with other
- // wxBitmap instances as its contents will be modified by any drawing
- // operation done on this DC
- if (bmp.IsOk())
- bmp.UnShare();
-
- DoSelect(bmp);
- }
-
- // select the given bitmap for read-only
- virtual void SelectObjectAsSource(const wxBitmap& bmp)
- {
- DoSelect(bmp);
- }
-
-protected:
- virtual void DoSelect(const wxBitmap& bmp) = 0;
-};
-
-
-#endif
-
-
-#if defined(__WXPALMOS__)
-#include "wx/palmos/dcmemory.h"
-#elif defined(__WXMSW__)
-#include "wx/msw/dcmemory.h"
-#elif defined(__WXMOTIF__)
-#include "wx/motif/dcmemory.h"
-#elif defined(__WXGTK20__)
-#include "wx/gtk/dcmemory.h"
-#elif defined(__WXGTK__)
-#include "wx/gtk1/dcmemory.h"
-#elif defined(__WXX11__)
-#include "wx/x11/dcmemory.h"
-#elif defined(__WXMGL__)
-#include "wx/mgl/dcmemory.h"
-#elif defined(__WXDFB__)
-#include "wx/dfb/dcmemory.h"
-#elif defined(__WXMAC__)
-#include "wx/mac/dcmemory.h"
-#elif defined(__WXCOCOA__)
-#include "wx/cocoa/dcmemory.h"
-#elif defined(__WXPM__)
-#include "wx/os2/dcmemory.h"
-#endif
-
#endif
// _WX_DCMEMORY_H_BASE_
#if wxUSE_PRINTING_ARCHITECTURE
-#if wxUSE_NEW_DC
-
#include "wx/dc.h"
//-----------------------------------------------------------------------------
DECLARE_DYNAMIC_CLASS()
};
-#else
-
-#if defined(__WXPALMOS__)
-#include "wx/palmos/dcprint.h"
-#elif defined(__WXMSW__)
-#include "wx/msw/dcprint.h"
-#endif
-#if defined(__WXPM__)
-#include "wx/os2/dcprint.h"
-#endif
-#if defined(__WXMAC__)
-#include "wx/mac/dcprint.h"
-#endif
-
-#endif // wxUSE_NEW_DC
-#endif // wxUSE_PRINTING_ARCHITECTURE
+#endif
+ // wxUSE_PRINTING_ARCHITECTURE
+
#endif
// _WX_DCPRINT_H_BASE_
#include "wx/defs.h"
#include "wx/dc.h"
-#if wxUSE_NEW_DC
-
-class WXDLLIMPEXP_CORE wxScreenDC : public wxWindowDC
+class WXDLLIMPEXP_CORE wxScreenDC : public wxDC
{
public:
wxScreenDC();
DECLARE_DYNAMIC_CLASS(wxScreenDC)
};
-#endif
-
-#if defined(__WXPALMOS__)
-#include "wx/palmos/dcscreen.h"
-#elif defined(__WXMSW__)
-#include "wx/msw/dcscreen.h"
-#elif defined(__WXMOTIF__)
-#include "wx/motif/dcscreen.h"
-#elif defined(__WXGTK20__)
-#include "wx/gtk/dcscreen.h"
-#elif defined(__WXGTK__)
-#include "wx/gtk1/dcscreen.h"
-#elif defined(__WXX11__)
-#include "wx/x11/dcscreen.h"
-#elif defined(__WXMGL__)
-#include "wx/mgl/dcscreen.h"
-#elif defined(__WXDFB__)
-#include "wx/dfb/dcscreen.h"
-#elif defined(__WXMAC__)
-#include "wx/mac/dcscreen.h"
-#elif defined(__WXCOCOA__)
-#include "wx/cocoa/dcscreen.h"
-#elif defined(__WXPM__)
-#include "wx/os2/dcscreen.h"
-#endif
-
#endif
// _WX_DCSCREEN_H_BASE_
#if wxUSE_NEW_DC
class WXDLLIMPEXP_FWD_BASE wxSVGFileDC;
-class WXDLLIMPEXP_CORE wxSVGFileImplDC : public wxImplDC
+class WXDLLIMPEXP_CORE wxSVGFileDCImpl : public wxDCImpl
#else
-#define wxSVGFileImplDC wxSVGFileDC
+#define wxSVGFileDCImpl wxSVGFileDC
class WXDLLIMPEXP_CORE wxSVGFileDC : public wxDC
#endif
{
public:
#if wxUSE_NEW_DC
- wxSVGFileImplDC( wxSVGFileDC *owner, const wxString &filename,
+ wxSVGFileDCImpl( wxSVGFileDC *owner, const wxString &filename,
int width=320, int height=240, double dpi=72.0 );
#else
wxSVGFileDC( const wxString &filename,
int width=320, int height=240, double dpi=72.0 );
#endif
- virtual ~wxSVGFileImplDC();
+ virtual ~wxSVGFileDCImpl();
bool IsOk() const { return m_OK; }
double m_dpi;
private:
- DECLARE_ABSTRACT_CLASS(wxSVGFileImplDC)
+ DECLARE_ABSTRACT_CLASS(wxSVGFileDCImpl)
};
wxSVGFileDC( const wxString &filename,
int width=320, int height=240, double dpi=72.0 )
{
- m_pimpl = new wxSVGFileImplDC( this, filename, width, height, dpi );
+ m_pimpl = new wxSVGFileDCImpl( this, filename, width, height, dpi );
}
};
#endif
#endif
#if wxUSE_NEW_DC
-class WXDLLEXPORT wxPostScriptImplDC : public wxImplDC
+class WXDLLEXPORT wxPostScriptDCImpl : public wxDCImpl
#else
-#define wxPostScriptImplDC wxPostScriptDC
+#define wxPostScriptDCImpl wxPostScriptDC
class WXDLLEXPORT wxPostScriptDC : public wxDC
#endif
{
public:
#if wxUSE_NEW_DC
- wxPostScriptImplDC( wxPrinterDC *owner );
- wxPostScriptImplDC( wxPrinterDC *owner, const wxPrintData& data );
- wxPostScriptImplDC( wxPostScriptDC *owner );
- wxPostScriptImplDC( wxPostScriptDC *owner, const wxPrintData& data );
+ wxPostScriptDCImpl( wxPrinterDC *owner );
+ wxPostScriptDCImpl( wxPrinterDC *owner, const wxPrintData& data );
+ wxPostScriptDCImpl( wxPostScriptDC *owner );
+ wxPostScriptDCImpl( wxPostScriptDC *owner, const wxPrintData& data );
#else
wxPostScriptDC();
void Init();
- virtual ~wxPostScriptImplDC();
+ virtual ~wxPostScriptDCImpl();
virtual bool Ok() const { return IsOk(); }
virtual bool IsOk() const;
double m_pageHeight;
private:
- DECLARE_DYNAMIC_CLASS(wxPostScriptImplDC)
+ DECLARE_DYNAMIC_CLASS(wxPostScriptDCImpl)
};
#endif
#include "wx/printdlg.h"
#include "wx/listctrl.h"
+#include "wx/dc.h"
#if wxUSE_POSTSCRIPT
#include "wx/dcps.h"
#endif
virtual ~wxGraphicsContext();
static wxGraphicsContext* Create( const wxWindowDC& dc) ;
-
-#ifdef __WXMSW__
static wxGraphicsContext * Create( const wxMemoryDC& dc) ;
-#endif
static wxGraphicsContext* CreateFromNative( void * context ) ;
// Context
virtual wxGraphicsContext * CreateContext( const wxWindowDC& dc) = 0 ;
-#ifdef __WXMSW__
virtual wxGraphicsContext * CreateContext( const wxMemoryDC& dc) = 0 ;
-#endif
+
virtual wxGraphicsContext * CreateContextFromNativeContext( void * context ) = 0;
virtual wxGraphicsContext * CreateContextFromNativeWindow( void * window ) = 0;
virtual void DoSetIndent();
private:
- friend class wxDataViewCtrlDC;
+ friend class wxDataViewCtrlDCImpl;
friend class wxDataViewColumn;
friend class wxGtkDataViewModelNotifier;
GtkWidget *m_treeview;
// wxDC
//-----------------------------------------------------------------------------
-#if wxUSE_NEW_DC
-class WXDLLIMPEXP_CORE wxGTKImplDC : public wxImplDC
-#else
-#define wxGTKImplDC wxDC
-class WXDLLIMPEXP_CORE wxDC : public wxDCBase
-#endif
-
+class WXDLLIMPEXP_CORE wxGTKDCImpl : public wxDCImpl
{
public:
-#if wxUSE_NEW_DC
- wxGTKImplDC( wxDC *owner );
-#else
- wxDC();
-#endif
-
- virtual ~wxGTKImplDC();
+ wxGTKDCImpl( wxDC *owner );
+ virtual ~wxGTKDCImpl();
#if wxUSE_PALETTE
void SetColourMap( const wxPalette& palette ) { SetPalette(palette); };
virtual void DoGetSizeMM(int* width, int* height) const;
private:
- DECLARE_ABSTRACT_CLASS(wxGTKImplDC)
+ DECLARE_ABSTRACT_CLASS(wxGTKDCImpl)
};
-// this must be defined when wxDC::Blit() honours the DC origian and needed to
+// this must be defined when wxDC::Blit() honours the DC origin and needed to
// allow wxUniv code in univ/winuniv.cpp to work with versions of wxGTK
// 2.3.[23]
#ifndef wxHAS_WORKING_GTK_DC_BLIT
#define __GTKDCCLIENTH__
#include "wx/dc.h"
+#include "wx/gtk/dc.h"
+#include "wx/dcclient.h"
#include "wx/region.h"
class WXDLLIMPEXP_FWD_CORE wxWindow;
//-----------------------------------------------------------------------------
-// wxWindowDC
+// wxWindowDCImpl
//-----------------------------------------------------------------------------
-#if wxUSE_NEW_DC
-class WXDLLIMPEXP_CORE wxGTKWindowImplDC : public wxGTKImplDC
-#else
-#define wxGTKWindowImplDC wxWindowDC
-class WXDLLIMPEXP_CORE wxWindowDC : public wxDC
-#endif
+class WXDLLIMPEXP_CORE wxWindowDCImpl : public wxGTKDCImpl
{
public:
+ wxWindowDCImpl( wxDC *owner );
+ wxWindowDCImpl( wxDC *owner, wxWindow *win );
-
-#if wxUSE_NEW_DC
- wxGTKWindowImplDC( wxDC *owner );
- wxGTKWindowImplDC( wxDC *owner, wxWindow *win );
-#else
- wxWindowDC();
- wxWindowDC( wxWindow *win );
-#endif
-
- virtual ~wxGTKWindowImplDC();
+ virtual ~wxWindowDCImpl();
virtual bool CanDrawBitmap() const { return true; }
virtual bool CanGetTextExtent() const { return true; }
// implementation
// --------------
- GdkWindow *m_window;
+ GdkWindow *m_gdkwindow;
GdkGC *m_penGC;
GdkGC *m_brushGC;
GdkGC *m_textGC;
GdkGC *m_bgGC;
GdkColormap *m_cmap;
bool m_isScreenDC;
- wxWindow *m_owningWindow;
wxRegion m_currentClippingRegion;
wxRegion m_paintClippingRegion;
virtual void ComputeScaleAndOrigin();
- virtual GdkWindow *GetGDKWindow() const { return m_window; }
+ virtual GdkWindow *GetGDKWindow() const { return m_gdkwindow; }
private:
- DECLARE_ABSTRACT_CLASS(wxGTKWindowImplDC)
+ DECLARE_ABSTRACT_CLASS(wxWindowDCImpl)
};
//-----------------------------------------------------------------------------
-// wxClientDC
+// wxClientDCImpl
//-----------------------------------------------------------------------------
-#if wxUSE_NEW_DC
-class WXDLLIMPEXP_CORE wxGTKClientImplDC : public wxGTKWindowImplDC
-#else
-#define wxGTKClientImplDC wxClientDC
-class WXDLLIMPEXP_CORE wxClientDC : public wxWindowDC
-#endif
+class WXDLLIMPEXP_CORE wxClientDCImpl : public wxWindowDCImpl
{
public:
-
-#if wxUSE_NEW_DC
- wxGTKClientImplDC( wxDC *owner );
- wxGTKClientImplDC( wxDC *owner, wxWindow *win );
-#else
- wxClientDC();
- wxClientDC( wxWindow *win );
-#endif
+ wxClientDCImpl( wxDC *owner );
+ wxClientDCImpl( wxDC *owner, wxWindow *win );
protected:
virtual void DoGetSize(int *width, int *height) const;
private:
- DECLARE_ABSTRACT_CLASS(wxGTKClientImplDC)
+ DECLARE_ABSTRACT_CLASS(wxClientDCImpl)
};
//-----------------------------------------------------------------------------
-// wxPaintDC
+// wxPaintDCImpl
//-----------------------------------------------------------------------------
-#if wxUSE_NEW_DC
-class WXDLLIMPEXP_CORE wxGTKPaintImplDC : public wxGTKClientImplDC
-#else
-#define wxGTKPaintImplDC wxPaintDC
-class WXDLLIMPEXP_CORE wxPaintDC : public wxClientDC
-#endif
+class WXDLLIMPEXP_CORE wxPaintDCImpl : public wxClientDCImpl
{
public:
-
-#if wxUSE_NEW_DC
- wxGTKPaintImplDC( wxDC *owner );
- wxGTKPaintImplDC( wxDC *owner, wxWindow *win );
-#else
- wxPaintDC();
- wxPaintDC( wxWindow *win );
-#endif
+ wxPaintDCImpl( wxDC *owner );
+ wxPaintDCImpl( wxDC *owner, wxWindow *win );
private:
- DECLARE_ABSTRACT_CLASS(wxGTKPaintImplDC)
+ DECLARE_ABSTRACT_CLASS(wxPaintDCImpl)
};
-#endif // __GTKDCCLIENTH__
+#endif
+ // __GTKDCCLIENTH__
+
#ifndef _WX_GTK_DCMEMORY_H_
#define _WX_GTK_DCMEMORY_H_
-#include "wx/dcclient.h"
+#include "wx/dcmemory.h"
+#include "wx/gtk/dcclient.h"
//-----------------------------------------------------------------------------
-// wxMemoryDC
+// wxMemoryDCImpl
//-----------------------------------------------------------------------------
-
-#if wxUSE_NEW_DC
-class WXDLLIMPEXP_CORE wxGTKMemoryImplDC : public wxGTKWindowImplDC
-#else
-#define wxGTKMemoryImplDC wxMemoryDC
-class WXDLLIMPEXP_CORE wxMemoryDC : public wxWindowDC, public wxMemoryDCBase
-#endif
+class WXDLLIMPEXP_CORE wxMemoryDCImpl : public wxWindowDCImpl
{
public:
-
-#if wxUSE_NEW_DC
- wxGTKMemoryImplDC( wxMemoryDC *owner );
- wxGTKMemoryImplDC( wxMemoryDC *owner, wxBitmap& bitmap );
- wxGTKMemoryImplDC( wxMemoryDC *owner, wxDC *dc );
-#else
- wxMemoryDC();
- wxMemoryDC(wxBitmap& bitmap);
- wxMemoryDC( wxDC *dc );
-#endif
+ wxMemoryDCImpl( wxMemoryDC *owner );
+ wxMemoryDCImpl( wxMemoryDC *owner, wxBitmap& bitmap );
+ wxMemoryDCImpl( wxMemoryDC *owner, wxDC *dc );
- virtual ~wxGTKMemoryImplDC();
+ virtual ~wxMemoryDCImpl();
// these get reimplemented for mono-bitmaps to behave
// more like their Win32 couterparts. They now interpret
virtual void SetTextBackground( const wxColour &col );
protected:
- // overridden from wxImplDC
+ // overridden from wxDCImpl
virtual void DoGetSize( int *width, int *height ) const;
virtual wxBitmap DoGetAsBitmap(const wxRect *subrect) const;
private:
void Init();
- DECLARE_ABSTRACT_CLASS(wxGTKMemoryImplDC)
+ DECLARE_ABSTRACT_CLASS(wxMemoryDCImpl)
};
-#endif // _WX_GTK_DCMEMORY_H_
+#endif
+ // _WX_GTK_DCMEMORY_H_
+
#ifndef __GTKDCSCREENH__
#define __GTKDCSCREENH__
-#include "wx/dcclient.h"
+#include "wx/dcscreen.h"
+#include "wx/gtk/dcclient.h"
//-----------------------------------------------------------------------------
-// wxScreenDC
+// wxScreenDCImpl
//-----------------------------------------------------------------------------
-#if wxUSE_NEW_DC
-class WXDLLIMPEXP_CORE wxGTKScreenImplDC : public wxGTKWindowImplDC
-#else
-#define wxGTKScreenImplDC wxScreenDC
-class WXDLLIMPEXP_CORE wxScreenDC : public wxWindowDC
-#endif
+class WXDLLIMPEXP_CORE wxScreenDCImpl : public wxWindowDCImpl
{
public:
-
-#if wxUSE_NEW_DC
- wxGTKScreenImplDC( wxScreenDC *owner );
-#else
- wxScreenDC();
-#endif
-
- ~wxGTKScreenImplDC();
-
- static bool StartDrawingOnTop(wxWindow * WXUNUSED(window))
- { return true; }
- static bool StartDrawingOnTop(wxRect * WXUNUSED(rect) = NULL)
- { return true; }
- static bool EndDrawingOnTop() { return true; }
-
+ wxScreenDCImpl( wxScreenDC *owner );
+ ~wxScreenDCImpl();
protected:
virtual void DoGetSize(int *width, int *height) const;
void Init();
private:
- DECLARE_ABSTRACT_CLASS(wxGTKScreenImplDC)
+ DECLARE_ABSTRACT_CLASS(wxScreenDCImpl)
};
#endif // __GTKDCSCREENH__
wxPageSetupDialogData * data = NULL );
#if wxUSE_NEW_DC
- virtual wxImplDC* CreatePrinterImplDC( wxPrinterDC *owner, const wxPrintData& data );
+ virtual wxDCImpl* CreatePrinterDCImpl( wxPrinterDC *owner, const wxPrintData& data );
#else
virtual wxDC* CreatePrinterDC( const wxPrintData& data );
#endif
//-----------------------------------------------------------------------------
#if wxUSE_NEW_DC
-class wxGnomePrinterImplDC : public wxImplDC
+class wxGnomePrinterDCImpl : public wxDCImpl
#else
-#define wxGnomePrinterImplDC wxGnomePrinterDC
+#define wxGnomePrinterDCImpl wxGnomePrinterDC
class wxGnomePrinterDC : public wxDC
#endif
{
public:
#if wxUSE_NEW_DC
- wxGnomePrinterImplDC( wxPrinterDC *owner, const wxPrintData& data );
+ wxGnomePrinterDCImpl( wxPrinterDC *owner, const wxPrintData& data );
#else
wxGnomePrinterDC( const wxPrintData& data );
#endif
- virtual ~wxGnomePrinterImplDC();
+ virtual ~wxGnomePrinterDCImpl();
bool Ok() const { return IsOk(); }
bool IsOk() const;
void makeEllipticalPath(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
private:
- DECLARE_DYNAMIC_CLASS(wxGnomePrinterImplDC)
- DECLARE_NO_COPY_CLASS(wxGnomePrinterImplDC)
+ DECLARE_DYNAMIC_CLASS(wxGnomePrinterDCImpl)
+ DECLARE_NO_COPY_CLASS(wxGnomePrinterDCImpl)
};
// ----------------------------------------------------------------------------
wxPageSetupDialogData * data = NULL );
#if wxUSE_NEW_DC
- virtual wxImplDC* CreatePrinterImplDC( wxPrinterDC *owner, const wxPrintData& data );
+ virtual wxDCImpl* CreatePrinterDCImpl( wxPrinterDC *owner, const wxPrintData& data );
#else
virtual wxDC* CreatePrinterDC( const wxPrintData& data );
#endif
//-----------------------------------------------------------------------------
#if wxUSE_NEW_DC
-class WXDLLIMPEXP_CORE wxGtkPrinterImplDC : public wxImplDC
+class WXDLLIMPEXP_CORE wxGtkPrinterDCImpl : public wxDCImpl
#else
-#define wxGtkPrinterImplDC wxGtkPrinterDC
+#define wxGtkPrinterDCImpl wxGtkPrinterDC
class WXDLLIMPEXP_CORE wxGtkPrinterDC : public wxDC
#endif
{
public:
#if wxUSE_NEW_DC
- wxGtkPrinterImplDC( wxPrinterDC *owner, const wxPrintData& data );
+ wxGtkPrinterDCImpl( wxPrinterDC *owner, const wxPrintData& data );
#else
wxGtkPrinterDC( const wxPrintData& data );
#endif
- virtual ~wxGtkPrinterImplDC();
+ virtual ~wxGtkPrinterDCImpl();
bool Ok() const { return IsOk(); }
bool IsOk() const;
double m_PS2DEV;
double m_DEV2PS;
- DECLARE_DYNAMIC_CLASS(wxGtkPrinterImplDC)
- DECLARE_NO_COPY_CLASS(wxGtkPrinterImplDC)
+ DECLARE_DYNAMIC_CLASS(wxGtkPrinterDCImpl)
+ DECLARE_NO_COPY_CLASS(wxGtkPrinterDCImpl)
};
// ----------------------------------------------------------------------------
#include <gtk/gtk.h>
#include "wx/gtk/private/string.h"
+#include "wx/gtk/dc.h"
+#include "wx/gtk/dcclient.h"
+#include "wx/gtk/dcmemory.h"
// pango_version_check symbol is quite recent ATM (4/2007)... so we
// use our own wrapper which implements a smart trick.
#define _WX_DCCLIENT_H_
#include "wx/dc.h"
+#include "wx/dcgraph.h"
//-----------------------------------------------------------------------------
// classes
class WXDLLIMPEXP_FWD_CORE wxPaintDC;
class WXDLLIMPEXP_FWD_CORE wxWindow;
-class WXDLLEXPORT wxWindowDC: public wxDC
+class WXDLLEXPORT wxWindowDCImpl: public wxGCDCImpl
{
- DECLARE_DYNAMIC_CLASS(wxWindowDC)
-
- public:
- wxWindowDC(void);
-
- // Create a DC corresponding to a canvas
- wxWindowDC(wxWindow *win);
-
- virtual ~wxWindowDC(void);
- wxWindow *GetWindow() const { return m_window; }
- protected :
+public:
+ wxWindowDCImpl( wxDC *owner );
+ wxWindowDCImpl( wxDC *owner, wxWindow *window );
+ virtual ~wxWindowDCImpl();
+
+protected :
virtual void DoGetSize( int *width, int *height ) const;
virtual wxBitmap DoGetAsBitmap(const wxRect *subrect) const;
- wxWindow *m_window;
- bool m_release;
- int m_width;
- int m_height;
+ bool m_release;
+ int m_width;
+ int m_height;
+private:
+ DECLARE_CLASS(wxWindowDCImpl)
+ DECLARE_NO_COPY_CLASS(wxWindowDCImpl)
};
-class WXDLLEXPORT wxClientDC: public wxWindowDC
+class WXDLLEXPORT wxClientDCImpl: public wxWindowDCImpl
{
- DECLARE_DYNAMIC_CLASS(wxClientDC)
-
- public:
- wxClientDC(void);
-
- // Create a DC corresponding to a canvas
- wxClientDC(wxWindow *win);
-
- virtual ~wxClientDC(void);
-
-protected:
+public:
+ wxClientDCImpl( wxDC *owner );
+ wxClientDCImpl( wxDC *owner, wxWindow *window );
+ virtual ~wxClientDCImpl();
+
+private:
+ DECLARE_CLASS(wxClientDCImpl)
+ DECLARE_NO_COPY_CLASS(wxClientDCImpl)
};
-class WXDLLEXPORT wxPaintDC: public wxWindowDC
-{
- DECLARE_DYNAMIC_CLASS(wxPaintDC)
-
- public:
- wxPaintDC(void);
- // Create a DC corresponding to a canvas
- wxPaintDC(wxWindow *win);
-
- virtual ~wxPaintDC(void);
+class WXDLLEXPORT wxPaintDCImpl: public wxWindowDCImpl
+{
+public:
+ wxPaintDCImpl( wxDC *owner );
+ wxPaintDCImpl( wxDC *owner, wxWindow *win );
+ virtual ~wxPaintDCImpl();
protected:
+ DECLARE_CLASS(wxPaintDCImpl)
+ DECLARE_NO_COPY_CLASS(wxPaintDCImpl)
};
+
#endif
// _WX_DCCLIENT_H_
#ifndef _WX_DCMEMORY_H_
#define _WX_DCMEMORY_H_
-#include "wx/dcclient.h"
+#include "wx/mac/carbon/dcclient.h"
-class WXDLLEXPORT wxMemoryDC: public wxPaintDC, public wxMemoryDCBase
+class WXDLLEXPORT wxMemoryDCImpl: public wxPaintDCImpl
{
- DECLARE_DYNAMIC_CLASS(wxMemoryDC)
-
public:
- wxMemoryDC() { Init(); }
- wxMemoryDC(wxBitmap& bitmap) { Init(); SelectObject(bitmap); }
- wxMemoryDC( wxDC *dc ); // Create compatible DC
- virtual ~wxMemoryDC(void);
-
- const wxBitmap& GetSelectedBitmap() const { return m_selected; }
- wxBitmap GetSelectedBitmap() { return m_selected; }
-
- wxBitmap GetSelectedObject() { return GetSelectedBitmap() ; }
+ wxMemoryDCImpl( wxMemoryDC *owner );
+ wxMemoryDCImpl( wxMemoryDC *owner, wxBitmap& bitmap );
+ wxMemoryDCImpl( wxMemoryDC *owner, wxDC *dc );
+
+ virtual ~wxMemoryDCImpl();
protected:
virtual void DoGetSize( int *width, int *height ) const;
virtual wxBitmap DoGetAsBitmap(const wxRect *subrect) const
- { return subrect == NULL ? GetSelectedBitmap() : GetSelectedBitmap().GetSubBitmap(*subrect); }
+ { return subrect == NULL ? GetSelectedBitmap() : GetSelectedBitmap().GetSubBitmap(*subrect); }
virtual void DoSelect(const wxBitmap& bitmap);
private:
void Init();
wxBitmap m_selected;
+
+private:
+ DECLARE_CLASS(wxMemoryDCImpl)
+ DECLARE_NO_COPY_CLASS(wxMemoryDCImpl)
};
#endif
#define _WX_DCPRINT_H_
#include "wx/dc.h"
+#include "wx/dcgraph.h"
#include "wx/cmndata.h"
class wxNativePrinterDC ;
-class WXDLLEXPORT wxPrinterDC: public wxDC
+class WXDLLEXPORT wxPrinterDCImpl: public wxGCDCImpl
{
- public:
+public:
#if wxUSE_PRINTING_ARCHITECTURE
- DECLARE_CLASS(wxPrinterDC)
- // Create a printer DC
- wxPrinterDC(const wxPrintData& printdata );
- virtual ~wxPrinterDC();
+ wxPrinterDCImpl( wxPrinterDC *owner, const wxPrintData& printdata );
+ virtual ~wxPrinterDCImpl();
virtual bool StartDoc( const wxString& WXUNUSED(message) ) ;
virtual void EndDoc(void) ;
wxPrintData& GetPrintData() { return m_printData; }
virtual wxSize GetPPI() const;
- protected:
+
+protected:
virtual void DoGetSize( int *width, int *height ) const;
- wxPrintData m_printData ;
+
+ wxPrintData m_printData ;
wxNativePrinterDC* m_nativePrinterDC ;
+
+private:
+ DECLARE_CLASS(wxPrinterDC)
#endif // wxUSE_PRINTING_ARCHITECTURE
};
#define _WX_DCSCREEN_H_
#include "wx/dcclient.h"
+#include "wx/mac/carbon/dcclient.h"
-class WXDLLEXPORT wxScreenDC: public wxWindowDC
+class WXDLLEXPORT wxScreenDCImpl: public wxWindowDCImpl
{
- DECLARE_DYNAMIC_CLASS(wxScreenDC)
+public:
+ wxScreenDCImpl( wxDC *owner );
+ virtual ~wxScreenDCImpl();
- public:
- // Create a DC representing the whole screen
- wxScreenDC();
- virtual ~wxScreenDC();
-
- // Compatibility with X's requirements for
- // drawing on top of all windows
- static bool StartDrawingOnTop(wxWindow* WXUNUSED(window)) { return TRUE; }
- static bool StartDrawingOnTop(wxRect* WXUNUSED(rect) = NULL) { return TRUE; }
- static bool EndDrawingOnTop() { return TRUE; }
- private:
- void* m_overlayWindow;
+private:
+ void* m_overlayWindow;
+
+private:
+ DECLARE_CLASS(wxScreenDCImpl)
+ DECLARE_NO_COPY_CLASS(wxScreenDCImpl)
};
#endif
#include "wx/dataobj.h"
#endif
+#include "wx/mac/carbon/dcclient.h"
+
/*
* Metafile and metafile device context classes
*
#endif
};
-class WXDLLEXPORT wxMetafileDC: public wxDC
-{
- DECLARE_DYNAMIC_CLASS(wxMetafileDC)
- public:
- // the ctor parameters specify the filename (empty for memory metafiles),
- // the metafile picture size and the optional description/comment
- wxMetafileDC(const wxString& filename = wxEmptyString,
- int width = 0, int height = 0,
- const wxString& description = wxEmptyString);
+class WXDLLEXPORT wxMetafileDCImpl: public wxGCDCImpl
+{
+public:
+ wxMetafileDCImpl( wxDC *owner,
+ const wxString& filename,
+ int width, int height,
+ const wxString& description );
- virtual ~wxMetafileDC(void);
+ virtual ~wxMetafileDCImpl();
- // Should be called at end of drawing
- virtual wxMetafile *Close(void);
+ // Should be called at end of drawing
+ virtual wxMetafile *Close();
- // Implementation
- inline wxMetafile *GetMetaFile(void) const { return m_metaFile; }
- inline void SetMetaFile(wxMetafile *mf) { m_metaFile = mf; }
+ // Implementation
+ wxMetafile *GetMetaFile(void) const { return m_metaFile; }
+ void SetMetaFile(wxMetafile *mf) { m_metaFile = mf; }
protected:
virtual void DoGetSize(int *width, int *height) const;
- wxMetafile* m_metaFile;
+ wxMetafile* m_metaFile;
+
+private:
+ DECLARE_CLASS(wxMetafileDCImpl)
+ DECLARE_NO_COPY_CLASS(wxMetafileDCImpl)
};
+class WXDLLEXPORT wxMetafileDC: public wxDC
+{
+ public:
+ // the ctor parameters specify the filename (empty for memory metafiles),
+ // the metafile picture size and the optional description/comment
+ wxMetafileDC( const wxString& filename = wxEmptyString,
+ int width = 0, int height = 0,
+ const wxString& description = wxEmptyString )
+ { m_pimpl = new wxMetafileDCImpl( this, filename, width, height, description ); }
+
+ wxMetafile *GetMetafile() const
+ { return ((wxMetafileDCImpl*)m_pimpl)->GetMetaFile(); }
+
+ wxMetafile *Close()
+ { return ((wxMetafileDCImpl*)m_pimpl)->Close(); }
+
+private:
+ DECLARE_CLASS(wxMetafileDC)
+ DECLARE_NO_COPY_CLASS(wxMetafileDC)
+};
+
+
/*
* Pass filename of existing non-placeable metafile, and bounding box.
* Adds a placeable metafile header, sets the mapping mode to anisotropic,
#if wxUSE_GUI
#include "wx/listbox.h"
+#include "wx/mac/carbon/dc.h"
+#include "wx/mac/carbon/dcclient.h"
+#include "wx/mac/carbon/dcmemory.h"
class WXDLLEXPORT wxMacCGContextStateSaver
{
#define _WX_MSW_DC_H_
#include "wx/defs.h"
+#include "wx/dc.h"
// ---------------------------------------------------------------------------
// macros
// this is an ABC: use one of the derived classes to create a DC associated
// with a window, screen, printer and so on
-class WXDLLEXPORT wxDC : public wxDCBase
+class WXDLLEXPORT wxMSWDCImpl: public wxDCImpl
{
public:
- wxDC(WXHDC hDC) { Init(); m_hDC = hDC; }
- virtual ~wxDC();
+ wxMSWDCImpl(wxDC *owner, WXHDC hDC);
+ virtual ~wxMSWDCImpl();
// implement base class pure virtuals
// ----------------------------------
virtual void SetRop(WXHDC cdc);
virtual void SelectOldObjects(WXHDC dc);
- wxWindow *GetWindow() const { return m_canvas; }
void SetWindow(wxWindow *win)
{
- m_canvas = win;
+ m_window = win;
#if wxUSE_PALETTE
// if we have palettes use the correct one for this window
protected:
void Init()
{
- m_canvas = NULL;
m_bOwnsDC = false;
m_hDC = NULL;
// create an uninitialized DC: this should be only used by the derived
// classes
- wxDC() { Init(); }
+ wxMSWDCImpl( wxDC *owner ) : wxDCImpl( owner ) { Init(); }
void RealizeScaleAndOrigin();
#endif // wxUSE_PALETTE
#if wxUSE_DC_CACHEING
- static wxList sm_bitmapCache;
- static wxList sm_dcCache;
+ static wxObjectList sm_bitmapCache;
+ static wxObjectList sm_dcCache;
#endif
- DECLARE_DYNAMIC_CLASS(wxDC)
- DECLARE_NO_COPY_CLASS(wxDC)
+ DECLARE_CLASS(wxMSWDCImpl)
+ DECLARE_NO_COPY_CLASS(wxMSWDCImpl)
};
// ----------------------------------------------------------------------------
// only/mainly)
// ----------------------------------------------------------------------------
-class WXDLLEXPORT wxDCTemp : public wxDC
+class WXDLLEXPORT wxDCTempImpl: public wxMSWDCImpl
{
public:
// construct a temporary DC with the specified HDC and size (it should be
// specified whenever we know it for this HDC)
- wxDCTemp(WXHDC hdc, const wxSize& size = wxDefaultSize)
- : wxDC(hdc),
+ wxDCTempImpl(wxDC *owner, WXHDC hdc, const wxSize& size )
+ : wxMSWDCImpl( owner, hdc ),
m_size(size)
{
}
- virtual ~wxDCTemp()
+ virtual ~wxDCTempImpl()
{
// prevent base class dtor from freeing it
SetHDC((WXHDC)NULL);
// find it ourselves
const wxSize m_size;
- DECLARE_NO_COPY_CLASS(wxDCTemp)
+ DECLARE_NO_COPY_CLASS(wxDCTempImpl)
};
+class WXDLLEXPORT wxDCTemp: public wxDC
+{
+public:
+ wxDCTemp( WXHDC hdc, const wxSize& size = wxDefaultSize )
+ {
+ m_pimpl = new wxDCTempImpl( this, hdc, size );
+ }
+
+};
+
+
+
#endif // _WX_MSW_DC_H_
// ----------------------------------------------------------------------------
#include "wx/dc.h"
+#include "wx/msw/dc.h"
+#include "wx/dcclient.h"
#include "wx/dynarray.h"
// ----------------------------------------------------------------------------
// DC classes
// ----------------------------------------------------------------------------
-class WXDLLEXPORT wxWindowDC : public wxDC
+class WXDLLEXPORT wxWindowDCImpl : public wxMSWDCImpl
{
public:
// default ctor
- wxWindowDC();
+ wxWindowDCImpl( wxDC *owner );
// Create a DC corresponding to the whole window
- wxWindowDC(wxWindow *win);
+ wxWindowDCImpl( wxDC *owner, wxWindow *win );
protected:
// initialize the newly created DC
virtual void DoGetSize(int *width, int *height) const;
private:
- DECLARE_DYNAMIC_CLASS_NO_COPY(wxWindowDC)
+ DECLARE_CLASS(wxWindowDCImpl)
+ DECLARE_NO_COPY_CLASS(wxWindowDCImpl)
};
-class WXDLLEXPORT wxClientDC : public wxWindowDC
+class WXDLLEXPORT wxClientDCImpl : public wxWindowDCImpl
{
public:
// default ctor
- wxClientDC();
+ wxClientDCImpl( wxDC *owner );
// Create a DC corresponding to the client area of the window
- wxClientDC(wxWindow *win);
+ wxClientDCImpl( wxDC *owner, wxWindow *win );
- virtual ~wxClientDC();
+ virtual ~wxClientDCImpl();
protected:
void InitDC();
virtual void DoGetSize(int *width, int *height) const;
private:
- DECLARE_DYNAMIC_CLASS_NO_COPY(wxClientDC)
+ DECLARE_CLASS(wxClientDCImpl)
+ DECLARE_NO_COPY_CLASS(wxClientDCImpl)
};
-class WXDLLEXPORT wxPaintDC : public wxClientDC
+class WXDLLEXPORT wxPaintDCImpl : public wxClientDCImpl
{
public:
- wxPaintDC();
+ wxPaintDCImpl( wxDC *owner );
// Create a DC corresponding for painting the window in OnPaint()
- wxPaintDC(wxWindow *win);
+ wxPaintDCImpl( wxDC *owner, wxWindow *win );
- virtual ~wxPaintDC();
+ virtual ~wxPaintDCImpl();
// find the entry for this DC in the cache (keyed by the window)
static WXHDC FindDCInCache(wxWindow* win);
wxPaintDCInfo *FindInCache(size_t *index = NULL) const;
private:
- DECLARE_DYNAMIC_CLASS_NO_COPY(wxPaintDC)
+ DECLARE_CLASS(wxPaintDCImpl)
+ DECLARE_NO_COPY_CLASS(wxPaintDCImpl)
};
/*
{
public:
wxPaintDCEx(wxWindow *canvas, WXHDC dc);
- virtual ~wxPaintDCEx();
+
private:
- int saveState;
-
DECLARE_CLASS(wxPaintDCEx)
DECLARE_NO_COPY_CLASS(wxPaintDCEx)
};
#ifndef _WX_DCMEMORY_H_
#define _WX_DCMEMORY_H_
-#include "wx/dcclient.h"
+#include "wx/dcmemory.h"
+#include "wx/msw/dc.h"
-class WXDLLEXPORT wxMemoryDC : public wxDC, public wxMemoryDCBase
+class WXDLLEXPORT wxMemoryDCImpl: public wxMSWDCImpl
{
public:
- wxMemoryDC() { CreateCompatible(NULL); Init(); }
- wxMemoryDC(wxBitmap& bitmap) { CreateCompatible(NULL); Init(); SelectObject(bitmap); }
- wxMemoryDC(wxDC *dc); // Create compatible DC
+ wxMemoryDCImpl( wxMemoryDC *owner );
+ wxMemoryDCImpl( wxMemoryDC *owner, wxBitmap& bitmap );
+ wxMemoryDCImpl( wxMemoryDC *owner, wxDC *dc ); // Create compatible DC
protected:
void Init();
private:
- DECLARE_DYNAMIC_CLASS_NO_COPY(wxMemoryDC)
+ DECLARE_CLASS(wxMemoryDCImpl)
+ DECLARE_NO_COPY_CLASS(wxMemoryDCImpl)
};
#endif
#if wxUSE_PRINTING_ARCHITECTURE
-#include "wx/dc.h"
+#include "wx/dcprint.h"
#include "wx/cmndata.h"
+#include "wx/msw/dc.h"
-class WXDLLEXPORT wxPrinterDC : public wxDC
+// ------------------------------------------------------------------------
+// wxPrinterDCImpl
+//
+
+class WXDLLEXPORT wxPrinterDCImpl : public wxMSWDCImpl
{
public:
- // Create a printer DC (obsolete function: use wxPrintData version now)
- wxPrinterDC(const wxString& driver, const wxString& device, const wxString& output, bool interactive = true, int orientation = wxPORTRAIT);
-
// Create from print data
- wxPrinterDC(const wxPrintData& data);
-
- wxPrinterDC(WXHDC theDC);
+ wxPrinterDCImpl( wxPrinterDC *owner, const wxPrintData& data );
+ wxPrinterDCImpl( wxPrinterDC *owner, WXHDC theDC );
// override some base class virtuals
virtual bool StartDoc(const wxString& message);
virtual void StartPage();
virtual void EndPage();
- wxRect GetPaperRect();
+ virtual wxRect GetPaperRect();
protected:
virtual void DoDrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y,
wxPrintData m_printData;
private:
- DECLARE_DYNAMIC_CLASS_NO_COPY(wxPrinterDC)
+ DECLARE_CLASS(wxPrinterDCImpl)
+ DECLARE_NO_COPY_CLASS(wxPrinterDCImpl)
};
-// Gets an HDC for the default printer configuration
-// WXHDC WXDLLEXPORT wxGetPrinterDC(int orientation);
-
// Gets an HDC for the specified printer configuration
WXHDC WXDLLEXPORT wxGetPrinterDC(const wxPrintData& data);
+// ------------------------------------------------------------------------
+// wxPrinterDCromHDC
+//
+
+class WXDLLEXPORT wxPrinterDCFromHDC: public wxPrinterDC
+{
+public:
+ wxPrinterDCFromHDC( WXHDC theDC )
+ {
+ m_pimpl = new wxPrinterDCImpl( this, theDC );
+ }
+};
+
#endif // wxUSE_PRINTING_ARCHITECTURE
#endif // _WX_MSW_DCPRINT_H_
#ifndef _WX_MSW_DCSCREEN_H_
#define _WX_MSW_DCSCREEN_H_
-#include "wx/dc.h"
+#include "wx/dcscreen.h"
+#include "wx/msw/dc.h"
-class WXDLLEXPORT wxScreenDC : public wxDC
+class WXDLLEXPORT wxScreenDCImpl : public wxMSWDCImpl
{
public:
// Create a DC representing the whole screen
- wxScreenDC();
-
- // Compatibility with X's requirements for drawing on top of all windows:
- // they don't do anything under MSW
- static bool StartDrawingOnTop(wxWindow* WXUNUSED(window)) { return true; }
- static bool StartDrawingOnTop(wxRect* WXUNUSED(rect) = NULL) { return true; }
- static bool EndDrawingOnTop() { return true; }
+ wxScreenDCImpl( wxScreenDC *owner );
protected:
virtual void DoGetSize(int *w, int *h) const
}
private:
- DECLARE_DYNAMIC_CLASS_NO_COPY(wxScreenDC)
+ DECLARE_CLASS(wxScreenDCImpl)
+ DECLARE_NO_COPY_CLASS(wxScreenDCImpl)
};
#endif // _WX_MSW_DCSCREEN_H_
int width = 0, int height = 0,
const wxString& description = wxEmptyString);
- virtual ~wxEnhMetaFileDC();
-
- // obtain a pointer to the new metafile (caller should delete it)
- wxEnhMetaFile *Close();
-
-protected:
- virtual void DoGetSize(int *width, int *height) const;
-
-private:
- // size passed to ctor and returned by DoGetSize()
- int m_width,
- m_height;
-
DECLARE_DYNAMIC_CLASS_NO_COPY(wxEnhMetaFileDC)
};
DECLARE_DYNAMIC_CLASS(wxMetafile)
};
-class WXDLLEXPORT wxMetafileDC: public wxDC
+class WXDLLEXPORT wxMetafileDCImpl: public wxMSWDCImpl
{
public:
- // Don't supply origin and extent
- // Supply them to wxMakeMetaFilePlaceable instead.
- wxMetafileDC(const wxString& file = wxEmptyString);
-
- // Supply origin and extent (recommended).
- // Then don't need to supply them to wxMakeMetaFilePlaceable.
+ wxMetafileDCImpl(const wxString& file = wxEmptyString);
wxMetafileDC(const wxString& file, int xext, int yext, int xorg, int yorg);
+ virtual ~wxMetafileDCImpl();
- virtual ~wxMetafileDC();
-
- // Should be called at end of drawing
virtual wxMetafile *Close();
virtual void SetMapMode(int mode);
virtual void DoGetTextExtent(const wxString& string,
wxMetafile* m_metaFile;
private:
- DECLARE_DYNAMIC_CLASS(wxMetafileDC)
+ DECLARE_CLASS(wxMetafileDCImpl)
+ DECLARE_NO_COPY_CLASS(wxMetafileDCImpl)
};
+class WXDLLEXPORT wxMetafileDC: public wxDC
+{
+public:
+ // Don't supply origin and extent
+ // Supply them to wxMakeMetaFilePlaceable instead.
+ wxMetafileDC(const wxString& file);
+ { m_pimpl = new wxMetafileDCImpl( this, file ); }
+
+ // Supply origin and extent (recommended).
+ // Then don't need to supply them to wxMakeMetaFilePlaceable.
+ wxMetafileDC(const wxString& file, int xext, int yext, int xorg, int yorg)
+ { m_pimpl = new wxMetafileDCImpl( this, file, xext, yext, xorg, yorg ); }
+
+ wxMetafile *GetMetafile() const
+ { return ((wxMetafileDCImpl*)m_pimpl)->GetMetaFile(); }
+
+ wxMetafile *Close()
+ { return ((wxMetafileDCImpl*)m_pimpl)->Close(); }
+
+private:
+ DECLARE_CLASS(wxMetafileDC)
+ DECLARE_NO_COPY_CLASS(wxMetafileDC)
+};
+
+
+
+
/*
* Pass filename of existing non-placeable metafile, and bounding box.
* Adds a placeable metafile header, sets the mapping mode to anisotropic,
#include "wx/gdicmn.h"
#include "wx/colour.h"
+#include "wx/msw/dc.h"
+#include "wx/msw/dcclient.h"
+#include "wx/msw/dcmemory.h"
+
+
// make conversion from wxColour and COLORREF a bit less painful
inline COLORREF wxColourToRGB(const wxColour& c)
{
#include "wx/scrolwin.h"
#include "wx/dialog.h"
#include "wx/frame.h"
+#include "wx/dc.h"
class WXDLLIMPEXP_FWD_CORE wxDC;
class WXDLLIMPEXP_FWD_CORE wxButton;
virtual wxPageSetupDialogBase *CreatePageSetupDialog( wxWindow *parent,
wxPageSetupDialogData * data = NULL ) = 0;
- virtual wxDC* CreatePrinterDC( const wxPrintData& data ) = 0;
+ virtual wxDCImpl* CreatePrinterDCImpl( wxPrinterDC *owner, const wxPrintData& data ) = 0;
// What to do and what to show in the wxPrintDialog
// a) Use the generic print setup dialog or a native one?
virtual wxPageSetupDialogBase *CreatePageSetupDialog( wxWindow *parent,
wxPageSetupDialogData * data = NULL );
- virtual wxDC* CreatePrinterDC( const wxPrintData& data );
+ virtual wxDCImpl* CreatePrinterDCImpl( wxPrinterDC *owner, const wxPrintData& data );
virtual bool HasPrintSetupDialog();
virtual wxDialog *CreatePrintSetupDialog( wxWindow *parent, wxPrintData *data );
#include "wx/colordlg.h"
#include "wx/image.h"
#include "wx/artprov.h"
+#include "wx/dcgraph.h"
#define wxTEST_GRAPHICS 1
HIRect splitterRect = CGRectMake( rect.x , rect.y , rect.width , rect.height );
CGContextRef cgContext ;
- cgContext = (CGContextRef) dc.GetGraphicsContext()->GetNativeContext() ;
+ wxGCDCImpl *impl = (wxGCDCImpl*) dc.GetImpl();
+ cgContext = (CGContextRef) impl->GetGraphicsContext()->GetNativeContext() ;
HIThemeSplitterDrawInfo drawInfo ;
drawInfo.version = 0 ;
#ifdef __WXMSW__
#include "wx/msw/wrapwin.h"
#include "wx/msw/private.h"
+ #include "wx/msw/dc.h"
#endif
IMPLEMENT_DYNAMIC_CLASS(wxAuiManagerEvent, wxEvent)
wxBrush brush(stipple);
dc.SetBrush(brush);
#ifdef __WXMSW__
- PatBlt(GetHdcOf(dc), rect.GetX(), rect.GetY(), rect.GetWidth(), rect.GetHeight(), PATINVERT);
+ wxMSWDCImpl *impl = (wxMSWDCImpl*) dc.GetImpl();
+ PatBlt(GetHdcOf(*impl), rect.GetX(), rect.GetY(), rect.GetWidth(), rect.GetHeight(), PATINVERT);
#else
dc.SetPen(*wxTRANSPARENT_PEN);
{
wxFrame* f = static_cast<wxFrame*>(w);
can_do_transparent = f->CanSetTransparent();
+
break;
}
#include "wx/math.h"
#endif
+#if wxUSE_NEW_DC
+#ifdef __WXMSW__
+#include "wx/msw/dcclient.h"
+#include "wx/msw/dcmemory.h"
+#include "wx/msw/dcscreen.h"
+#endif
-#if wxUSE_NEW_DC
+#ifdef __WXGTK__
+#include "wx/gtk/dcclient.h"
+#include "wx/gtk/dcmemory.h"
+#include "wx/gtk/dcscreen.h"
+#endif
+
+#ifdef __WXMAC__
+#include "wx/mac/dcclient.h"
+#include "wx/mac/dcmemory.h"
+#include "wx/mac/dcscreen.h"
+#endif
//----------------------------------------------------------------------------
// wxDCFactory
// wxNativeDCFactory
//-----------------------------------------------------------------------------
-wxImplDC* wxNativeDCFactory::CreateWindowDC( wxWindowDC *owner )
+wxDCImpl* wxNativeDCFactory::CreateWindowDC( wxWindowDC *owner )
{
-#if defined(__WXMSW__)
- return new wxWindowsWindowImplDC( owner );
-#elif defined(__WXGTK20__)
- return new wxGTKWindowImplDC( owner );
-#elif defined(__WXGTK__)
- return new wxGTKWindowImplDC( owner );
-#elif defined(__WXMAC__)
- return new wxMacWindowImplDC( owner );
-#elif defined(__WXCOCOA__)
- return new wxCocoaWindowImplDC( owner );
-#elif defined(__WXMOTIF__)
- return new wxMotifWindowImplDC( owner );
-#elif defined(__WXX11__)
- return new wxX11WindowImplDC( owner );
-#elif defined(__WXMGL__)
- return new wxMGLWindowImplDC( owner );
-#elif defined(__WXDFB__)
- return new wxDFBWindowImplDC( owner );
-#elif defined(__WXPM__)
- return new wxPMWindowImplDC( owner );
-#elif defined(__PALMOS__)
- return new wxPalmWindowImplDC( owner );
-#endif
+ return new wxWindowDCImpl( owner );
}
-wxImplDC* wxNativeDCFactory::CreateWindowDC( wxWindowDC *owner, wxWindow *window )
+wxDCImpl* wxNativeDCFactory::CreateWindowDC( wxWindowDC *owner, wxWindow *window )
{
-#if defined(__WXMSW__)
- return new wxWindowsWindowImplDC( owner, window );
-#elif defined(__WXGTK20__)
- return new wxGTKWindowImplDC( owner, window );
-#elif defined(__WXGTK__)
- return new wxGTKWindowImplDC( owner, window );
-#elif defined(__WXMAC__)
- return new wxMacWindowImplDC( owner, window );
-#elif defined(__WXCOCOA__)
- return new wxCocoaWindowImplDC( owner, window );
-#elif defined(__WXMOTIF__)
- return new wxMotifWindowImplDC( owner, window );
-#elif defined(__WXX11__)
- return new wxX11WindowImplDC( owner, window );
-#elif defined(__WXMGL__)
- return new wxMGLWindowImplDC( owner, window );
-#elif defined(__WXDFB__)
- return new wxDFBWindowImplDC( owner, window );
-#elif defined(__WXPM__)
- return new wxPMWindowImplDC( owner, window );
-#elif defined(__PALMOS__)
- return new wxPalmWindowImplDC( owner, window );
-#endif
+ return new wxWindowDCImpl( owner, window );
}
-wxImplDC* wxNativeDCFactory::CreateClientDC( wxClientDC *owner )
-{
-#if defined(__WXMSW__)
- return new wxWindowsClientImplDC( owner );
-#elif defined(__WXGTK20__)
- return new wxGTKClientImplDC( owner );
-#elif defined(__WXGTK__)
- return new wxGTKClientImplDC( owner );
-#elif defined(__WXMAC__)
- return new wxMacClientImplDC( owner );
-#elif defined(__WXCOCOA__)
- return new wxCocoaClientImplDC( owner );
-#elif defined(__WXMOTIF__)
- return new wxMotifClientImplDC( owner );
-#elif defined(__WXX11__)
- return new wxX11ClientImplDC( owner );
-#elif defined(__WXMGL__)
- return new wxMGLClientImplDC( owner );
-#elif defined(__WXDFB__)
- return new wxDFBClientImplDC( owner );
-#elif defined(__WXPM__)
- return new wxPMClientImplDC( owner );
-#elif defined(__PALMOS__)
- return new wxPalmClientImplDC( owner );
-#endif
+wxDCImpl* wxNativeDCFactory::CreateClientDC( wxClientDC *owner )
+{
+ return new wxClientDCImpl( owner );
}
-wxImplDC* wxNativeDCFactory::CreateClientDC( wxClientDC *owner, wxWindow *window )
-{
-#if defined(__WXMSW__)
- return new wxWindowsClientImplDC( owner, window );
-#elif defined(__WXGTK20__)
- return new wxGTKClientImplDC( owner, window );
-#elif defined(__WXGTK__)
- return new wxGTKClientImplDC( owner, window );
-#elif defined(__WXMAC__)
- return new wxMacClientImplDC( owner, window );
-#elif defined(__WXCOCOA__)
- return new wxCocoaClientImplDC( owner, window );
-#elif defined(__WXMOTIF__)
- return new wxMotifClientImplDC( owner, window );
-#elif defined(__WXX11__)
- return new wxX11ClientImplDC( owner, window );
-#elif defined(__WXMGL__)
- return new wxMGLClientImplDC( owner, window );
-#elif defined(__WXDFB__)
- return new wxDFBClientImplDC( owner, window );
-#elif defined(__WXPM__)
- return new wxPMClientImplDC( owner, window );
-#elif defined(__PALMOS__)
- return new wxPalmClientImplDC( owner, window );
-#endif
+wxDCImpl* wxNativeDCFactory::CreateClientDC( wxClientDC *owner, wxWindow *window )
+{
+ return new wxClientDCImpl( owner, window );
}
-wxImplDC* wxNativeDCFactory::CreatePaintDC( wxPaintDC *owner )
-{
-#if defined(__WXMSW__)
- return new wxWindowsPaintImplDC( owner );
-#elif defined(__WXGTK20__)
- return new wxGTKPaintImplDC( owner );
-#elif defined(__WXGTK__)
- return new wxGTKPaintImplDC( owner );
-#elif defined(__WXMAC__)
- return new wxMacPaintImplDC( owner );
-#elif defined(__WXCOCOA__)
- return new wxCocoaPaintImplDC( owner );
-#elif defined(__WXMOTIF__)
- return new wxMotifPaintImplDC( owner );
-#elif defined(__WXX11__)
- return new wxX11PaintImplDC( owner );
-#elif defined(__WXMGL__)
- return new wxMGLPaintImplDC( owner );
-#elif defined(__WXDFB__)
- return new wxDFBPaintImplDC( owner );
-#elif defined(__WXPM__)
- return new wxPMPaintImplDC( owner );
-#elif defined(__PALMOS__)
- return new wxPalmPaintImplDC( owner );
-#endif
+wxDCImpl* wxNativeDCFactory::CreatePaintDC( wxPaintDC *owner )
+{
+ return new wxPaintDCImpl( owner );
}
-wxImplDC* wxNativeDCFactory::CreatePaintDC( wxPaintDC *owner, wxWindow *window )
-{
-#if defined(__WXMSW__)
- return new wxWindowsPaintImplDC( owner, window );
-#elif defined(__WXGTK20__)
- return new wxGTKPaintImplDC( owner, window );
-#elif defined(__WXGTK__)
- return new wxGTKPaintImplDC( owner, window );
-#elif defined(__WXMAC__)
- return new wxMacPaintImplDC( owner, window );
-#elif defined(__WXCOCOA__)
- return new wxCocoaPaintImplDC( owner, window );
-#elif defined(__WXMOTIF__)
- return new wxMotifPaintImplDC( owner, window );
-#elif defined(__WXX11__)
- return new wxX11PaintImplDC( owner, window );
-#elif defined(__WXMGL__)
- return new wxMGLPaintImplDC( owner, window );
-#elif defined(__WXDFB__)
- return new wxDFBPaintImplDC( owner, window );
-#elif defined(__WXPM__)
- return new wxPMPaintImplDC( owner, window );
-#elif defined(__PALMOS__)
- return new wxPalmPaintImplDC( owner, window );
-#endif
+wxDCImpl* wxNativeDCFactory::CreatePaintDC( wxPaintDC *owner, wxWindow *window )
+{
+ return new wxPaintDCImpl( owner, window );
}
-wxImplDC* wxNativeDCFactory::CreateMemoryDC( wxMemoryDC *owner )
-{
-#if defined(__WXMSW__)
- return new wxWindowsMemoryImplDC( owner );
-#elif defined(__WXGTK20__)
- return new wxGTKMemoryImplDC( owner );
-#elif defined(__WXGTK__)
- return new wxGTKMemoryImplDC( owner );
-#elif defined(__WXMAC__)
- return new wxMacMemoryImplDC( owner );
-#elif defined(__WXCOCOA__)
- return new wxCocoaMemoryImplDC( owner );
-#elif defined(__WXMOTIF__)
- return new wxMotifMemoryImplDC( owner );
-#elif defined(__WXX11__)
- return new wxX11MemoryImplDC( owner );
-#elif defined(__WXMGL__)
- return new wxMGLMemoryImplDC( owner );
-#elif defined(__WXDFB__)
- return new wxDFBMemoryImplDC( owner );
-#elif defined(__WXPM__)
- return new wxPMMemoryImplDC( owner );
-#elif defined(__PALMOS__)
- return new wxPalmMemoryImplDC( owner );
-#endif
+wxDCImpl* wxNativeDCFactory::CreateMemoryDC( wxMemoryDC *owner )
+{
+ return new wxMemoryDCImpl( owner );
}
-wxImplDC* wxNativeDCFactory::CreateMemoryDC( wxMemoryDC *owner, wxBitmap &bitmap )
-{
-#if defined(__WXMSW__)
- return new wxWindowsMemoryImplDC( owner, bitmap );
-#elif defined(__WXGTK20__)
- return new wxGTKMemoryImplDC( owner, bitmap );
-#elif defined(__WXGTK__)
- return new wxGTKMemoryImplDC( owner, bitmap );
-#elif defined(__WXMAC__)
- return new wxMacMemoryImplDC( owner, bitmap );
-#elif defined(__WXCOCOA__)
- return new wxCocoaMemoryImplDC( owner, bitmap );
-#elif defined(__WXMOTIF__)
- return new wxMotifMemoryImplDC( owner, bitmap );
-#elif defined(__WXX11__)
- return new wxX11MemoryImplDC( owner, bitmap );
-#elif defined(__WXMGL__)
- return new wxMGLMemoryImplDC( owner, bitmap );
-#elif defined(__WXDFB__)
- return new wxDFBMemoryImplDC( owner, bitmap );
-#elif defined(__WXPM__)
- return new wxPMMemoryImplDC( owner, bitmap );
-#elif defined(__PALMOS__)
- return new wxPalmMemoryImplDC( owner, bitmap );
-#endif
+wxDCImpl* wxNativeDCFactory::CreateMemoryDC( wxMemoryDC *owner, wxBitmap &bitmap )
+{
+ return new wxMemoryDCImpl( owner, bitmap );
}
-wxImplDC* wxNativeDCFactory::CreateMemoryDC( wxMemoryDC *owner, wxDC *dc )
-{
-#if defined(__WXMSW__)
- return new wxWindowsMemoryImplDC( owner, dc );
-#elif defined(__WXGTK20__)
- return new wxGTKMemoryImplDC( owner, dc );
-#elif defined(__WXGTK__)
- return new wxGTKMemoryImplDC( owner, dc );
-#elif defined(__WXMAC__)
- return new wxMacMemoryImplDC( owner, dc );
-#elif defined(__WXCOCOA__)
- return new wxCocoaMemoryImplDC( owner, dc );
-#elif defined(__WXMOTIF__)
- return new wxMotifMemoryImplDC( owner, dc );
-#elif defined(__WXX11__)
- return new wxX11MemoryImplDC( owner, dc );
-#elif defined(__WXMGL__)
- return new wxMGLMemoryImplDC( owner, dc );
-#elif defined(__WXDFB__)
- return new wxDFBMemoryImplDC( owner, dc );
-#elif defined(__WXPM__)
- return new wxPMMemoryImplDC( owner, dc );
-#elif defined(__PALMOS__)
- return new wxPalmMemoryImplDC( owner, dc );
-#endif
+wxDCImpl* wxNativeDCFactory::CreateMemoryDC( wxMemoryDC *owner, wxDC *dc )
+{
+ return new wxMemoryDCImpl( owner, dc );
}
-wxImplDC* wxNativeDCFactory::CreateScreenDC( wxScreenDC *owner )
-{
-#if defined(__WXMSW__)
- return new wxWindowsScreenImplDC( owner );
-#elif defined(__WXGTK20__)
- return new wxGTKScreenImplDC( owner );
-#elif defined(__WXGTK__)
- return new wxGTKScreenImplDC( owner );
-#elif defined(__WXMAC__)
- return new wxMacScreenImplDC( owner );
-#elif defined(__WXCOCOA__)
- return new wxCocoaScreenImplDC( owner );
-#elif defined(__WXMOTIF__)
- return new wxMotifScreenImplDC( owner );
-#elif defined(__WXX11__)
- return new wxX11ScreenImplDC( owner );
-#elif defined(__WXMGL__)
- return new wxMGLScreenImplDC( owner );
-#elif defined(__WXDFB__)
- return new wxDFBScreenImplDC( owner );
-#elif defined(__WXPM__)
- return new wxPMScreenImplDC( owner );
-#elif defined(__PALMOS__)
- return new wxPalmScreenImplDC( owner );
-#endif
+wxDCImpl* wxNativeDCFactory::CreateScreenDC( wxScreenDC *owner )
+{
+ return new wxScreenDCImpl( owner );
}
-wxImplDC *wxNativeDCFactory::CreatePrinterDC( wxPrinterDC *owner, const wxPrintData &data )
+wxDCImpl *wxNativeDCFactory::CreatePrinterDC( wxPrinterDC *owner, const wxPrintData &data )
{
wxPrintFactory *factory = wxPrintFactory::GetFactory();
- return factory->CreatePrinterImplDC( owner, data );
+ return factory->CreatePrinterDCImpl( owner, data );
}
//-----------------------------------------------------------------------------
wxWindowDC::wxWindowDC()
{
- wxDCFactory *factory = wxDCFactory::GetFactory();
- m_pimpl = factory->CreateWindowDC( this );
}
wxWindowDC::wxWindowDC( wxWindow *win )
// wxClientDC
//-----------------------------------------------------------------------------
-IMPLEMENT_DYNAMIC_CLASS(wxClientDC, wxDC)
+IMPLEMENT_DYNAMIC_CLASS(wxClientDC, wxWindowDC)
wxClientDC::wxClientDC()
{
- wxDCFactory *factory = wxDCFactory::GetFactory();
- m_pimpl = factory->CreateClientDC( this );
}
wxClientDC::wxClientDC( wxWindow *win )
// wxPaintDC
//-----------------------------------------------------------------------------
-IMPLEMENT_DYNAMIC_CLASS(wxPaintDC, wxDC)
+IMPLEMENT_DYNAMIC_CLASS(wxPaintDC, wxClientDC)
wxPaintDC::wxPaintDC()
{
- wxDCFactory *factory = wxDCFactory::GetFactory();
- m_pimpl = factory->CreatePaintDC( this );
}
wxPaintDC::wxPaintDC( wxWindow *win )
wxPrinterDC::wxPrinterDC()
{
+ wxPrintData data; // Does this make sense?
wxDCFactory *factory = wxDCFactory::GetFactory();
- // m_pimpl = factory->CreatePrinterDC( this, data );
+ m_pimpl = factory->CreatePrinterDC( this, data );
}
wxPrinterDC::wxPrinterDC( const wxPrintData &data )
//-----------------------------------------------------------------------------
-// wxImplDC
+// wxDCImpl
//-----------------------------------------------------------------------------
-IMPLEMENT_ABSTRACT_CLASS(wxImplDC, wxObject)
+IMPLEMENT_ABSTRACT_CLASS(wxDCImpl, wxObject)
-wxImplDC::wxImplDC( wxDC *owner )
- : m_colour(wxColourDisplay())
+wxDCImpl::wxDCImpl( wxDC *owner )
+ : m_window(NULL)
+ , m_colour(wxColourDisplay())
, m_ok(true)
, m_clipping(false)
, m_isInteractive(0)
ResetClipping();
}
-wxImplDC::~wxImplDC()
+wxDCImpl::~wxDCImpl()
{
}
// coordinate conversions and transforms
// ----------------------------------------------------------------------------
-wxCoord wxImplDC::DeviceToLogicalX(wxCoord x) const
+wxCoord wxDCImpl::DeviceToLogicalX(wxCoord x) const
{
return wxRound((double)(x - m_deviceOriginX - m_deviceLocalOriginX) / m_scaleX) * m_signX + m_logicalOriginX;
}
-wxCoord wxImplDC::DeviceToLogicalY(wxCoord y) const
+wxCoord wxDCImpl::DeviceToLogicalY(wxCoord y) const
{
return wxRound((double)(y - m_deviceOriginY - m_deviceLocalOriginY) / m_scaleY) * m_signY + m_logicalOriginY;
}
-wxCoord wxImplDC::DeviceToLogicalXRel(wxCoord x) const
+wxCoord wxDCImpl::DeviceToLogicalXRel(wxCoord x) const
{
return wxRound((double)(x) / m_scaleX);
}
-wxCoord wxImplDC::DeviceToLogicalYRel(wxCoord y) const
+wxCoord wxDCImpl::DeviceToLogicalYRel(wxCoord y) const
{
return wxRound((double)(y) / m_scaleY);
}
-wxCoord wxImplDC::LogicalToDeviceX(wxCoord x) const
+wxCoord wxDCImpl::LogicalToDeviceX(wxCoord x) const
{
return wxRound((double)(x - m_logicalOriginX) * m_scaleX) * m_signX + m_deviceOriginX * m_signY + m_deviceLocalOriginX;
}
-wxCoord wxImplDC::LogicalToDeviceY(wxCoord y) const
+wxCoord wxDCImpl::LogicalToDeviceY(wxCoord y) const
{
return wxRound((double)(y - m_logicalOriginY) * m_scaleY) * m_signY + m_deviceOriginY * m_signY + m_deviceLocalOriginY;
}
-wxCoord wxImplDC::LogicalToDeviceXRel(wxCoord x) const
+wxCoord wxDCImpl::LogicalToDeviceXRel(wxCoord x) const
{
return wxRound((double)(x) * m_scaleX);
}
-wxCoord wxImplDC::LogicalToDeviceYRel(wxCoord y) const
+wxCoord wxDCImpl::LogicalToDeviceYRel(wxCoord y) const
{
return wxRound((double)(y) * m_scaleY);
}
-void wxImplDC::ComputeScaleAndOrigin()
+void wxDCImpl::ComputeScaleAndOrigin()
{
m_scaleX = m_logicalScaleX * m_userScaleX;
m_scaleY = m_logicalScaleY * m_userScaleY;
}
-void wxImplDC::SetMapMode( int mode )
+void wxDCImpl::SetMapMode( int mode )
{
switch (mode)
{
m_mappingMode = mode;
}
-void wxImplDC::SetUserScale( double x, double y )
+void wxDCImpl::SetUserScale( double x, double y )
{
// allow negative ? -> no
m_userScaleX = x;
ComputeScaleAndOrigin();
}
-void wxImplDC::SetLogicalScale( double x, double y )
+void wxDCImpl::SetLogicalScale( double x, double y )
{
// allow negative ?
m_logicalScaleX = x;
ComputeScaleAndOrigin();
}
-void wxImplDC::SetLogicalOrigin( wxCoord x, wxCoord y )
+void wxDCImpl::SetLogicalOrigin( wxCoord x, wxCoord y )
{
m_logicalOriginX = x * m_signX;
m_logicalOriginY = y * m_signY;
ComputeScaleAndOrigin();
}
-void wxImplDC::SetDeviceOrigin( wxCoord x, wxCoord y )
+void wxDCImpl::SetDeviceOrigin( wxCoord x, wxCoord y )
{
m_deviceOriginX = x;
m_deviceOriginY = y;
ComputeScaleAndOrigin();
}
-void wxImplDC::SetDeviceLocalOrigin( wxCoord x, wxCoord y )
+void wxDCImpl::SetDeviceLocalOrigin( wxCoord x, wxCoord y )
{
m_deviceLocalOriginX = x;
m_deviceLocalOriginY = y;
ComputeScaleAndOrigin();
}
-void wxImplDC::SetAxisOrientation( bool xLeftRight, bool yBottomUp )
+void wxDCImpl::SetAxisOrientation( bool xLeftRight, bool yBottomUp )
{
// only wxPostScripDC has m_signX = -1, we override SetAxisOrientation there
// wxWidgets 2.9: no longer override it
static FontWidthCache s_fontWidthCache;
-bool wxImplDC::DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths) const
+bool wxDCImpl::DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths) const
{
int totalWidth = 0;
return true;
}
-void wxImplDC::GetMultiLineTextExtent(const wxString& text,
+void wxDCImpl::GetMultiLineTextExtent(const wxString& text,
wxCoord *x,
wxCoord *y,
wxCoord *h,
*h = heightLine;
}
-void wxImplDC::DoDrawCheckMark(wxCoord x1, wxCoord y1,
+void wxDCImpl::DoDrawCheckMark(wxCoord x1, wxCoord y1,
wxCoord width, wxCoord height)
{
wxCHECK_RET( IsOk(), wxT("invalid window dc") );
}
bool
-wxImplDC::DoStretchBlit(wxCoord xdest, wxCoord ydest,
+wxDCImpl::DoStretchBlit(wxCoord xdest, wxCoord ydest,
wxCoord dstWidth, wxCoord dstHeight,
wxDC *source,
wxCoord xsrc, wxCoord ysrc,
return rc;
}
-void wxImplDC::DrawLines(const wxPointList *list, wxCoord xoffset, wxCoord yoffset)
+void wxDCImpl::DrawLines(const wxPointList *list, wxCoord xoffset, wxCoord yoffset)
{
int n = list->GetCount();
wxPoint *points = new wxPoint[n];
delete [] points;
}
-void wxImplDC::DrawPolygon(const wxPointList *list,
+void wxDCImpl::DrawPolygon(const wxPointList *list,
wxCoord xoffset, wxCoord yoffset,
int fillStyle)
{
}
void
-wxImplDC::DoDrawPolyPolygon(int n,
+wxDCImpl::DoDrawPolyPolygon(int n,
int count[],
wxPoint points[],
wxCoord xoffset, wxCoord yoffset,
#if wxUSE_SPLINES
-void wxImplDC::DoDrawSpline(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2, wxCoord x3, wxCoord y3)
+void wxDCImpl::DoDrawSpline(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2, wxCoord x3, wxCoord y3)
{
wxPointList point_list;
}
}
-void wxImplDC::DoDrawSpline(int n, wxPoint points[])
+void wxDCImpl::DoDrawSpline(int n, wxPoint points[])
{
wxPointList list;
for (int i =0; i < n; i++)
}
}
-void wxImplDC::DoDrawSpline( const wxPointList *points )
+void wxDCImpl::DoDrawSpline( const wxPointList *points )
{
wxCHECK_RET( IsOk(), wxT("invalid window dc") );
-void wxImplDC::DoGradientFillLinear(const wxRect& rect,
+void wxDCImpl::DoGradientFillLinear(const wxRect& rect,
const wxColour& initialColour,
const wxColour& destColour,
wxDirection nDirection)
SetBrush(oldBrush);
}
-void wxImplDC::DoGradientFillConcentric(const wxRect& rect,
+void wxDCImpl::DoGradientFillConcentric(const wxRect& rect,
const wxColour& initialColour,
const wxColour& destColour,
const wxPoint& circleCenter)
#if wxUSE_GRAPHICS_CONTEXT
#include "wx/graphics.h"
+#include "wx/dcgraph.h"
#ifndef WX_PRECOMP
#include "wx/icon.h"
// wxDC bridge class
//-----------------------------------------------------------------------------
-#ifdef __WXMAC__
-IMPLEMENT_DYNAMIC_CLASS(wxGCDC, wxDCBase)
-#else
IMPLEMENT_DYNAMIC_CLASS(wxGCDC, wxDC)
-#endif
+
+wxGCDC::wxGCDC(const wxWindowDC& dc)
+{
+ m_pimpl = new wxGCDCImpl( this, dc );
+}
+
+wxGCDC::wxGCDC( const wxMemoryDC& dc)
+{
+ m_pimpl = new wxGCDCImpl( this, dc );
+}
wxGCDC::wxGCDC()
{
- Init();
+ m_pimpl = new wxGCDCImpl( this );
+}
+
+wxGraphicsContext* wxGCDC::GetGraphicsContext()
+{
+ if (!m_pimpl) return NULL;
+ wxGCDCImpl *gc_impl = (wxGCDCImpl*) m_pimpl;
+ return gc_impl->GetGraphicsContext();
}
void wxGCDC::SetGraphicsContext( wxGraphicsContext* ctx )
+{
+ if (!m_pimpl) return;
+ wxGCDCImpl *gc_impl = (wxGCDCImpl*) m_pimpl;
+ gc_impl->SetGraphicsContext( ctx );
+}
+
+IMPLEMENT_ABSTRACT_CLASS(wxGCDCImpl, wxDCImpl)
+
+wxGCDCImpl::wxGCDCImpl( wxDC *owner ) :
+ wxDCImpl( owner )
+{
+ Init();
+}
+
+void wxGCDCImpl::SetGraphicsContext( wxGraphicsContext* ctx )
{
delete m_graphicContext;
m_graphicContext = ctx;
}
}
-wxGCDC::wxGCDC(const wxWindowDC& dc)
+wxGCDCImpl::wxGCDCImpl( wxDC *owner, const wxWindowDC& dc ) :
+ wxDCImpl( owner )
{
Init();
SetGraphicsContext( wxGraphicsContext::Create(dc) );
}
-#ifdef __WXMSW__
-wxGCDC::wxGCDC(const wxMemoryDC& dc)
+wxGCDCImpl::wxGCDCImpl( wxDC *owner, const wxMemoryDC& dc ) :
+ wxDCImpl( owner )
{
Init();
SetGraphicsContext( wxGraphicsContext::Create(dc) );
}
-#endif
-void wxGCDC::Init()
+void wxGCDCImpl::Init()
{
m_ok = false;
m_colour = true;
}
-wxGCDC::~wxGCDC()
+wxGCDCImpl::~wxGCDCImpl()
{
delete m_graphicContext;
}
-void wxGCDC::DoDrawBitmap( const wxBitmap &bmp, wxCoord x, wxCoord y, bool WXUNUSED(useMask) )
+void wxGCDCImpl::DoDrawBitmap( const wxBitmap &bmp, wxCoord x, wxCoord y, bool WXUNUSED(useMask) )
{
- wxCHECK_RET( Ok(), wxT("wxGCDC(cg)::DoDrawBitmap - invalid DC") );
- wxCHECK_RET( bmp.Ok(), wxT("wxGCDC(cg)::DoDrawBitmap - invalid bitmap") );
+ wxCHECK_RET( IsOk(), wxT("wxGCDC(cg)::DoDrawBitmap - invalid DC") );
+ wxCHECK_RET( bmp.IsOk(), wxT("wxGCDC(cg)::DoDrawBitmap - invalid bitmap") );
if ( bmp.GetDepth() == 1 )
{
m_graphicContext->DrawBitmap( bmp, x , y , bmp.GetWidth() , bmp.GetHeight() );
}
-void wxGCDC::DoDrawIcon( const wxIcon &icon, wxCoord x, wxCoord y )
+void wxGCDCImpl::DoDrawIcon( const wxIcon &icon, wxCoord x, wxCoord y )
{
- wxCHECK_RET( Ok(), wxT("wxGCDC(cg)::DoDrawIcon - invalid DC") );
- wxCHECK_RET( icon.Ok(), wxT("wxGCDC(cg)::DoDrawIcon - invalid icon") );
+ wxCHECK_RET( IsOk(), wxT("wxGCDC(cg)::DoDrawIcon - invalid DC") );
+ wxCHECK_RET( icon.IsOk(), wxT("wxGCDC(cg)::DoDrawIcon - invalid icon") );
wxCoord w = icon.GetWidth();
wxCoord h = icon.GetHeight();
m_graphicContext->DrawIcon( icon , x, y, w, h );
}
-bool wxGCDC::StartDoc( const wxString& WXUNUSED(message) )
+bool wxGCDCImpl::StartDoc( const wxString& WXUNUSED(message) )
{
return false;
}
-void wxGCDC::EndDoc()
+void wxGCDCImpl::EndDoc()
{
}
-void wxGCDC::StartPage()
+void wxGCDCImpl::StartPage()
{
}
-void wxGCDC::EndPage()
+void wxGCDCImpl::EndPage()
{
}
-void wxGCDC::Flush()
+void wxGCDCImpl::Flush()
{
#ifdef __WXMAC__
CGContextFlush( (CGContextRef) m_graphicContext->GetNativeContext() );
#endif
}
-void wxGCDC::DoSetClippingRegion( wxCoord x, wxCoord y, wxCoord w, wxCoord h )
+void wxGCDCImpl::DoSetClippingRegion( wxCoord x, wxCoord y, wxCoord w, wxCoord h )
{
- wxCHECK_RET( Ok(), wxT("wxGCDC(cg)::DoSetClippingRegion - invalid DC") );
+ wxCHECK_RET( IsOk(), wxT("wxGCDC(cg)::DoSetClippingRegion - invalid DC") );
m_graphicContext->Clip( x, y, w, h );
if ( m_clipping )
}
}
-void wxGCDC::DoSetClippingRegionAsRegion( const wxRegion ®ion )
+void wxGCDCImpl::DoSetClippingRegionAsRegion( const wxRegion ®ion )
{
// region is in device coordinates
- wxCHECK_RET( Ok(), wxT("wxGCDC(cg)::DoSetClippingRegionAsRegion - invalid DC") );
+ wxCHECK_RET( IsOk(), wxT("wxGCDC(cg)::DoSetClippingRegionAsRegion - invalid DC") );
if (region.Empty())
{
}
}
-void wxGCDC::DestroyClippingRegion()
+void wxGCDCImpl::DestroyClippingRegion()
{
m_graphicContext->ResetClip();
// currently the clip eg of a window extends to the area between the scrollbars
// so we must explicitely make sure it only covers the area we want it to draw
int width, height ;
- GetSize( &width , &height ) ;
+ GetOwner()->GetSize( &width , &height ) ;
m_graphicContext->Clip( DeviceToLogicalX(0) , DeviceToLogicalY(0) , DeviceToLogicalXRel(width), DeviceToLogicalYRel(height) );
m_graphicContext->SetPen( m_pen );
m_clipping = false;
}
-void wxGCDC::DoGetSizeMM( int* width, int* height ) const
+void wxGCDCImpl::DoGetSizeMM( int* width, int* height ) const
{
int w = 0, h = 0;
- GetSize( &w, &h );
+ GetOwner()->GetSize( &w, &h );
if (width)
*width = long( double(w) / (m_scaleX * m_mm_to_pix_x) );
if (height)
*height = long( double(h) / (m_scaleY * m_mm_to_pix_y) );
}
-void wxGCDC::SetTextForeground( const wxColour &col )
+void wxGCDCImpl::SetTextForeground( const wxColour &col )
{
- wxCHECK_RET( Ok(), wxT("wxGCDC(cg)::SetTextForeground - invalid DC") );
+ wxCHECK_RET( IsOk(), wxT("wxGCDC(cg)::SetTextForeground - invalid DC") );
if ( col != m_textForegroundColour )
{
}
}
-void wxGCDC::SetTextBackground( const wxColour &col )
+void wxGCDCImpl::SetTextBackground( const wxColour &col )
{
- wxCHECK_RET( Ok(), wxT("wxGCDC(cg)::SetTextBackground - invalid DC") );
+ wxCHECK_RET( IsOk(), wxT("wxGCDC(cg)::SetTextBackground - invalid DC") );
m_textBackgroundColour = col;
}
-void wxGCDC::SetMapMode( int mode )
+void wxGCDCImpl::SetMapMode( int mode )
{
switch (mode)
{
ComputeScaleAndOrigin();
}
-void wxGCDC::SetUserScale( double x, double y )
+void wxGCDCImpl::SetUserScale( double x, double y )
{
// allow negative ? -> no
ComputeScaleAndOrigin();
}
-void wxGCDC::SetLogicalScale( double x, double y )
+void wxGCDCImpl::SetLogicalScale( double x, double y )
{
// allow negative ?
m_logicalScaleX = x;
ComputeScaleAndOrigin();
}
-void wxGCDC::SetLogicalOrigin( wxCoord x, wxCoord y )
+void wxGCDCImpl::SetLogicalOrigin( wxCoord x, wxCoord y )
{
m_logicalOriginX = x * m_signX; // is this still correct ?
m_logicalOriginY = y * m_signY;
ComputeScaleAndOrigin();
}
-void wxGCDC::SetDeviceOrigin( wxCoord x, wxCoord y )
+void wxGCDCImpl::SetDeviceOrigin( wxCoord x, wxCoord y )
{
m_deviceOriginX = x;
m_deviceOriginY = y;
ComputeScaleAndOrigin();
}
-void wxGCDC::SetAxisOrientation( bool xLeftRight, bool yBottomUp )
+void wxGCDCImpl::SetAxisOrientation( bool xLeftRight, bool yBottomUp )
{
m_signX = (xLeftRight ? 1 : -1);
m_signY = (yBottomUp ? -1 : 1);
ComputeScaleAndOrigin();
}
-wxSize wxGCDC::GetPPI() const
+wxSize wxGCDCImpl::GetPPI() const
{
return wxSize(72, 72);
}
-int wxGCDC::GetDepth() const
+int wxGCDCImpl::GetDepth() const
{
return 32;
}
-void wxGCDC::ComputeScaleAndOrigin()
+void wxGCDCImpl::ComputeScaleAndOrigin()
{
m_scaleX = m_logicalScaleX * m_userScaleX;
m_scaleY = m_logicalScaleY * m_userScaleY;
}
}
-void wxGCDC::SetPalette( const wxPalette& WXUNUSED(palette) )
+void wxGCDCImpl::SetPalette( const wxPalette& WXUNUSED(palette) )
{
}
-void wxGCDC::SetBackgroundMode( int mode )
+void wxGCDCImpl::SetBackgroundMode( int mode )
{
m_backgroundMode = mode;
}
-void wxGCDC::SetFont( const wxFont &font )
+void wxGCDCImpl::SetFont( const wxFont &font )
{
m_font = font;
if ( m_graphicContext )
{
wxFont f = font;
- if ( f.Ok() )
+ if ( f.IsOk() )
f.SetPointSize( /*LogicalToDeviceYRel*/(font.GetPointSize()));
m_graphicContext->SetFont( f, m_textForegroundColour );
}
}
-void wxGCDC::SetPen( const wxPen &pen )
+void wxGCDCImpl::SetPen( const wxPen &pen )
{
if ( m_pen == pen )
return;
}
}
-void wxGCDC::SetBrush( const wxBrush &brush )
+void wxGCDCImpl::SetBrush( const wxBrush &brush )
{
if (m_brush == brush)
return;
}
}
-void wxGCDC::SetBackground( const wxBrush &brush )
+void wxGCDCImpl::SetBackground( const wxBrush &brush )
{
if (m_backgroundBrush == brush)
return;
m_backgroundBrush = brush;
- if (!m_backgroundBrush.Ok())
+ if (!m_backgroundBrush.IsOk())
return;
}
-void wxGCDC::SetLogicalFunction( int function )
+void wxGCDCImpl::SetLogicalFunction( int function )
{
if (m_logicalFunction == function)
return;
m_logicalFunctionSupported=false;
}
-bool wxGCDC::DoFloodFill(wxCoord WXUNUSED(x), wxCoord WXUNUSED(y),
+bool wxGCDCImpl::DoFloodFill(wxCoord WXUNUSED(x), wxCoord WXUNUSED(y),
const wxColour& WXUNUSED(col), int WXUNUSED(style))
{
return false;
}
-bool wxGCDC::DoGetPixel( wxCoord WXUNUSED(x), wxCoord WXUNUSED(y), wxColour *WXUNUSED(col) ) const
+bool wxGCDCImpl::DoGetPixel( wxCoord WXUNUSED(x), wxCoord WXUNUSED(y), wxColour *WXUNUSED(col) ) const
{
// wxCHECK_MSG( 0 , false, wxT("wxGCDC(cg)::DoGetPixel - not implemented") );
return false;
}
-void wxGCDC::DoDrawLine( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2 )
+void wxGCDCImpl::DoDrawLine( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2 )
{
- wxCHECK_RET( Ok(), wxT("wxGCDC(cg)::DoDrawLine - invalid DC") );
+ wxCHECK_RET( IsOk(), wxT("wxGCDC(cg)::DoDrawLine - invalid DC") );
if ( !m_logicalFunctionSupported )
return;
CalcBoundingBox(x2, y2);
}
-void wxGCDC::DoCrossHair( wxCoord x, wxCoord y )
+void wxGCDCImpl::DoCrossHair( wxCoord x, wxCoord y )
{
- wxCHECK_RET( Ok(), wxT("wxGCDC(cg)::DoCrossHair - invalid DC") );
+ wxCHECK_RET( IsOk(), wxT("wxGCDC(cg)::DoCrossHair - invalid DC") );
if ( !m_logicalFunctionSupported )
return;
int w = 0, h = 0;
- GetSize( &w, &h );
+ GetOwner()->GetSize( &w, &h );
m_graphicContext->StrokeLine(0,y,w,y);
m_graphicContext->StrokeLine(x,0,x,h);
CalcBoundingBox(0+w, 0+h);
}
-void wxGCDC::DoDrawArc( wxCoord x1, wxCoord y1,
+void wxGCDCImpl::DoDrawArc( wxCoord x1, wxCoord y1,
wxCoord x2, wxCoord y2,
wxCoord xc, wxCoord yc )
{
- wxCHECK_RET( Ok(), wxT("wxGCDC(cg)::DoDrawArc - invalid DC") );
+ wxCHECK_RET( IsOk(), wxT("wxGCDC(cg)::DoDrawArc - invalid DC") );
if ( !m_logicalFunctionSupported )
return;
m_graphicContext->DrawPath(path);
}
-void wxGCDC::DoDrawEllipticArc( wxCoord x, wxCoord y, wxCoord w, wxCoord h,
+void wxGCDCImpl::DoDrawEllipticArc( wxCoord x, wxCoord y, wxCoord w, wxCoord h,
double sa, double ea )
{
- wxCHECK_RET( Ok(), wxT("wxGCDC(cg)::DoDrawEllipticArc - invalid DC") );
+ wxCHECK_RET( IsOk(), wxT("wxGCDC(cg)::DoDrawEllipticArc - invalid DC") );
if ( !m_logicalFunctionSupported )
return;
m_graphicContext->PopState();
}
-void wxGCDC::DoDrawPoint( wxCoord x, wxCoord y )
+void wxGCDCImpl::DoDrawPoint( wxCoord x, wxCoord y )
{
- wxCHECK_RET( Ok(), wxT("wxGCDC(cg)::DoDrawPoint - invalid DC") );
+ wxCHECK_RET( IsOk(), wxT("wxGCDC(cg)::DoDrawPoint - invalid DC") );
DoDrawLine( x , y , x + 1 , y + 1 );
}
-void wxGCDC::DoDrawLines(int n, wxPoint points[],
+void wxGCDCImpl::DoDrawLines(int n, wxPoint points[],
wxCoord xoffset, wxCoord yoffset)
{
- wxCHECK_RET( Ok(), wxT("wxGCDC(cg)::DoDrawLines - invalid DC") );
+ wxCHECK_RET( IsOk(), wxT("wxGCDC(cg)::DoDrawLines - invalid DC") );
if ( !m_logicalFunctionSupported )
return;
}
#if wxUSE_SPLINES
-void wxGCDC::DoDrawSpline(const wxPointList *points)
+void wxGCDCImpl::DoDrawSpline(const wxPointList *points)
{
- wxCHECK_RET( Ok(), wxT("wxGCDC(cg)::DoDrawSpline - invalid DC") );
+ wxCHECK_RET( IsOk(), wxT("wxGCDC(cg)::DoDrawSpline - invalid DC") );
if ( !m_logicalFunctionSupported )
return;
}
#endif // wxUSE_SPLINES
-void wxGCDC::DoDrawPolygon( int n, wxPoint points[],
+void wxGCDCImpl::DoDrawPolygon( int n, wxPoint points[],
wxCoord xoffset, wxCoord yoffset,
int fillStyle )
{
- wxCHECK_RET( Ok(), wxT("wxGCDC(cg)::DoDrawPolygon - invalid DC") );
+ wxCHECK_RET( IsOk(), wxT("wxGCDC(cg)::DoDrawPolygon - invalid DC") );
if ( n <= 0 || (m_brush.GetStyle() == wxTRANSPARENT && m_pen.GetStyle() == wxTRANSPARENT ) )
return;
delete[] pointsD;
}
-void wxGCDC::DoDrawPolyPolygon(int n,
+void wxGCDCImpl::DoDrawPolyPolygon(int n,
int count[],
wxPoint points[],
wxCoord xoffset,
m_graphicContext->DrawPath( path , fillStyle);
}
-void wxGCDC::DoDrawRectangle(wxCoord x, wxCoord y, wxCoord w, wxCoord h)
+void wxGCDCImpl::DoDrawRectangle(wxCoord x, wxCoord y, wxCoord w, wxCoord h)
{
- wxCHECK_RET( Ok(), wxT("wxGCDC(cg)::DoDrawRectangle - invalid DC") );
+ wxCHECK_RET( IsOk(), wxT("wxGCDC(cg)::DoDrawRectangle - invalid DC") );
if ( !m_logicalFunctionSupported )
return;
m_graphicContext->DrawRectangle(x,y,w,h);
}
-void wxGCDC::DoDrawRoundedRectangle(wxCoord x, wxCoord y,
+void wxGCDCImpl::DoDrawRoundedRectangle(wxCoord x, wxCoord y,
wxCoord w, wxCoord h,
double radius)
{
- wxCHECK_RET( Ok(), wxT("wxGCDC(cg)::DoDrawRoundedRectangle - invalid DC") );
+ wxCHECK_RET( IsOk(), wxT("wxGCDC(cg)::DoDrawRoundedRectangle - invalid DC") );
if ( !m_logicalFunctionSupported )
return;
m_graphicContext->DrawRoundedRectangle( x,y,w,h,radius);
}
-void wxGCDC::DoDrawEllipse(wxCoord x, wxCoord y, wxCoord w, wxCoord h)
+void wxGCDCImpl::DoDrawEllipse(wxCoord x, wxCoord y, wxCoord w, wxCoord h)
{
- wxCHECK_RET( Ok(), wxT("wxGCDC(cg)::DoDrawEllipse - invalid DC") );
+ wxCHECK_RET( IsOk(), wxT("wxGCDC(cg)::DoDrawEllipse - invalid DC") );
if ( !m_logicalFunctionSupported )
return;
m_graphicContext->DrawEllipse(x,y,w,h);
}
-bool wxGCDC::CanDrawBitmap() const
+bool wxGCDCImpl::CanDrawBitmap() const
{
return true;
}
-bool wxGCDC::DoBlit(
+bool wxGCDCImpl::DoBlit(
wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
wxDC *source, wxCoord xsrc, wxCoord ysrc, int logical_func , bool useMask,
wxCoord xsrcMask, wxCoord ysrcMask )
xsrcMask,ysrcMask );
}
-bool wxGCDC::DoStretchBlit(
+bool wxGCDCImpl::DoStretchBlit(
wxCoord xdest, wxCoord ydest, wxCoord dstWidth, wxCoord dstHeight,
wxDC *source, wxCoord xsrc, wxCoord ysrc, wxCoord srcWidth, wxCoord srcHeight,
int logical_func , bool WXUNUSED(useMask),
wxCoord xsrcMask, wxCoord ysrcMask )
{
- wxCHECK_MSG( Ok(), false, wxT("wxGCDC(cg)::DoStretchBlit - invalid DC") );
- wxCHECK_MSG( source->Ok(), false, wxT("wxGCDC(cg)::DoStretchBlit - invalid source DC") );
+ wxCHECK_MSG( IsOk(), false, wxT("wxGCDC(cg)::DoStretchBlit - invalid DC") );
+ wxCHECK_MSG( source->IsOk(), false, wxT("wxGCDC(cg)::DoStretchBlit - invalid source DC") );
if ( logical_func == wxNO_OP )
return true;
wxBitmap blit = source->GetAsBitmap( &subrect );
- if ( blit.Ok() )
+ if ( blit.IsOk() )
{
m_graphicContext->DrawBitmap( blit, xdest, ydest,
dstWidth, dstHeight);
return true;
}
-void wxGCDC::DoDrawRotatedText(const wxString& str, wxCoord x, wxCoord y,
+void wxGCDCImpl::DoDrawRotatedText(const wxString& str, wxCoord x, wxCoord y,
double angle)
{
- wxCHECK_RET( Ok(), wxT("wxGCDC(cg)::DoDrawRotatedText - invalid DC") );
+ wxCHECK_RET( IsOk(), wxT("wxGCDC(cg)::DoDrawRotatedText - invalid DC") );
if ( str.length() == 0 )
return;
m_graphicContext->DrawText( str, x ,y , DegToRad(angle ), m_graphicContext->CreateBrush( wxBrush(m_textBackgroundColour,wxSOLID) ) );
}
-void wxGCDC::DoDrawText(const wxString& str, wxCoord x, wxCoord y)
+void wxGCDCImpl::DoDrawText(const wxString& str, wxCoord x, wxCoord y)
{
- wxCHECK_RET( Ok(), wxT("wxGCDC(cg)::DoDrawRotatedText - invalid DC") );
+ wxCHECK_RET( IsOk(), wxT("wxGCDC(cg)::DoDrawRotatedText - invalid DC") );
if ( str.length() == 0 )
return;
m_graphicContext->DrawText( str, x ,y , m_graphicContext->CreateBrush( wxBrush(m_textBackgroundColour,wxSOLID) ) );
}
-bool wxGCDC::CanGetTextExtent() const
+bool wxGCDCImpl::CanGetTextExtent() const
{
- wxCHECK_MSG( Ok(), false, wxT("wxGCDC(cg)::CanGetTextExtent - invalid DC") );
+ wxCHECK_MSG( IsOk(), false, wxT("wxGCDC(cg)::CanGetTextExtent - invalid DC") );
return true;
}
-void wxGCDC::DoGetTextExtent( const wxString &str, wxCoord *width, wxCoord *height,
+void wxGCDCImpl::DoGetTextExtent( const wxString &str, wxCoord *width, wxCoord *height,
wxCoord *descent, wxCoord *externalLeading ,
const wxFont *theFont ) const
{
- wxCHECK_RET( Ok(), wxT("wxGCDC(cg)::DoGetTextExtent - invalid DC") );
+ wxCHECK_RET( IsOk(), wxT("wxGCDC(cg)::DoGetTextExtent - invalid DC") );
if ( theFont )
{
}
}
-bool wxGCDC::DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths) const
+bool wxGCDCImpl::DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths) const
{
- wxCHECK_MSG( Ok(), false, wxT("wxGCDC(cg)::DoGetPartialTextExtents - invalid DC") );
+ wxCHECK_MSG( IsOk(), false, wxT("wxGCDC(cg)::DoGetPartialTextExtents - invalid DC") );
widths.Clear();
widths.Add(0,text.Length());
if ( text.IsEmpty() )
return true;
}
-wxCoord wxGCDC::GetCharWidth(void) const
+wxCoord wxGCDCImpl::GetCharWidth(void) const
{
wxCoord width;
DoGetTextExtent( wxT("g") , &width , NULL , NULL , NULL , NULL );
return width;
}
-wxCoord wxGCDC::GetCharHeight(void) const
+wxCoord wxGCDCImpl::GetCharHeight(void) const
{
wxCoord height;
DoGetTextExtent( wxT("g") , NULL , &height , NULL , NULL , NULL );
return height;
}
-void wxGCDC::Clear(void)
+void wxGCDCImpl::Clear(void)
{
- wxCHECK_RET( Ok(), wxT("wxGCDC(cg)::Clear - invalid DC") );
+ wxCHECK_RET( IsOk(), wxT("wxGCDC(cg)::Clear - invalid DC") );
// TODO better implementation / incorporate size info into wxGCDC or context
m_graphicContext->SetBrush( m_backgroundBrush );
wxPen p = *wxTRANSPARENT_PEN;
m_graphicContext->SetBrush( m_brush );
}
-void wxGCDC::DoGetSize(int *width, int *height) const
+void wxGCDCImpl::DoGetSize(int *width, int *height) const
{
*width = 10000;
*height = 10000;
}
-void wxGCDC::DoGradientFillLinear(const wxRect& rect,
+void wxGCDCImpl::DoGradientFillLinear(const wxRect& rect,
const wxColour& initialColour,
const wxColour& destColour,
wxDirection nDirection )
m_graphicContext->SetPen(m_pen);
}
-void wxGCDC::DoGradientFillConcentric(const wxRect& rect,
+void wxGCDCImpl::DoGradientFillConcentric(const wxRect& rect,
const wxColour& initialColour,
const wxColour& destColour,
const wxPoint& circleCenter)
m_graphicContext->SetPen(m_pen);
}
-void wxGCDC::DoDrawCheckMark(wxCoord x, wxCoord y,
+void wxGCDCImpl::DoDrawCheckMark(wxCoord x, wxCoord y,
wxCoord width, wxCoord height)
{
- wxDCBase::DoDrawCheckMark(x,y,width,height);
+ wxDCImpl::DoDrawCheckMark(x,y,width,height);
}
#endif // wxUSE_GRAPHICS_CONTEXT
// wxSVGFileDC
// ----------------------------------------------------------
-IMPLEMENT_ABSTRACT_CLASS(wxSVGFileImplDC, wxDC)
+IMPLEMENT_ABSTRACT_CLASS(wxSVGFileDCImpl, wxDC)
#if wxUSE_NEW_DC
- wxSVGFileImplDC::wxSVGFileImplDC( wxSVGFileDC *owner, const wxString &filename,
+ wxSVGFileDCImpl::wxSVGFileDCImpl( wxSVGFileDC *owner, const wxString &filename,
int width, int height, double dpi ) :
- wxImplDC( owner )
+ wxDCImpl( owner )
{
Init( filename, width, height, dpi );
}
}
#endif
-void wxSVGFileImplDC::Init (const wxString &filename, int Width, int Height, double dpi)
+void wxSVGFileDCImpl::Init (const wxString &filename, int Width, int Height, double dpi)
{
m_width = Width ;
m_height = Height ;
-wxSVGFileImplDC::~wxSVGFileImplDC()
+wxSVGFileDCImpl::~wxSVGFileDCImpl()
{
wxString s = wxT("</g> \n</svg> \n") ;
write(s);
delete m_outfile ;
}
-void wxSVGFileImplDC::DoGetSizeMM( int *width, int *height ) const
+void wxSVGFileDCImpl::DoGetSizeMM( int *width, int *height ) const
{
if (width)
*width = wxRound( (double)m_width / m_mm_to_pix_x );
*height = wxRound( (double)m_height / m_mm_to_pix_y );
}
-wxSize wxSVGFileImplDC::GetPPI() const
+wxSize wxSVGFileDCImpl::GetPPI() const
{
return wxSize( wxRound(m_dpi), wxRound(m_dpi) );
}
-void wxSVGFileImplDC::DoDrawLine (wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2)
+void wxSVGFileDCImpl::DoDrawLine (wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2)
{
if (m_graphics_changed) NewGraphics ();
wxString s ;
return;
}
-void wxSVGFileImplDC::DoDrawLines(int n, wxPoint points[], wxCoord xoffset , wxCoord yoffset )
+void wxSVGFileDCImpl::DoDrawLines(int n, wxPoint points[], wxCoord xoffset , wxCoord yoffset )
{
for ( int i = 1; i < n ; i++ )
{
}
-void wxSVGFileImplDC::DoDrawPoint (wxCoord x1, wxCoord y1)
+void wxSVGFileDCImpl::DoDrawPoint (wxCoord x1, wxCoord y1)
{
wxString s;
if (m_graphics_changed) NewGraphics ();
}
-void wxSVGFileImplDC::DoDrawCheckMark(wxCoord x1, wxCoord y1, wxCoord width, wxCoord height)
+void wxSVGFileDCImpl::DoDrawCheckMark(wxCoord x1, wxCoord y1, wxCoord width, wxCoord height)
{
#if wxUSE_NEW_DC
- wxImplDC::DoDrawCheckMark (x1,y1,width,height) ;
+ wxDCImpl::DoDrawCheckMark (x1,y1,width,height) ;
#else
wxDCBase::DoDrawCheckMark (x1,y1,width,height) ;
#endif
}
-void wxSVGFileImplDC::DoDrawText(const wxString& text, wxCoord x1, wxCoord y1)
+void wxSVGFileDCImpl::DoDrawText(const wxString& text, wxCoord x1, wxCoord y1)
{
DoDrawRotatedText(text, x1,y1,0.0);
wxASSERT_MSG(!wxSVG_DEBUG, wxT("wxSVGFileDC::DrawText Call executed")) ;
}
-void wxSVGFileImplDC::DoDrawRotatedText(const wxString& sText, wxCoord x, wxCoord y, double angle)
+void wxSVGFileDCImpl::DoDrawRotatedText(const wxString& sText, wxCoord x, wxCoord y, double angle)
{
//known bug; if the font is drawn in a scaled DC, it will not behave exactly as wxMSW
if (m_graphics_changed) NewGraphics ();
}
-void wxSVGFileImplDC::DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
+void wxSVGFileDCImpl::DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
{
DoDrawRoundedRectangle(x, y, width, height, 0) ;
}
-void wxSVGFileImplDC::DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius )
+void wxSVGFileDCImpl::DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius )
{
if (m_graphics_changed) NewGraphics ();
}
-void wxSVGFileImplDC::DoDrawPolygon(int n, wxPoint points[], wxCoord xoffset, wxCoord yoffset,int fillStyle)
+void wxSVGFileDCImpl::DoDrawPolygon(int n, wxPoint points[], wxCoord xoffset, wxCoord yoffset,int fillStyle)
{
if (m_graphics_changed) NewGraphics ();
wxString s, sTmp ;
}
-void wxSVGFileImplDC::DoDrawEllipse (wxCoord x, wxCoord y, wxCoord width, wxCoord height)
+void wxSVGFileDCImpl::DoDrawEllipse (wxCoord x, wxCoord y, wxCoord width, wxCoord height)
{
if (m_graphics_changed) NewGraphics ();
}
-void wxSVGFileImplDC::DoDrawArc(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2, wxCoord xc, wxCoord yc)
+void wxSVGFileDCImpl::DoDrawArc(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2, wxCoord xc, wxCoord yc)
{
/* Draws an arc of a circle, centred on (xc, yc), with starting point
(x1, y1) and ending at (x2, y2). The current pen is used for the outline
}
-void wxSVGFileImplDC::DoDrawEllipticArc(wxCoord x,wxCoord y,wxCoord w,wxCoord h,double sa,double ea)
+void wxSVGFileDCImpl::DoDrawEllipticArc(wxCoord x,wxCoord y,wxCoord w,wxCoord h,double sa,double ea)
{
/*
Draws an arc of an ellipse. The current pen is used for drawing the arc
}
-void wxSVGFileImplDC::DoGetTextExtent(const wxString& string, wxCoord *w, wxCoord *h, wxCoord *descent , wxCoord *externalLeading , const wxFont *font) const
+void wxSVGFileDCImpl::DoGetTextExtent(const wxString& string, wxCoord *w, wxCoord *h, wxCoord *descent , wxCoord *externalLeading , const wxFont *font) const
{
wxScreenDC sDC ;
}
-wxCoord wxSVGFileImplDC::GetCharHeight() const
+wxCoord wxSVGFileDCImpl::GetCharHeight() const
{
wxScreenDC sDC ;
}
-wxCoord wxSVGFileImplDC::GetCharWidth() const
+wxCoord wxSVGFileDCImpl::GetCharWidth() const
{
wxScreenDC sDC ;
sDC.SetFont (m_font);
/// Set Functions /////////////////////////////////////////////////////////////////
-void wxSVGFileImplDC::SetBackground( const wxBrush &brush )
+void wxSVGFileDCImpl::SetBackground( const wxBrush &brush )
{
m_backgroundBrush = brush;
}
-void wxSVGFileImplDC::SetBackgroundMode( int mode )
+void wxSVGFileDCImpl::SetBackgroundMode( int mode )
{
m_backgroundMode = mode;
return;
}
-void wxSVGFileImplDC::SetBrush(const wxBrush& brush)
+void wxSVGFileDCImpl::SetBrush(const wxBrush& brush)
{
m_brush = brush ;
}
-void wxSVGFileImplDC::SetPen(const wxPen& pen)
+void wxSVGFileDCImpl::SetPen(const wxPen& pen)
{
// width, color, ends, joins : currently implemented
// dashes, stipple : not implemented
wxASSERT_MSG(!wxSVG_DEBUG, wxT("wxSVGFileDC::SetPen Call executed")) ;
}
-void wxSVGFileImplDC::NewGraphics ()
+void wxSVGFileDCImpl::NewGraphics ()
{
int w = m_pen.GetWidth ();
}
-void wxSVGFileImplDC::SetFont(const wxFont& font)
+void wxSVGFileDCImpl::SetFont(const wxFont& font)
{
m_font = font ;
// export a bitmap as a raster image in png
-bool wxSVGFileImplDC::DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
+bool wxSVGFileDCImpl::DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
wxDC* source, wxCoord xsrc, wxCoord ysrc,
int logicalFunc /*= wxCOPY*/, bool useMask /*= FALSE*/,
wxCoord /*xsrcMask = -1*/, wxCoord /*ysrcMask = -1*/)
return FALSE ;
}
-void wxSVGFileImplDC::DoDrawIcon(const class wxIcon & myIcon, wxCoord x, wxCoord y)
+void wxSVGFileDCImpl::DoDrawIcon(const class wxIcon & myIcon, wxCoord x, wxCoord y)
{
wxBitmap myBitmap (myIcon.GetWidth(), myIcon.GetHeight() ) ;
wxMemoryDC memDC;
return ;
}
-void wxSVGFileImplDC::DoDrawBitmap(const class wxBitmap & bmp, wxCoord x, wxCoord y , bool WXUNUSED(bTransparent) /*=0*/ )
+void wxSVGFileDCImpl::DoDrawBitmap(const class wxBitmap & bmp, wxCoord x, wxCoord y , bool WXUNUSED(bTransparent) /*=0*/ )
{
if (m_graphics_changed) NewGraphics ();
return ;
}
-void wxSVGFileImplDC::write(const wxString &s)
+void wxSVGFileDCImpl::write(const wxString &s)
{
const wxCharBuffer buf = s.utf8_str();
m_outfile->Write(buf, strlen((const char *)buf));
#if wxUSE_NEW_DC
#else
-void wxSVGFileImplDC::SetAxisOrientation( bool xLeftRight, bool yBottomUp )
+void wxSVGFileDCImpl::SetAxisOrientation( bool xLeftRight, bool yBottomUp )
{
wxDCBase::SetAxisOrientation( xLeftRight, yBottomUp );
}
-void wxSVGFileImplDC::SetMapMode(int mode)
+void wxSVGFileDCImpl::SetMapMode(int mode)
{
wxDCBase::SetMapMode(mode);
}
-void wxSVGFileImplDC::SetUserScale(double x, double y)
+void wxSVGFileDCImpl::SetUserScale(double x, double y)
{
wxDCBase::SetUserScale(x,y);
}
-void wxSVGFileImplDC::SetLogicalScale(double x, double y)
+void wxSVGFileDCImpl::SetLogicalScale(double x, double y)
{
wxDCBase::SetLogicalScale(x,y);
}
-void wxSVGFileImplDC::SetLogicalOrigin(wxCoord x, wxCoord y)
+void wxSVGFileDCImpl::SetLogicalOrigin(wxCoord x, wxCoord y)
{
wxDCBase::SetLogicalOrigin(x,y);
}
-void wxSVGFileImplDC::SetDeviceOrigin(wxCoord x, wxCoord y)
+void wxSVGFileDCImpl::SetDeviceOrigin(wxCoord x, wxCoord y)
{
wxDCBase::SetDeviceOrigin(x,y);
}
{
return wxGraphicsRenderer::GetDefaultRenderer()->CreateContext(dc);
}
-#ifdef __WXMSW__
+
wxGraphicsContext* wxGraphicsContext::Create( const wxMemoryDC& dc)
{
return wxGraphicsRenderer::GetDefaultRenderer()->CreateContext(dc);
}
-#endif
wxGraphicsContext* wxGraphicsContext::CreateFromNative( void * context )
{
void wxOverlayImpl::Init( wxWindowDC* dc, int x , int y , int width , int height )
{
-#if defined(__WXGTK20__)
-#if wxUSE_NEW_DC
- wxImplDC *impl = dc->GetImpl();
- wxGTKWindowImplDC *gtk_impl = wxDynamicCast( impl, wxGTKWindowImplDC );
- if (gtk_impl)
- m_window = gtk_impl->m_owningWindow;
-#else
- m_window = dc->m_owningWindow;
-#endif
-#elif defined(__WXGTK__)
- m_window = dc->m_owner;
-#elif defined(__WXMSW__)
m_window = dc->GetWindow();
-#endif
wxMemoryDC dcMem ;
m_bmpSaved.Create( width, height );
dcMem.SelectObject( m_bmpSaved );
#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__)
#include "wx/msw/printdlg.h"
+#include "wx/msw/dcprint.h"
#elif defined(__WXMAC__)
#include "wx/mac/printdlg.h"
#include "wx/mac/private/print.h"
+#include "wx/mac/dcprint.h"
#else
#include "wx/generic/prntdlgg.h"
#include "wx/dcps.h"
#endif
}
-#if wxUSE_NEW_DC
-
-wxImplDC* wxNativePrintFactory::CreatePrinterImplDC( wxPrinterDC *owner, const wxPrintData& data )
-{
-#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__)
- return new wxWindowsPrinterDCImpl( owner, data );
-#elif defined(__WXMAC__)
- return new wxMacPrinterDCImpl( owner, data );
-#else
- return new wxPostScriptImplDC( owner, data );
-#endif
-}
-
-#else
-
-wxDC* wxNativePrintFactory::CreatePrinterDC( const wxPrintData& data )
+wxDCImpl* wxNativePrintFactory::CreatePrinterDCImpl( wxPrinterDC *owner, const wxPrintData& data )
{
-#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__)
- return new wxPrinterDC(data);
-#elif defined(__WXMAC__)
- return new wxPrinterDC(data);
+#if defined(__WXGTK__) || defined(__WXUNIVERSAL__)
+ return new wxPostScriptDCImpl( owner, data );
#else
- return new wxPostScriptDC(data);
+ return new wxPrinterDCImpl( owner, data );
#endif
}
-#endif
-
bool wxNativePrintFactory::HasOwnPrintToFile()
{
// Only relevant for PostScript and here the
void wxDataViewMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
{
wxDataViewModel *model = GetOwner()->GetModel();
- wxAutoBufferedPaintDC dc( this );
+ //wxAutoBufferedPaintDC dc( this );
+ wxPaintDC dc(this);
// prepare the DC
dc.SetBackground(GetBackgroundColour());
wxPostScriptDC::wxPostScriptDC()
{
- m_pimpl = new wxPostScriptImplDC( this );
+ m_pimpl = new wxPostScriptDCImpl( this );
}
wxPostScriptDC::wxPostScriptDC(const wxPrintData& printData)
{
- m_pimpl = new wxPostScriptImplDC( this, printData );
+ m_pimpl = new wxPostScriptDCImpl( this, printData );
}
#endif
#if wxUSE_NEW_DC
-IMPLEMENT_ABSTRACT_CLASS(wxPostScriptImplDC, wxImplDC)
+IMPLEMENT_ABSTRACT_CLASS(wxPostScriptDCImpl, wxDCImpl)
#else
IMPLEMENT_ABSTRACT_CLASS(wxPostScriptDC, wxDC)
#endif
//-------------------------------------------------------------------------------
#if wxUSE_NEW_DC
-wxPostScriptImplDC::wxPostScriptImplDC( wxPostScriptDC *owner ) :
- wxImplDC( owner )
+wxPostScriptDCImpl::wxPostScriptDCImpl( wxPostScriptDC *owner ) :
+ wxDCImpl( owner )
{
Init();
m_ok = true;
}
-wxPostScriptImplDC::wxPostScriptImplDC( wxPostScriptDC *owner, const wxPrintData& data ) :
- wxImplDC( owner )
+wxPostScriptDCImpl::wxPostScriptDCImpl( wxPostScriptDC *owner, const wxPrintData& data ) :
+ wxDCImpl( owner )
{
Init();
#if wxUSE_NEW_DC
-wxPostScriptImplDC::wxPostScriptImplDC( wxPrinterDC *owner ) :
- wxImplDC( owner )
+wxPostScriptDCImpl::wxPostScriptDCImpl( wxPrinterDC *owner ) :
+ wxDCImpl( owner )
#else
wxPostScriptDC::wxPostScriptDC()
#endif
}
#if wxUSE_NEW_DC
-wxPostScriptImplDC::wxPostScriptImplDC( wxPrinterDC *owner, const wxPrintData& data ) :
- wxImplDC( owner )
+wxPostScriptDCImpl::wxPostScriptDCImpl( wxPrinterDC *owner, const wxPrintData& data ) :
+ wxDCImpl( owner )
#else
wxPostScriptDC::wxPostScriptDC( const wxPrintData& data )
#endif
m_ok = true;
}
-void wxPostScriptImplDC::Init()
+void wxPostScriptDCImpl::Init()
{
m_pstream = (FILE*) NULL;
}
-wxPostScriptImplDC::~wxPostScriptImplDC ()
+wxPostScriptDCImpl::~wxPostScriptDCImpl ()
{
if (m_pstream)
{
}
}
-bool wxPostScriptImplDC::IsOk() const
+bool wxPostScriptDCImpl::IsOk() const
{
return m_ok;
}
-wxRect wxPostScriptImplDC::GetPaperRect()
+wxRect wxPostScriptDCImpl::GetPaperRect()
{
int w = 0;
int h = 0;
return wxRect(0,0,w,h);
}
-int wxPostScriptImplDC::GetResolution()
+int wxPostScriptDCImpl::GetResolution()
{
return DPI;
}
-void wxPostScriptImplDC::DoSetClippingRegion (wxCoord x, wxCoord y, wxCoord w, wxCoord h)
+void wxPostScriptDCImpl::DoSetClippingRegion (wxCoord x, wxCoord y, wxCoord w, wxCoord h)
{
wxCHECK_RET( m_ok , wxT("invalid postscript dc") );
}
-void wxPostScriptImplDC::DestroyClippingRegion()
+void wxPostScriptDCImpl::DestroyClippingRegion()
{
wxCHECK_RET( m_ok , wxT("invalid postscript dc") );
}
#if wxUSE_NEW_DC
- wxImplDC::DestroyClippingRegion();
+ wxDCImpl::DestroyClippingRegion();
#else
wxDC::DestroyClippingRegion();
#endif
}
-void wxPostScriptImplDC::Clear()
+void wxPostScriptDCImpl::Clear()
{
// This should fail silently to avoid unnecessary
// asserts
- // wxFAIL_MSG( wxT("wxPostScriptImplDC::Clear not implemented.") );
+ // wxFAIL_MSG( wxT("wxPostScriptDCImpl::Clear not implemented.") );
}
-bool wxPostScriptImplDC::DoFloodFill (wxCoord WXUNUSED(x), wxCoord WXUNUSED(y), const wxColour &WXUNUSED(col), int WXUNUSED(style))
+bool wxPostScriptDCImpl::DoFloodFill (wxCoord WXUNUSED(x), wxCoord WXUNUSED(y), const wxColour &WXUNUSED(col), int WXUNUSED(style))
{
- wxFAIL_MSG( wxT("wxPostScriptImplDC::FloodFill not implemented.") );
+ wxFAIL_MSG( wxT("wxPostScriptDCImpl::FloodFill not implemented.") );
return false;
}
-bool wxPostScriptImplDC::DoGetPixel (wxCoord WXUNUSED(x), wxCoord WXUNUSED(y), wxColour * WXUNUSED(col)) const
+bool wxPostScriptDCImpl::DoGetPixel (wxCoord WXUNUSED(x), wxCoord WXUNUSED(y), wxColour * WXUNUSED(col)) const
{
- wxFAIL_MSG( wxT("wxPostScriptImplDC::GetPixel not implemented.") );
+ wxFAIL_MSG( wxT("wxPostScriptDCImpl::GetPixel not implemented.") );
return false;
}
-void wxPostScriptImplDC::DoCrossHair (wxCoord WXUNUSED(x), wxCoord WXUNUSED(y))
+void wxPostScriptDCImpl::DoCrossHair (wxCoord WXUNUSED(x), wxCoord WXUNUSED(y))
{
- wxFAIL_MSG( wxT("wxPostScriptImplDC::CrossHair not implemented.") );
+ wxFAIL_MSG( wxT("wxPostScriptDCImpl::CrossHair not implemented.") );
}
-void wxPostScriptImplDC::DoDrawLine (wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2)
+void wxPostScriptDCImpl::DoDrawLine (wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2)
{
wxCHECK_RET( m_ok, wxT("invalid postscript dc") );
CalcBoundingBox( x2, y2 );
}
-void wxPostScriptImplDC::DoDrawArc (wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2, wxCoord xc, wxCoord yc)
+void wxPostScriptDCImpl::DoDrawArc (wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2, wxCoord xc, wxCoord yc)
{
wxCHECK_RET( m_ok, wxT("invalid postscript dc") );
}
}
-void wxPostScriptImplDC::DoDrawEllipticArc(wxCoord x,wxCoord y,wxCoord w,wxCoord h,double sa,double ea)
+void wxPostScriptDCImpl::DoDrawEllipticArc(wxCoord x,wxCoord y,wxCoord w,wxCoord h,double sa,double ea)
{
wxCHECK_RET( m_ok, wxT("invalid postscript dc") );
}
}
-void wxPostScriptImplDC::DoDrawPoint (wxCoord x, wxCoord y)
+void wxPostScriptDCImpl::DoDrawPoint (wxCoord x, wxCoord y)
{
wxCHECK_RET( m_ok, wxT("invalid postscript dc") );
CalcBoundingBox( x, y );
}
-void wxPostScriptImplDC::DoDrawPolygon (int n, wxPoint points[], wxCoord xoffset, wxCoord yoffset, int fillStyle)
+void wxPostScriptDCImpl::DoDrawPolygon (int n, wxPoint points[], wxCoord xoffset, wxCoord yoffset, int fillStyle)
{
wxCHECK_RET( m_ok, wxT("invalid postscript dc") );
}
}
-void wxPostScriptImplDC::DoDrawPolyPolygon (int n, int count[], wxPoint points[], wxCoord xoffset, wxCoord yoffset, int fillStyle)
+void wxPostScriptDCImpl::DoDrawPolyPolygon (int n, int count[], wxPoint points[], wxCoord xoffset, wxCoord yoffset, int fillStyle)
{
wxCHECK_RET( m_ok, wxT("invalid postscript dc") );
}
}
-void wxPostScriptImplDC::DoDrawLines (int n, wxPoint points[], wxCoord xoffset, wxCoord yoffset)
+void wxPostScriptDCImpl::DoDrawLines (int n, wxPoint points[], wxCoord xoffset, wxCoord yoffset)
{
wxCHECK_RET( m_ok, wxT("invalid postscript dc") );
PsPrint( "stroke\n" );
}
-void wxPostScriptImplDC::DoDrawRectangle (wxCoord x, wxCoord y, wxCoord width, wxCoord height)
+void wxPostScriptDCImpl::DoDrawRectangle (wxCoord x, wxCoord y, wxCoord width, wxCoord height)
{
wxCHECK_RET( m_ok, wxT("invalid postscript dc") );
}
}
-void wxPostScriptImplDC::DoDrawRoundedRectangle (wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius)
+void wxPostScriptDCImpl::DoDrawRoundedRectangle (wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius)
{
wxCHECK_RET( m_ok, wxT("invalid postscript dc") );
}
}
-void wxPostScriptImplDC::DoDrawEllipse (wxCoord x, wxCoord y, wxCoord width, wxCoord height)
+void wxPostScriptDCImpl::DoDrawEllipse (wxCoord x, wxCoord y, wxCoord width, wxCoord height)
{
wxCHECK_RET( m_ok, wxT("invalid postscript dc") );
}
}
-void wxPostScriptImplDC::DoDrawIcon( const wxIcon& icon, wxCoord x, wxCoord y )
+void wxPostScriptDCImpl::DoDrawIcon( const wxIcon& icon, wxCoord x, wxCoord y )
{
DoDrawBitmap( icon, x, y, true );
}
/* this has to be char, not wxChar */
static char hexArray[] = "0123456789ABCDEF";
-void wxPostScriptImplDC::DoDrawBitmap( const wxBitmap& bitmap, wxCoord x, wxCoord y, bool WXUNUSED(useMask) )
+void wxPostScriptDCImpl::DoDrawBitmap( const wxBitmap& bitmap, wxCoord x, wxCoord y, bool WXUNUSED(useMask) )
{
wxCHECK_RET( m_ok, wxT("invalid postscript dc") );
PsPrint( "origstate restore\n" );
}
-void wxPostScriptImplDC::SetFont( const wxFont& font )
+void wxPostScriptDCImpl::SetFont( const wxFont& font )
{
wxCHECK_RET( m_ok, wxT("invalid postscript dc") );
PsPrint( buffer );
}
-void wxPostScriptImplDC::SetPen( const wxPen& pen )
+void wxPostScriptDCImpl::SetPen( const wxPen& pen )
{
wxCHECK_RET( m_ok, wxT("invalid postscript dc") );
}
}
-void wxPostScriptImplDC::SetBrush( const wxBrush& brush )
+void wxPostScriptDCImpl::SetBrush( const wxBrush& brush )
{
wxCHECK_RET( m_ok, wxT("invalid postscript dc") );
}
}
-void wxPostScriptImplDC::DoDrawText( const wxString& text, wxCoord x, wxCoord y )
+void wxPostScriptDCImpl::DoDrawText( const wxString& text, wxCoord x, wxCoord y )
{
wxCHECK_RET( m_ok, wxT("invalid postscript dc") );
CalcBoundingBox( x + size * text.length() * 2/3 , y );
}
-void wxPostScriptImplDC::DoDrawRotatedText( const wxString& text, wxCoord x, wxCoord y, double angle )
+void wxPostScriptDCImpl::DoDrawRotatedText( const wxString& text, wxCoord x, wxCoord y, double angle )
{
if ( wxIsNullDouble(angle) )
{
CalcBoundingBox( x + size * text.length() * 2/3 , y );
}
-void wxPostScriptImplDC::SetBackground (const wxBrush& brush)
+void wxPostScriptDCImpl::SetBackground (const wxBrush& brush)
{
m_backgroundBrush = brush;
}
-void wxPostScriptImplDC::SetLogicalFunction (int WXUNUSED(function))
+void wxPostScriptDCImpl::SetLogicalFunction (int WXUNUSED(function))
{
- wxFAIL_MSG( wxT("wxPostScriptImplDC::SetLogicalFunction not implemented.") );
+ wxFAIL_MSG( wxT("wxPostScriptDCImpl::SetLogicalFunction not implemented.") );
}
#if wxUSE_SPLINES
-void wxPostScriptImplDC::DoDrawSpline( const wxPointList *points )
+void wxPostScriptDCImpl::DoDrawSpline( const wxPointList *points )
{
wxCHECK_RET( m_ok, wxT("invalid postscript dc") );
}
#endif // wxUSE_SPLINES
-wxCoord wxPostScriptImplDC::GetCharWidth() const
+wxCoord wxPostScriptDCImpl::GetCharWidth() const
{
// Chris Breeze: reasonable approximation using wxMODERN/Courier
return (wxCoord) (GetCharHeight() * 72.0 / 120.0);
}
-void wxPostScriptImplDC::SetPrintData(const wxPrintData& data)
+void wxPostScriptDCImpl::SetPrintData(const wxPrintData& data)
{
m_printData = data;
#if wxUSE_NEW_DC
#else
-void wxPostScriptImplDC::SetAxisOrientation( bool xLeftRight, bool yBottomUp )
+void wxPostScriptDCImpl::SetAxisOrientation( bool xLeftRight, bool yBottomUp )
{
wxDCBase::SetAxisOrientation(xLeftRight,yBottomUp);
}
-void wxPostScriptImplDC::SetMapMode(int mode)
+void wxPostScriptDCImpl::SetMapMode(int mode)
{
wxDCBase::SetMapMode(mode);
}
-void wxPostScriptImplDC::SetUserScale(double x, double y)
+void wxPostScriptDCImpl::SetUserScale(double x, double y)
{
wxDCBase::SetUserScale(x,y);
}
-void wxPostScriptImplDC::SetLogicalScale(double x, double y)
+void wxPostScriptDCImpl::SetLogicalScale(double x, double y)
{
wxDCBase::SetLogicalScale(x,y);
}
-void wxPostScriptImplDC::SetLogicalOrigin(wxCoord x, wxCoord y)
+void wxPostScriptDCImpl::SetLogicalOrigin(wxCoord x, wxCoord y)
{
wxDCBase::SetLogicalOrigin(x,y);
}
-void wxPostScriptImplDC::SetDeviceOrigin(wxCoord x, wxCoord y)
+void wxPostScriptDCImpl::SetDeviceOrigin(wxCoord x, wxCoord y)
{
wxDCBase::SetDeviceOrigin(x,y);
}
#endif
-void wxPostScriptImplDC::ComputeScaleAndOrigin()
+void wxPostScriptDCImpl::ComputeScaleAndOrigin()
{
const wxRealPoint origScale(m_scaleX, m_scaleY);
#if wxUSE_NEW_DC
- wxImplDC::ComputeScaleAndOrigin();
+ wxDCImpl::ComputeScaleAndOrigin();
#else
wxDC::ComputeScaleAndOrigin();
#endif
}
}
-void wxPostScriptImplDC::DoGetSize(int* width, int* height) const
+void wxPostScriptDCImpl::DoGetSize(int* width, int* height) const
{
wxPaperSize id = m_printData.GetPaperId();
*height = wxRound( h * PS2DEV );
}
-void wxPostScriptImplDC::DoGetSizeMM(int *width, int *height) const
+void wxPostScriptDCImpl::DoGetSizeMM(int *width, int *height) const
{
wxPaperSize id = m_printData.GetPaperId();
}
// Resolution in pixels per logical inch
-wxSize wxPostScriptImplDC::GetPPI(void) const
+wxSize wxPostScriptDCImpl::GetPPI(void) const
{
return wxSize( DPI, DPI );
}
-bool wxPostScriptImplDC::StartDoc( const wxString& message )
+bool wxPostScriptDCImpl::StartDoc( const wxString& message )
{
wxCHECK_MSG( m_ok, false, wxT("invalid postscript dc") );
return true;
}
-void wxPostScriptImplDC::EndDoc ()
+void wxPostScriptDCImpl::EndDoc ()
{
wxCHECK_RET( m_ok, wxT("invalid postscript dc") );
#endif
}
-void wxPostScriptImplDC::StartPage()
+void wxPostScriptDCImpl::StartPage()
{
wxCHECK_RET( m_ok, wxT("invalid postscript dc") );
PsPrint( "90 rotate\n" );
}
-void wxPostScriptImplDC::EndPage ()
+void wxPostScriptDCImpl::EndPage ()
{
wxCHECK_RET( m_ok , wxT("invalid postscript dc") );
PsPrint( "showpage\n" );
}
-bool wxPostScriptImplDC::DoBlit( wxCoord xdest, wxCoord ydest,
+bool wxPostScriptDCImpl::DoBlit( wxCoord xdest, wxCoord ydest,
wxCoord fwidth, wxCoord fheight,
wxDC *source,
wxCoord xsrc, wxCoord ysrc,
return true;
}
-wxCoord wxPostScriptImplDC::GetCharHeight() const
+wxCoord wxPostScriptDCImpl::GetCharHeight() const
{
if (m_font.Ok())
return m_font.GetPointSize();
return 12;
}
-void wxPostScriptImplDC::PsPrint( const wxString& str )
+void wxPostScriptDCImpl::PsPrint( const wxString& str )
{
const wxCharBuffer psdata(str.utf8_str());
}
}
-void wxPostScriptImplDC::DoGetTextExtent(const wxString& string,
+void wxPostScriptDCImpl::DoGetTextExtent(const wxString& string,
wxCoord *x, wxCoord *y,
wxCoord *descent, wxCoord *externalLeading,
const wxFont *theFont ) const
#ifdef __WXGTK__
#include <gtk/gtk.h>
#include "wx/fontutil.h"
+#include "wx/gtk/dc.h"
#endif
#ifdef __WXMSW__
public:
wxCairoContext( wxGraphicsRenderer* renderer, const wxWindowDC& dc );
+ wxCairoContext( wxGraphicsRenderer* renderer, const wxMemoryDC& dc );
#ifdef __WXGTK__
wxCairoContext( wxGraphicsRenderer* renderer, GdkDrawable *drawable );
#endif
: wxGraphicsContext(renderer)
{
#ifdef __WXGTK__
-#if wxUSE_NEW_DC
- wxGTKImplDC *impldc = (wxGTKImplDC*) dc.GetImpl();
+ wxGTKDCImpl *impldc = (wxGTKDCImpl*) dc.GetImpl();
Init( gdk_cairo_create( impldc->GetGDKWindow() ) );
-#else
- Init( gdk_cairo_create( dc.m_window ) );
#endif
+#ifdef __WXMAC__
+ int width, height;
+ dc.GetSize( &width, &height );
+ CGContextRef cgcontext = (CGContextRef)dc.GetWindow()->MacGetCGContextRef();
+ cairo_surface_t* surface = cairo_quartz_surface_create_for_cg_context(cgcontext, width, height);
+ Init( cairo_create( surface ) );
+ cairo_surface_destroy( surface );
+#endif
+}
+
+wxCairoContext::wxCairoContext( wxGraphicsRenderer* renderer, const wxMemoryDC& dc )
+: wxGraphicsContext(renderer)
+{
+#ifdef __WXGTK__
+ wxGTKDCImpl *impldc = (wxGTKDCImpl*) dc.GetImpl();
+ Init( gdk_cairo_create( impldc->GetGDKWindow() ) );
#endif
#ifdef __WXMAC__
int width, height;
// Context
virtual wxGraphicsContext * CreateContext( const wxWindowDC& dc);
-
-#ifdef __WXMSW__
virtual wxGraphicsContext * CreateContext( const wxMemoryDC& dc);
-#endif
virtual wxGraphicsContext * CreateContextFromNativeContext( void * context );
return new wxCairoContext(this,dc);
}
-#ifdef __WXMSW__
wxGraphicsContext * wxCairoRenderer::CreateContext( const wxMemoryDC& dc)
{
- return NULL;
+ return new wxCairoContext(this,dc);
}
-#endif
wxGraphicsContext * wxCairoRenderer::CreateContextFromNativeContext( void * context )
{
#include "wx/listimpl.cpp"
#include "wx/gtk/private.h"
+#include "wx/gtk/dc.h"
+#include "wx/gtk/dcclient.h"
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
{
wxRect renderrect( rect.x, rect.y, rect.width, rect.height );
wxWindowDC* dc = (wxWindowDC*) cell->GetDC();
-#if wxUSE_NEW_DC
- wxGTKWindowDCImpl *impldc = (wxGTKWindowDCImpl *) dc->GetImpl();
- if (impldc->m_window == NULL)
+ wxWindowDCImpl *impl = (wxWindowDCImpl *) dc->GetImpl();
+ if (impl->m_gdkwindow == NULL)
{
- impldc->m_window = window;
- impldc->SetUpDC();
+ impl->m_gdkwindow = window;
+ impl->SetUpDC();
}
-#else
- if (dc->m_window == NULL)
- {
- dc->m_window = window;
- dc->SetUpDC();
- }
-#endif
int state = 0;
if (flags & GTK_CELL_RENDERER_SELECTED)
// wxDataViewCustomRenderer
// ---------------------------------------------------------
-class wxDataViewCtrlDC: public wxWindowDC
+class wxDataViewCtrlDCImpl: public wxWindowDCImpl
{
public:
- wxDataViewCtrlDC( wxDataViewCtrl *window )
- {
-#if wxUSE_NEW_DC
- wxGTKWindowDCImpl *impl = (wxGTKWindowDCImpl*) GetImpl();
-
+ wxDataViewCtrlDCImpl( wxDC *owner, wxDataViewCtrl *window ) :
+ wxWindowDCImpl( owner )
+ {
GtkWidget *widget = window->m_treeview;
// Set later
- impl->m_window = NULL;
-
- impl->m_context = window->GtkGetPangoDefaultContext();
- impl->m_layout = pango_layout_new( impl->m_context );
- impl->m_fontdesc = pango_font_description_copy( widget->style->font_desc );
-
- impl->m_cmap = gtk_widget_get_colormap( widget ? widget : window->m_widget );
-
-#else
- GtkWidget *widget = window->m_treeview;
- // Set later
- m_window = NULL;
+ m_gdkwindow = NULL;
+
+ m_window = window;
m_context = window->GtkGetPangoDefaultContext();
m_layout = pango_layout_new( m_context );
m_fontdesc = pango_font_description_copy( widget->style->font_desc );
m_cmap = gtk_widget_get_colormap( widget ? widget : window->m_widget );
-#endif
- // Set m_window later
+
+ // Set m_gdkwindow later
// SetUpDC();
- // m_owner = window;
}
};
+class wxDataViewCtrlDC: public wxWindowDC
+{
+public:
+ wxDataViewCtrlDC( wxDataViewCtrl *window )
+ { m_pimpl = new wxDataViewCtrlDCImpl( this, window ); }
+};
+
+
// ---------------------------------------------------------
// wxDataViewCustomRenderer
// ---------------------------------------------------------
#include "wx/wxprec.h"
#include "wx/dc.h"
-
+#include "wx/gtk/private.h"
//-----------------------------------------------------------------------------
-// wxDC
+// wxGTKDCImpl
//-----------------------------------------------------------------------------
-#if wxUSE_NEW_DC
-IMPLEMENT_ABSTRACT_CLASS(wxGTKImplDC, wxImplDC)
-#else
-IMPLEMENT_ABSTRACT_CLASS(wxGTKImplDC, wxDCBase)
-#endif
+IMPLEMENT_ABSTRACT_CLASS(wxGTKDCImpl, wxDCImpl)
-#if wxUSE_NEW_DC
-wxGTKImplDC::wxGTKImplDC( wxDC *owner )
- : wxImplDC( owner )
-#else
-wxDC::wxDC()
-#endif
+wxGTKDCImpl::wxGTKDCImpl( wxDC *owner )
+ : wxDCImpl( owner )
{
m_ok = FALSE;
m_brush = *wxWHITE_BRUSH;
}
-wxGTKImplDC::~wxGTKImplDC()
+wxGTKDCImpl::~wxGTKDCImpl()
{
}
-void wxGTKImplDC::DoSetClippingRegion( wxCoord x, wxCoord y, wxCoord width, wxCoord height )
+void wxGTKDCImpl::DoSetClippingRegion( wxCoord x, wxCoord y, wxCoord width, wxCoord height )
{
m_clipping = TRUE;
m_clipX1 = x;
// get DC capabilities
// ---------------------------------------------------------------------------
-void wxGTKImplDC::DoGetSizeMM( int* width, int* height ) const
+void wxGTKDCImpl::DoGetSizeMM( int* width, int* height ) const
{
int w = 0;
int h = 0;
}
// Resolution in pixels per logical inch
-wxSize wxGTKImplDC::GetPPI() const
+wxSize wxGTKDCImpl::GetPPI() const
{
// TODO (should probably be pure virtual)
return wxSize(0, 0);
#define XCopyPlane XCOPYPLANE
#endif
+#include "wx/dc.h"
#include "wx/dcclient.h"
#ifndef WX_PRECOMP
// wxWindowDC
//-----------------------------------------------------------------------------
-#if wxUSE_NEW_DC
-IMPLEMENT_ABSTRACT_CLASS(wxGTKWindowImplDC, wxGTKImplDC)
-#else
-IMPLEMENT_ABSTRACT_CLASS(wxWindowDC, wxDC)
-#endif
+IMPLEMENT_ABSTRACT_CLASS(wxWindowDCImpl, wxGTKDCImpl)
-#if wxUSE_NEW_DC
-wxGTKWindowImplDC::wxGTKWindowImplDC( wxDC *owner ) :
- wxGTKImplDC( owner )
-#else
-wxWindowDC::wxWindowDC()
-#endif
+wxWindowDCImpl::wxWindowDCImpl( wxDC *owner ) :
+ wxGTKDCImpl( owner )
{
+ m_gdkwindow = (GdkWindow*) NULL;
m_penGC = (GdkGC *) NULL;
m_brushGC = (GdkGC *) NULL;
m_textGC = (GdkGC *) NULL;
m_bgGC = (GdkGC *) NULL;
m_cmap = (GdkColormap *) NULL;
m_isScreenDC = false;
- m_owningWindow = (wxWindow *)NULL;
m_context = (PangoContext *)NULL;
m_layout = (PangoLayout *)NULL;
m_fontdesc = (PangoFontDescription *)NULL;
}
-#if wxUSE_NEW_DC
-wxGTKWindowImplDC::wxGTKWindowImplDC( wxDC *owner, wxWindow *window ) :
- wxGTKImplDC( owner )
-#else
-wxWindowDC::wxWindowDC( wxWindow *window )
-#endif
+wxWindowDCImpl::wxWindowDCImpl( wxDC *owner, wxWindow *window ) :
+ wxGTKDCImpl( owner )
{
wxASSERT_MSG( window, wxT("DC needs a window") );
+ m_gdkwindow = (GdkWindow*) NULL;
m_penGC = (GdkGC *) NULL;
m_brushGC = (GdkGC *) NULL;
m_textGC = (GdkGC *) NULL;
m_bgGC = (GdkGC *) NULL;
m_cmap = (GdkColormap *) NULL;
- m_owningWindow = (wxWindow *)NULL;
m_isScreenDC = false;
m_font = window->GetFont();
m_layout = pango_layout_new( m_context );
m_fontdesc = pango_font_description_copy( widget->style->font_desc );
- m_window = widget->window;
+ m_gdkwindow = widget->window;
// Window not realized ?
- if (!m_window)
+ if (!m_gdkwindow)
{
// Don't report problems as per MSW.
m_ok = true;
is white whereas a window might assume gray to be the
standard (as e.g. wxStatusBar) */
- m_owningWindow = window;
+ m_window = window;
- if (m_owningWindow && m_owningWindow->m_wxwindow &&
- (m_owningWindow->GetLayoutDirection() == wxLayout_RightToLeft))
+ if (m_window && m_window->m_wxwindow &&
+ (m_window->GetLayoutDirection() == wxLayout_RightToLeft))
{
// reverse sense
m_signX = -1;
// origin in the upper right corner
- m_deviceOriginX = m_owningWindow->GetClientSize().x;
+ m_deviceOriginX = m_window->GetClientSize().x;
}
}
-wxGTKWindowImplDC::~wxGTKWindowImplDC()
+wxWindowDCImpl::~wxWindowDCImpl()
{
Destroy();
pango_font_description_free( m_fontdesc );
}
-void wxGTKWindowImplDC::SetUpDC( bool isMemDC )
+void wxWindowDCImpl::SetUpDC( bool isMemDC )
{
m_ok = true;
bool done = false;
- if (isMemDC)
+ if ((isMemDC) && (GetSelectedBitmap().IsOk()))
{
- wxGTKMemoryImplDC *mem_dc = (wxGTKMemoryImplDC*) this;
- if (mem_dc->GetSelectedBitmap().GetDepth() == 1)
+ if (GetSelectedBitmap().GetDepth() == 1)
{
- m_penGC = wxGetPoolGC( m_window, wxPEN_MONO );
- m_brushGC = wxGetPoolGC( m_window, wxBRUSH_MONO );
- m_textGC = wxGetPoolGC( m_window, wxTEXT_MONO );
- m_bgGC = wxGetPoolGC( m_window, wxBG_MONO );
+ m_penGC = wxGetPoolGC( m_gdkwindow, wxPEN_MONO );
+ m_brushGC = wxGetPoolGC( m_gdkwindow, wxBRUSH_MONO );
+ m_textGC = wxGetPoolGC( m_gdkwindow, wxTEXT_MONO );
+ m_bgGC = wxGetPoolGC( m_gdkwindow, wxBG_MONO );
done = true;
}
}
{
if (m_isScreenDC)
{
- m_penGC = wxGetPoolGC( m_window, wxPEN_SCREEN );
- m_brushGC = wxGetPoolGC( m_window, wxBRUSH_SCREEN );
- m_textGC = wxGetPoolGC( m_window, wxTEXT_SCREEN );
- m_bgGC = wxGetPoolGC( m_window, wxBG_SCREEN );
+ m_penGC = wxGetPoolGC( m_gdkwindow, wxPEN_SCREEN );
+ m_brushGC = wxGetPoolGC( m_gdkwindow, wxBRUSH_SCREEN );
+ m_textGC = wxGetPoolGC( m_gdkwindow, wxTEXT_SCREEN );
+ m_bgGC = wxGetPoolGC( m_gdkwindow, wxBG_SCREEN );
}
else
{
- m_penGC = wxGetPoolGC( m_window, wxPEN_COLOUR );
- m_brushGC = wxGetPoolGC( m_window, wxBRUSH_COLOUR );
- m_textGC = wxGetPoolGC( m_window, wxTEXT_COLOUR );
- m_bgGC = wxGetPoolGC( m_window, wxBG_COLOUR );
+ m_penGC = wxGetPoolGC( m_gdkwindow, wxPEN_COLOUR );
+ m_brushGC = wxGetPoolGC( m_gdkwindow, wxBRUSH_COLOUR );
+ m_textGC = wxGetPoolGC( m_gdkwindow, wxTEXT_COLOUR );
+ m_bgGC = wxGetPoolGC( m_gdkwindow, wxBG_COLOUR );
}
}
}
}
-void wxGTKWindowImplDC::DoGetSize( int* width, int* height ) const
+void wxWindowDCImpl::DoGetSize( int* width, int* height ) const
{
- wxCHECK_RET( m_owningWindow, _T("GetSize() doesn't work without window") );
+ wxCHECK_RET( m_window, _T("GetSize() doesn't work without window") );
- m_owningWindow->GetSize(width, height);
+ m_window->GetSize(width, height);
}
-bool wxGTKWindowImplDC::DoFloodFill(wxCoord x, wxCoord y,
+bool wxWindowDCImpl::DoFloodFill(wxCoord x, wxCoord y,
const wxColour& col, int style)
{
#if wxUSE_IMAGE
#endif
}
-bool wxGTKWindowImplDC::DoGetPixel( wxCoord x1, wxCoord y1, wxColour *col ) const
+bool wxWindowDCImpl::DoGetPixel( wxCoord x1, wxCoord y1, wxColour *col ) const
{
#if wxUSE_IMAGE
// Generic (and therefore rather inefficient) method.
wxMemoryDC memdc;
wxBitmap bitmap(1, 1);
memdc.SelectObject(bitmap);
- memdc.Blit(0, 0, 1, 1, (wxDC*) this, x1, y1);
+ memdc.Blit(0, 0, 1, 1, GetOwner(), x1, y1);
memdc.SelectObject(wxNullBitmap);
wxImage image = bitmap.ConvertToImage();
#endif // wxUSE_IMAGE/!wxUSE_IMAGE
}
-void wxGTKWindowImplDC::DoDrawLine( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2 )
+void wxWindowDCImpl::DoDrawLine( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2 )
{
wxCHECK_RET( IsOk(), wxT("invalid window dc") );
if (m_pen.GetStyle() != wxTRANSPARENT)
{
- if (m_window)
- gdk_draw_line( m_window, m_penGC, XLOG2DEV(x1), YLOG2DEV(y1), XLOG2DEV(x2), YLOG2DEV(y2) );
+ if (m_gdkwindow)
+ gdk_draw_line( m_gdkwindow, m_penGC, XLOG2DEV(x1), YLOG2DEV(y1), XLOG2DEV(x2), YLOG2DEV(y2) );
CalcBoundingBox(x1, y1);
CalcBoundingBox(x2, y2);
}
}
-void wxGTKWindowImplDC::DoCrossHair( wxCoord x, wxCoord y )
+void wxWindowDCImpl::DoCrossHair( wxCoord x, wxCoord y )
{
wxCHECK_RET( IsOk(), wxT("invalid window dc") );
GetOwner()->GetSize( &w, &h );
wxCoord xx = XLOG2DEV(x);
wxCoord yy = YLOG2DEV(y);
- if (m_window)
+ if (m_gdkwindow)
{
- gdk_draw_line( m_window, m_penGC, 0, yy, XLOG2DEVREL(w), yy );
- gdk_draw_line( m_window, m_penGC, xx, 0, xx, YLOG2DEVREL(h) );
+ gdk_draw_line( m_gdkwindow, m_penGC, 0, yy, XLOG2DEVREL(w), yy );
+ gdk_draw_line( m_gdkwindow, m_penGC, xx, 0, xx, YLOG2DEVREL(h) );
}
}
}
-void wxGTKWindowImplDC::DoDrawArc( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2,
+void wxWindowDCImpl::DoDrawArc( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2,
wxCoord xc, wxCoord yc )
{
wxCHECK_RET( IsOk(), wxT("invalid window dc") );
while (alpha2 <= 0) alpha2 += 360*64;
while (alpha1 > 360*64) alpha1 -= 360*64;
- if (m_window)
+ if (m_gdkwindow)
{
if (m_brush.GetStyle() != wxTRANSPARENT)
{
gdk_gc_set_ts_origin( m_textGC,
m_deviceOriginX % m_brush.GetStipple()->GetWidth(),
m_deviceOriginY % m_brush.GetStipple()->GetHeight() );
- gdk_draw_arc( m_window, m_textGC, TRUE, xxc-r, yyc-r, 2*r,2*r, alpha1, alpha2 );
+ gdk_draw_arc( m_gdkwindow, m_textGC, TRUE, xxc-r, yyc-r, 2*r,2*r, alpha1, alpha2 );
gdk_gc_set_ts_origin( m_textGC, 0, 0 );
} else
if (IS_15_PIX_HATCH(m_brush.GetStyle()))
{
gdk_gc_set_ts_origin( m_brushGC, m_deviceOriginX % 15, m_deviceOriginY % 15 );
- gdk_draw_arc( m_window, m_brushGC, TRUE, xxc-r, yyc-r, 2*r,2*r, alpha1, alpha2 );
+ gdk_draw_arc( m_gdkwindow, m_brushGC, TRUE, xxc-r, yyc-r, 2*r,2*r, alpha1, alpha2 );
gdk_gc_set_ts_origin( m_brushGC, 0, 0 );
} else
if (IS_16_PIX_HATCH(m_brush.GetStyle()))
{
gdk_gc_set_ts_origin( m_brushGC, m_deviceOriginX % 16, m_deviceOriginY % 16 );
- gdk_draw_arc( m_window, m_brushGC, TRUE, xxc-r, yyc-r, 2*r,2*r, alpha1, alpha2 );
+ gdk_draw_arc( m_gdkwindow, m_brushGC, TRUE, xxc-r, yyc-r, 2*r,2*r, alpha1, alpha2 );
gdk_gc_set_ts_origin( m_brushGC, 0, 0 );
} else
if (m_brush.GetStyle() == wxSTIPPLE)
gdk_gc_set_ts_origin( m_brushGC,
m_deviceOriginX % m_brush.GetStipple()->GetWidth(),
m_deviceOriginY % m_brush.GetStipple()->GetHeight() );
- gdk_draw_arc( m_window, m_brushGC, TRUE, xxc-r, yyc-r, 2*r,2*r, alpha1, alpha2 );
+ gdk_draw_arc( m_gdkwindow, m_brushGC, TRUE, xxc-r, yyc-r, 2*r,2*r, alpha1, alpha2 );
gdk_gc_set_ts_origin( m_brushGC, 0, 0 );
}
else
{
- gdk_draw_arc( m_window, m_brushGC, TRUE, xxc-r, yyc-r, 2*r,2*r, alpha1, alpha2 );
+ gdk_draw_arc( m_gdkwindow, m_brushGC, TRUE, xxc-r, yyc-r, 2*r,2*r, alpha1, alpha2 );
}
}
if (m_pen.GetStyle() != wxTRANSPARENT)
{
- gdk_draw_arc( m_window, m_penGC, FALSE, xxc-r, yyc-r, 2*r,2*r, alpha1, alpha2 );
+ gdk_draw_arc( m_gdkwindow, m_penGC, FALSE, xxc-r, yyc-r, 2*r,2*r, alpha1, alpha2 );
if ((m_brush.GetStyle() != wxTRANSPARENT) && (alpha2 - alpha1 != 360*64))
{
- gdk_draw_line( m_window, m_penGC, xx1, yy1, xxc, yyc );
- gdk_draw_line( m_window, m_penGC, xxc, yyc, xx2, yy2 );
+ gdk_draw_line( m_gdkwindow, m_penGC, xx1, yy1, xxc, yyc );
+ gdk_draw_line( m_gdkwindow, m_penGC, xxc, yyc, xx2, yy2 );
}
}
}
CalcBoundingBox (x2, y2);
}
-void wxGTKWindowImplDC::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( IsOk(), wxT("invalid window dc") );
if (ww < 0) { ww = -ww; xx = xx - ww; }
if (hh < 0) { hh = -hh; yy = yy - hh; }
- if (m_window)
+ if (m_gdkwindow)
{
wxCoord start = wxCoord(sa * 64.0);
wxCoord end = wxCoord((ea-sa) * 64.0);
gdk_gc_set_ts_origin( m_textGC,
m_deviceOriginX % m_brush.GetStipple()->GetWidth(),
m_deviceOriginY % m_brush.GetStipple()->GetHeight() );
- gdk_draw_arc( m_window, m_textGC, TRUE, xx, yy, ww, hh, start, end );
+ gdk_draw_arc( m_gdkwindow, m_textGC, TRUE, xx, yy, ww, hh, start, end );
gdk_gc_set_ts_origin( m_textGC, 0, 0 );
} else
if (IS_15_PIX_HATCH(m_brush.GetStyle()))
{
gdk_gc_set_ts_origin( m_brushGC, m_deviceOriginX % 15, m_deviceOriginY % 15 );
- gdk_draw_arc( m_window, m_brushGC, TRUE, xx, yy, ww, hh, start, end );
+ gdk_draw_arc( m_gdkwindow, m_brushGC, TRUE, xx, yy, ww, hh, start, end );
gdk_gc_set_ts_origin( m_brushGC, 0, 0 );
} else
if (IS_16_PIX_HATCH(m_brush.GetStyle()))
{
gdk_gc_set_ts_origin( m_brushGC, m_deviceOriginX % 16, m_deviceOriginY % 16 );
- gdk_draw_arc( m_window, m_brushGC, TRUE, xx, yy, ww, hh, start, end );
+ gdk_draw_arc( m_gdkwindow, m_brushGC, TRUE, xx, yy, ww, hh, start, end );
gdk_gc_set_ts_origin( m_brushGC, 0, 0 );
} else
if (m_brush.GetStyle() == wxSTIPPLE)
gdk_gc_set_ts_origin( m_brushGC,
m_deviceOriginX % m_brush.GetStipple()->GetWidth(),
m_deviceOriginY % m_brush.GetStipple()->GetHeight() );
- gdk_draw_arc( m_window, m_brushGC, TRUE, xx, yy, ww, hh, start, end );
+ gdk_draw_arc( m_gdkwindow, m_brushGC, TRUE, xx, yy, ww, hh, start, end );
gdk_gc_set_ts_origin( m_brushGC, 0, 0 );
}
else
{
- gdk_draw_arc( m_window, m_brushGC, TRUE, xx, yy, ww, hh, start, end );
+ gdk_draw_arc( m_gdkwindow, m_brushGC, TRUE, xx, yy, ww, hh, start, end );
}
}
if (m_pen.GetStyle() != wxTRANSPARENT)
- gdk_draw_arc( m_window, m_penGC, FALSE, xx, yy, ww, hh, start, end );
+ gdk_draw_arc( m_gdkwindow, m_penGC, FALSE, xx, yy, ww, hh, start, end );
}
CalcBoundingBox (x, y);
CalcBoundingBox (x + width, y + height);
}
-void wxGTKWindowImplDC::DoDrawPoint( wxCoord x, wxCoord y )
+void wxWindowDCImpl::DoDrawPoint( wxCoord x, wxCoord y )
{
wxCHECK_RET( IsOk(), wxT("invalid window dc") );
- if ((m_pen.GetStyle() != wxTRANSPARENT) && m_window)
- gdk_draw_point( m_window, m_penGC, XLOG2DEV(x), YLOG2DEV(y) );
+ if ((m_pen.GetStyle() != wxTRANSPARENT) && m_gdkwindow)
+ gdk_draw_point( m_gdkwindow, m_penGC, XLOG2DEV(x), YLOG2DEV(y) );
CalcBoundingBox (x, y);
}
-void wxGTKWindowImplDC::DoDrawLines( int n, wxPoint points[], wxCoord xoffset, wxCoord yoffset )
+void wxWindowDCImpl::DoDrawLines( int n, wxPoint points[], wxCoord xoffset, wxCoord yoffset )
{
wxCHECK_RET( IsOk(), wxT("invalid window dc") );
CalcBoundingBox(points[i].x + xoffset, points[i].y + yoffset);
}
- if (m_window)
- gdk_draw_lines( m_window, m_penGC, gpts, n);
+ if (m_gdkwindow)
+ gdk_draw_lines( m_gdkwindow, m_penGC, gpts, n);
if (doScale)
delete[] gpts;
}
-void wxGTKWindowImplDC::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( IsOk(), wxT("invalid window dc") );
CalcBoundingBox(points[i].x + xoffset, points[i].y + yoffset);
}
- if (m_window)
+ if (m_gdkwindow)
{
if (m_brush.GetStyle() != wxTRANSPARENT)
{
gdk_gc_set_ts_origin( m_textGC,
m_deviceOriginX % m_brush.GetStipple()->GetWidth(),
m_deviceOriginY % m_brush.GetStipple()->GetHeight() );
- gdk_draw_polygon( m_window, m_textGC, TRUE, gdkpoints, n );
+ gdk_draw_polygon( m_gdkwindow, m_textGC, TRUE, gdkpoints, n );
gdk_gc_set_ts_origin( m_textGC, 0, 0 );
} else
if (IS_15_PIX_HATCH(m_brush.GetStyle()))
{
gdk_gc_set_ts_origin( m_brushGC, m_deviceOriginX % 15, m_deviceOriginY % 15 );
- gdk_draw_polygon( m_window, m_brushGC, TRUE, gdkpoints, n );
+ gdk_draw_polygon( m_gdkwindow, m_brushGC, TRUE, gdkpoints, n );
gdk_gc_set_ts_origin( m_brushGC, 0, 0 );
} else
if (IS_16_PIX_HATCH(m_brush.GetStyle()))
{
gdk_gc_set_ts_origin( m_brushGC, m_deviceOriginX % 16, m_deviceOriginY % 16 );
- gdk_draw_polygon( m_window, m_brushGC, TRUE, gdkpoints, n );
+ gdk_draw_polygon( m_gdkwindow, m_brushGC, TRUE, gdkpoints, n );
gdk_gc_set_ts_origin( m_brushGC, 0, 0 );
} else
if (m_brush.GetStyle() == wxSTIPPLE)
gdk_gc_set_ts_origin( m_brushGC,
m_deviceOriginX % m_brush.GetStipple()->GetWidth(),
m_deviceOriginY % m_brush.GetStipple()->GetHeight() );
- gdk_draw_polygon( m_window, m_brushGC, TRUE, gdkpoints, n );
+ gdk_draw_polygon( m_gdkwindow, m_brushGC, TRUE, gdkpoints, n );
gdk_gc_set_ts_origin( m_brushGC, 0, 0 );
}
else
{
- gdk_draw_polygon( m_window, m_brushGC, TRUE, gdkpoints, n );
+ gdk_draw_polygon( m_gdkwindow, m_brushGC, TRUE, gdkpoints, n );
}
}
/*
for (i = 0 ; i < n ; i++)
{
- gdk_draw_line( m_window, m_penGC,
+ gdk_draw_line( m_gdkwindow, m_penGC,
gdkpoints[i%n].x,
gdkpoints[i%n].y,
gdkpoints[(i+1)%n].x,
gdkpoints[(i+1)%n].y);
}
*/
- gdk_draw_polygon( m_window, m_penGC, FALSE, gdkpoints, n );
+ gdk_draw_polygon( m_gdkwindow, m_penGC, FALSE, gdkpoints, n );
}
}
delete[] gdkpoints;
}
-void wxGTKWindowImplDC::DoDrawRectangle( wxCoord x, wxCoord y, wxCoord width, wxCoord height )
+void wxWindowDCImpl::DoDrawRectangle( wxCoord x, wxCoord y, wxCoord width, wxCoord height )
{
wxCHECK_RET( IsOk(), wxT("invalid window dc") );
if (ww < 0) { ww = -ww; xx = xx - ww; }
if (hh < 0) { hh = -hh; yy = yy - hh; }
- if (m_window)
+ if (m_gdkwindow)
{
if (m_brush.GetStyle() != wxTRANSPARENT)
{
gdk_gc_set_ts_origin( m_textGC,
m_deviceOriginX % m_brush.GetStipple()->GetWidth(),
m_deviceOriginY % m_brush.GetStipple()->GetHeight() );
- gdk_draw_rectangle( m_window, m_textGC, TRUE, xx, yy, ww, hh );
+ gdk_draw_rectangle( m_gdkwindow, m_textGC, TRUE, xx, yy, ww, hh );
gdk_gc_set_ts_origin( m_textGC, 0, 0 );
} else
if (IS_15_PIX_HATCH(m_brush.GetStyle()))
{
gdk_gc_set_ts_origin( m_brushGC, m_deviceOriginX % 15, m_deviceOriginY % 15 );
- gdk_draw_rectangle( m_window, m_brushGC, TRUE, xx, yy, ww, hh );
+ gdk_draw_rectangle( m_gdkwindow, m_brushGC, TRUE, xx, yy, ww, hh );
gdk_gc_set_ts_origin( m_brushGC, 0, 0 );
} else
if (IS_16_PIX_HATCH(m_brush.GetStyle()))
{
gdk_gc_set_ts_origin( m_brushGC, m_deviceOriginX % 16, m_deviceOriginY % 16 );
- gdk_draw_rectangle( m_window, m_brushGC, TRUE, xx, yy, ww, hh );
+ gdk_draw_rectangle( m_gdkwindow, m_brushGC, TRUE, xx, yy, ww, hh );
gdk_gc_set_ts_origin( m_brushGC, 0, 0 );
} else
if (m_brush.GetStyle() == wxSTIPPLE)
gdk_gc_set_ts_origin( m_brushGC,
m_deviceOriginX % m_brush.GetStipple()->GetWidth(),
m_deviceOriginY % m_brush.GetStipple()->GetHeight() );
- gdk_draw_rectangle( m_window, m_brushGC, TRUE, xx, yy, ww, hh );
+ gdk_draw_rectangle( m_gdkwindow, m_brushGC, TRUE, xx, yy, ww, hh );
gdk_gc_set_ts_origin( m_brushGC, 0, 0 );
}
else
{
- gdk_draw_rectangle( m_window, m_brushGC, TRUE, xx, yy, ww, hh );
+ gdk_draw_rectangle( m_gdkwindow, m_brushGC, TRUE, xx, yy, ww, hh );
}
}
if (m_signX == -1)
{
// Different for RTL
- gdk_draw_rectangle( m_window, m_penGC, FALSE, xx+1, yy, ww-2, hh-2 );
- gdk_draw_rectangle( m_window, m_penGC, FALSE, xx, yy-1, ww, hh );
+ gdk_draw_rectangle( m_gdkwindow, m_penGC, FALSE, xx+1, yy, ww-2, hh-2 );
+ gdk_draw_rectangle( m_gdkwindow, m_penGC, FALSE, xx, yy-1, ww, hh );
}
else
{
- gdk_draw_rectangle( m_window, m_penGC, FALSE, xx, yy, ww-2, hh-2 );
- gdk_draw_rectangle( m_window, m_penGC, FALSE, xx-1, yy-1, ww, hh );
+ gdk_draw_rectangle( m_gdkwindow, m_penGC, FALSE, xx, yy, ww-2, hh-2 );
+ gdk_draw_rectangle( m_gdkwindow, m_penGC, FALSE, xx-1, yy-1, ww, hh );
}
// reset
#endif
{
// Just use X11 for other cases
- gdk_draw_rectangle( m_window, m_penGC, FALSE, xx, yy, ww-1, hh-1 );
+ gdk_draw_rectangle( m_gdkwindow, m_penGC, FALSE, xx, yy, ww-1, hh-1 );
}
}
}
CalcBoundingBox( x + width, y + height );
}
-void wxGTKWindowImplDC::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( IsOk(), wxT("invalid window dc") );
hh--;
}
- if (m_window)
+ if (m_gdkwindow)
{
// CMB: ensure dd is not larger than rectangle otherwise we
// get an hour glass shape
gdk_gc_set_ts_origin( m_textGC,
m_deviceOriginX % m_brush.GetStipple()->GetWidth(),
m_deviceOriginY % m_brush.GetStipple()->GetHeight() );
- gdk_draw_rectangle( m_window, m_textGC, TRUE, xx+rr, yy, ww-dd+1, hh );
- gdk_draw_rectangle( m_window, m_textGC, TRUE, xx, yy+rr, ww, hh-dd+1 );
- gdk_draw_arc( m_window, m_textGC, TRUE, xx, yy, dd, dd, 90*64, 90*64 );
- gdk_draw_arc( m_window, m_textGC, TRUE, xx+ww-dd, yy, dd, dd, 0, 90*64 );
- gdk_draw_arc( m_window, m_textGC, TRUE, xx+ww-dd, yy+hh-dd, dd, dd, 270*64, 90*64 );
- gdk_draw_arc( m_window, m_textGC, TRUE, xx, yy+hh-dd, dd, dd, 180*64, 90*64 );
+ gdk_draw_rectangle( m_gdkwindow, m_textGC, TRUE, xx+rr, yy, ww-dd+1, hh );
+ gdk_draw_rectangle( m_gdkwindow, m_textGC, TRUE, xx, yy+rr, ww, hh-dd+1 );
+ gdk_draw_arc( m_gdkwindow, m_textGC, TRUE, xx, yy, dd, dd, 90*64, 90*64 );
+ gdk_draw_arc( m_gdkwindow, m_textGC, TRUE, xx+ww-dd, yy, dd, dd, 0, 90*64 );
+ gdk_draw_arc( m_gdkwindow, m_textGC, TRUE, xx+ww-dd, yy+hh-dd, dd, dd, 270*64, 90*64 );
+ gdk_draw_arc( m_gdkwindow, m_textGC, TRUE, xx, yy+hh-dd, dd, dd, 180*64, 90*64 );
gdk_gc_set_ts_origin( m_textGC, 0, 0 );
} else
if (IS_15_PIX_HATCH(m_brush.GetStyle()))
{
gdk_gc_set_ts_origin( m_brushGC, m_deviceOriginX % 15, m_deviceOriginY % 15 );
- gdk_draw_rectangle( m_window, m_brushGC, TRUE, xx+rr, yy, ww-dd+1, hh );
- gdk_draw_rectangle( m_window, m_brushGC, TRUE, xx, yy+rr, ww, hh-dd+1 );
- gdk_draw_arc( m_window, m_brushGC, TRUE, xx, yy, dd, dd, 90*64, 90*64 );
- gdk_draw_arc( m_window, m_brushGC, TRUE, xx+ww-dd, yy, dd, dd, 0, 90*64 );
- gdk_draw_arc( m_window, m_brushGC, TRUE, xx+ww-dd, yy+hh-dd, dd, dd, 270*64, 90*64 );
- gdk_draw_arc( m_window, m_brushGC, TRUE, xx, yy+hh-dd, dd, dd, 180*64, 90*64 );
+ gdk_draw_rectangle( m_gdkwindow, m_brushGC, TRUE, xx+rr, yy, ww-dd+1, hh );
+ gdk_draw_rectangle( m_gdkwindow, m_brushGC, TRUE, xx, yy+rr, ww, hh-dd+1 );
+ gdk_draw_arc( m_gdkwindow, m_brushGC, TRUE, xx, yy, dd, dd, 90*64, 90*64 );
+ gdk_draw_arc( m_gdkwindow, m_brushGC, TRUE, xx+ww-dd, yy, dd, dd, 0, 90*64 );
+ gdk_draw_arc( m_gdkwindow, m_brushGC, TRUE, xx+ww-dd, yy+hh-dd, dd, dd, 270*64, 90*64 );
+ gdk_draw_arc( m_gdkwindow, m_brushGC, TRUE, xx, yy+hh-dd, dd, dd, 180*64, 90*64 );
gdk_gc_set_ts_origin( m_brushGC, 0, 0 );
} else
if (IS_16_PIX_HATCH(m_brush.GetStyle()))
{
gdk_gc_set_ts_origin( m_brushGC, m_deviceOriginX % 16, m_deviceOriginY % 16 );
- gdk_draw_rectangle( m_window, m_brushGC, TRUE, xx+rr, yy, ww-dd+1, hh );
- gdk_draw_rectangle( m_window, m_brushGC, TRUE, xx, yy+rr, ww, hh-dd+1 );
- gdk_draw_arc( m_window, m_brushGC, TRUE, xx, yy, dd, dd, 90*64, 90*64 );
- gdk_draw_arc( m_window, m_brushGC, TRUE, xx+ww-dd, yy, dd, dd, 0, 90*64 );
- gdk_draw_arc( m_window, m_brushGC, TRUE, xx+ww-dd, yy+hh-dd, dd, dd, 270*64, 90*64 );
- gdk_draw_arc( m_window, m_brushGC, TRUE, xx, yy+hh-dd, dd, dd, 180*64, 90*64 );
+ gdk_draw_rectangle( m_gdkwindow, m_brushGC, TRUE, xx+rr, yy, ww-dd+1, hh );
+ gdk_draw_rectangle( m_gdkwindow, m_brushGC, TRUE, xx, yy+rr, ww, hh-dd+1 );
+ gdk_draw_arc( m_gdkwindow, m_brushGC, TRUE, xx, yy, dd, dd, 90*64, 90*64 );
+ gdk_draw_arc( m_gdkwindow, m_brushGC, TRUE, xx+ww-dd, yy, dd, dd, 0, 90*64 );
+ gdk_draw_arc( m_gdkwindow, m_brushGC, TRUE, xx+ww-dd, yy+hh-dd, dd, dd, 270*64, 90*64 );
+ gdk_draw_arc( m_gdkwindow, m_brushGC, TRUE, xx, yy+hh-dd, dd, dd, 180*64, 90*64 );
gdk_gc_set_ts_origin( m_brushGC, 0, 0 );
} else
if (m_brush.GetStyle() == wxSTIPPLE)
gdk_gc_set_ts_origin( m_brushGC,
m_deviceOriginX % m_brush.GetStipple()->GetWidth(),
m_deviceOriginY % m_brush.GetStipple()->GetHeight() );
- gdk_draw_rectangle( m_window, m_brushGC, TRUE, xx+rr, yy, ww-dd+1, hh );
- gdk_draw_rectangle( m_window, m_brushGC, TRUE, xx, yy+rr, ww, hh-dd+1 );
- gdk_draw_arc( m_window, m_brushGC, TRUE, xx, yy, dd, dd, 90*64, 90*64 );
- gdk_draw_arc( m_window, m_brushGC, TRUE, xx+ww-dd, yy, dd, dd, 0, 90*64 );
- gdk_draw_arc( m_window, m_brushGC, TRUE, xx+ww-dd, yy+hh-dd, dd, dd, 270*64, 90*64 );
- gdk_draw_arc( m_window, m_brushGC, TRUE, xx, yy+hh-dd, dd, dd, 180*64, 90*64 );
+ gdk_draw_rectangle( m_gdkwindow, m_brushGC, TRUE, xx+rr, yy, ww-dd+1, hh );
+ gdk_draw_rectangle( m_gdkwindow, m_brushGC, TRUE, xx, yy+rr, ww, hh-dd+1 );
+ gdk_draw_arc( m_gdkwindow, m_brushGC, TRUE, xx, yy, dd, dd, 90*64, 90*64 );
+ gdk_draw_arc( m_gdkwindow, m_brushGC, TRUE, xx+ww-dd, yy, dd, dd, 0, 90*64 );
+ gdk_draw_arc( m_gdkwindow, m_brushGC, TRUE, xx+ww-dd, yy+hh-dd, dd, dd, 270*64, 90*64 );
+ gdk_draw_arc( m_gdkwindow, m_brushGC, TRUE, xx, yy+hh-dd, dd, dd, 180*64, 90*64 );
gdk_gc_set_ts_origin( m_brushGC, 0, 0 );
}
else
{
- gdk_draw_rectangle( m_window, m_brushGC, TRUE, xx+rr, yy, ww-dd+1, hh );
- gdk_draw_rectangle( m_window, m_brushGC, TRUE, xx, yy+rr, ww, hh-dd+1 );
- gdk_draw_arc( m_window, m_brushGC, TRUE, xx, yy, dd, dd, 90*64, 90*64 );
- gdk_draw_arc( m_window, m_brushGC, TRUE, xx+ww-dd, yy, dd, dd, 0, 90*64 );
- gdk_draw_arc( m_window, m_brushGC, TRUE, xx+ww-dd, yy+hh-dd, dd, dd, 270*64, 90*64 );
- gdk_draw_arc( m_window, m_brushGC, TRUE, xx, yy+hh-dd, dd, dd, 180*64, 90*64 );
+ gdk_draw_rectangle( m_gdkwindow, m_brushGC, TRUE, xx+rr, yy, ww-dd+1, hh );
+ gdk_draw_rectangle( m_gdkwindow, m_brushGC, TRUE, xx, yy+rr, ww, hh-dd+1 );
+ gdk_draw_arc( m_gdkwindow, m_brushGC, TRUE, xx, yy, dd, dd, 90*64, 90*64 );
+ gdk_draw_arc( m_gdkwindow, m_brushGC, TRUE, xx+ww-dd, yy, dd, dd, 0, 90*64 );
+ gdk_draw_arc( m_gdkwindow, m_brushGC, TRUE, xx+ww-dd, yy+hh-dd, dd, dd, 270*64, 90*64 );
+ gdk_draw_arc( m_gdkwindow, m_brushGC, TRUE, xx, yy+hh-dd, dd, dd, 180*64, 90*64 );
}
}
if (m_pen.GetStyle() != wxTRANSPARENT)
{
- gdk_draw_line( m_window, m_penGC, xx+rr+1, yy, xx+ww-rr, yy );
- gdk_draw_line( m_window, m_penGC, xx+rr+1, yy+hh, xx+ww-rr, yy+hh );
- gdk_draw_line( m_window, m_penGC, xx, yy+rr+1, xx, yy+hh-rr );
- gdk_draw_line( m_window, m_penGC, xx+ww, yy+rr+1, xx+ww, yy+hh-rr );
- gdk_draw_arc( m_window, m_penGC, FALSE, xx, yy, dd, dd, 90*64, 90*64 );
- gdk_draw_arc( m_window, m_penGC, FALSE, xx+ww-dd, yy, dd, dd, 0, 90*64 );
- gdk_draw_arc( m_window, m_penGC, FALSE, xx+ww-dd, yy+hh-dd, dd, dd, 270*64, 90*64 );
- gdk_draw_arc( m_window, m_penGC, FALSE, xx, yy+hh-dd, dd, dd, 180*64, 90*64 );
+ gdk_draw_line( m_gdkwindow, m_penGC, xx+rr+1, yy, xx+ww-rr, yy );
+ gdk_draw_line( m_gdkwindow, m_penGC, xx+rr+1, yy+hh, xx+ww-rr, yy+hh );
+ gdk_draw_line( m_gdkwindow, m_penGC, xx, yy+rr+1, xx, yy+hh-rr );
+ gdk_draw_line( m_gdkwindow, m_penGC, xx+ww, yy+rr+1, xx+ww, yy+hh-rr );
+ gdk_draw_arc( m_gdkwindow, m_penGC, FALSE, xx, yy, dd, dd, 90*64, 90*64 );
+ gdk_draw_arc( m_gdkwindow, m_penGC, FALSE, xx+ww-dd, yy, dd, dd, 0, 90*64 );
+ gdk_draw_arc( m_gdkwindow, m_penGC, FALSE, xx+ww-dd, yy+hh-dd, dd, dd, 270*64, 90*64 );
+ gdk_draw_arc( m_gdkwindow, m_penGC, FALSE, xx, yy+hh-dd, dd, dd, 180*64, 90*64 );
}
}
CalcBoundingBox( x + width, y + height );
}
-void wxGTKWindowImplDC::DoDrawEllipse( wxCoord x, wxCoord y, wxCoord width, wxCoord height )
+void wxWindowDCImpl::DoDrawEllipse( wxCoord x, wxCoord y, wxCoord width, wxCoord height )
{
wxCHECK_RET( IsOk(), wxT("invalid window dc") );
if (ww < 0) { ww = -ww; xx = xx - ww; }
if (hh < 0) { hh = -hh; yy = yy - hh; }
- if (m_window)
+ if (m_gdkwindow)
{
if (m_brush.GetStyle() != wxTRANSPARENT)
{
gdk_gc_set_ts_origin( m_textGC,
m_deviceOriginX % m_brush.GetStipple()->GetWidth(),
m_deviceOriginY % m_brush.GetStipple()->GetHeight() );
- gdk_draw_arc( m_window, m_textGC, TRUE, xx, yy, ww, hh, 0, 360*64 );
+ gdk_draw_arc( m_gdkwindow, m_textGC, TRUE, xx, yy, ww, hh, 0, 360*64 );
gdk_gc_set_ts_origin( m_textGC, 0, 0 );
} else
if (IS_15_PIX_HATCH(m_brush.GetStyle()))
{
gdk_gc_set_ts_origin( m_brushGC, m_deviceOriginX % 15, m_deviceOriginY % 15 );
- gdk_draw_arc( m_window, m_brushGC, TRUE, xx, yy, ww, hh, 0, 360*64 );
+ gdk_draw_arc( m_gdkwindow, m_brushGC, TRUE, xx, yy, ww, hh, 0, 360*64 );
gdk_gc_set_ts_origin( m_brushGC, 0, 0 );
} else
if (IS_16_PIX_HATCH(m_brush.GetStyle()))
{
gdk_gc_set_ts_origin( m_brushGC, m_deviceOriginX % 16, m_deviceOriginY % 16 );
- gdk_draw_arc( m_window, m_brushGC, TRUE, xx, yy, ww, hh, 0, 360*64 );
+ gdk_draw_arc( m_gdkwindow, m_brushGC, TRUE, xx, yy, ww, hh, 0, 360*64 );
gdk_gc_set_ts_origin( m_brushGC, 0, 0 );
} else
if (m_brush.GetStyle() == wxSTIPPLE)
gdk_gc_set_ts_origin( m_brushGC,
m_deviceOriginX % m_brush.GetStipple()->GetWidth(),
m_deviceOriginY % m_brush.GetStipple()->GetHeight() );
- gdk_draw_arc( m_window, m_brushGC, TRUE, xx, yy, ww, hh, 0, 360*64 );
+ gdk_draw_arc( m_gdkwindow, m_brushGC, TRUE, xx, yy, ww, hh, 0, 360*64 );
gdk_gc_set_ts_origin( m_brushGC, 0, 0 );
}
else
{
- gdk_draw_arc( m_window, m_brushGC, TRUE, xx, yy, ww, hh, 0, 360*64 );
+ gdk_draw_arc( m_gdkwindow, m_brushGC, TRUE, xx, yy, ww, hh, 0, 360*64 );
}
}
if (m_pen.GetStyle() != wxTRANSPARENT)
- gdk_draw_arc( m_window, m_penGC, FALSE, xx, yy, ww, hh, 0, 360*64 );
+ gdk_draw_arc( m_gdkwindow, m_penGC, FALSE, xx, yy, ww, hh, 0, 360*64 );
}
CalcBoundingBox( x, y );
CalcBoundingBox( x + width, y + height );
}
-void wxGTKWindowImplDC::DoDrawIcon( const wxIcon &icon, wxCoord x, wxCoord y )
+void wxWindowDCImpl::DoDrawIcon( const wxIcon &icon, wxCoord x, wxCoord y )
{
// VZ: egcs 1.0.3 refuses to compile this without cast, no idea why
DoDrawBitmap( (const wxBitmap&)icon, x, y, true );
}
-void wxGTKWindowImplDC::DoDrawBitmap( const wxBitmap &bitmap,
+void wxWindowDCImpl::DoDrawBitmap( const wxBitmap &bitmap,
wxCoord x, wxCoord y,
bool useMask )
{
int w = bitmap.GetWidth();
int h = bitmap.GetHeight();
- if (m_owningWindow && m_owningWindow->GetLayoutDirection() == wxLayout_RightToLeft)
+ if (m_window && m_window->GetLayoutDirection() == wxLayout_RightToLeft)
xx -= w;
CalcBoundingBox( x, y );
CalcBoundingBox( x + w, y + h );
- if (!m_window) return;
+ if (!m_gdkwindow) return;
int ww = XLOG2DEVREL(w);
int hh = YLOG2DEVREL(h);
gdk_gc_set_background( gc, m_textBackgroundColour.GetColor() );
gdk_wx_draw_bitmap(bitmap2, gc, use_bitmap.GetPixmap(), 0, 0);
- gdk_draw_drawable(m_window, use_gc, bitmap2, 0, 0, xx, yy, -1, -1);
+ gdk_draw_drawable(m_gdkwindow, use_gc, bitmap2, 0, 0, xx, yy, -1, -1);
g_object_unref (bitmap2);
g_object_unref (gc);
{
if (use_bitmap.HasPixbuf())
{
- gdk_draw_pixbuf(m_window, use_gc,
+ gdk_draw_pixbuf(m_gdkwindow, use_gc,
use_bitmap.GetPixbuf(),
0, 0, xx, yy, -1, -1,
GDK_RGB_DITHER_NORMAL, xx, yy);
}
else
{
- gdk_draw_drawable(m_window, use_gc,
+ gdk_draw_drawable(m_gdkwindow, use_gc,
use_bitmap.GetPixmap(),
0, 0, xx, yy, -1, -1);
}
}
}
-bool wxGTKWindowImplDC::DoBlit( wxCoord xdest, wxCoord ydest,
+bool wxWindowDCImpl::DoBlit( wxCoord xdest, wxCoord ydest,
wxCoord width, wxCoord height,
wxDC *source,
wxCoord xsrc, wxCoord ysrc,
wxCHECK_MSG( source, false, wxT("invalid source dc") );
- if (!m_window) return false;
+ if (!m_gdkwindow) return false;
// transform the source DC coords to the device ones
xsrc = source->LogicalToDeviceX(xsrc);
gdk_gc_set_background( gc, m_textBackgroundColour.GetColor() );
gdk_wx_draw_bitmap(bitmap, gc, use_bitmap.GetPixmap(), 0, 0);
- gdk_draw_drawable(m_window, use_gc, bitmap, xsrc, ysrc, cx, cy, cw, ch);
+ gdk_draw_drawable(m_gdkwindow, use_gc, bitmap, xsrc, ysrc, cx, cy, cw, ch);
g_object_unref (bitmap);
g_object_unref (gc);
}
else
{
- // was: gdk_draw_drawable( m_window, m_penGC, use_bitmap.GetPixmap(), xsrc, ysrc, xx, yy, ww, hh );
- gdk_draw_drawable(m_window, use_gc, use_bitmap.GetPixmap(), xsrc, ysrc, cx, cy, cw, ch);
+ // was: gdk_draw_drawable( m_gdkwindow, m_penGC, use_bitmap.GetPixmap(), xsrc, ysrc, xx, yy, ww, hh );
+ gdk_draw_drawable(m_gdkwindow, use_gc, use_bitmap.GetPixmap(), xsrc, ysrc, cx, cy, cw, ch);
}
// remove mask again if any
wxBitmap bitmap = selected.Rescale( cx-xx, cy-yy, cw, ch, ww, hh );
// draw scaled bitmap
- // was: gdk_draw_drawable( m_window, m_penGC, bitmap.GetPixmap(), 0, 0, xx, yy, -1, -1 );
- gdk_draw_drawable( m_window, m_penGC, bitmap.GetPixmap(), 0, 0, cx, cy, -1, -1 );
+ // was: gdk_draw_drawable( m_gdkwindow, m_penGC, bitmap.GetPixmap(), 0, 0, xx, yy, -1, -1 );
+ gdk_draw_drawable( m_gdkwindow, m_penGC, bitmap.GetPixmap(), 0, 0, cx, cy, -1, -1 );
}
else
{
// No scaling and not a memory dc with a mask either
#if wxUSE_NEW_DC
GdkWindow* window = NULL;
- wxImplDC *impl = source->GetImpl();
- wxGTKWindowImplDC *gtk_impl = wxDynamicCast(impl, wxGTKWindowImplDC);
+ wxDCImpl *impl = source->GetImpl();
+ wxWindowDCImpl *gtk_impl = wxDynamicCast(impl, wxWindowDCImpl);
if (gtk_impl)
window = gtk_impl->GetGDKWindow();
#else
// copy including child window contents
gdk_gc_set_subwindow( m_penGC, GDK_INCLUDE_INFERIORS );
- gdk_draw_drawable( m_window, m_penGC,
+ gdk_draw_drawable( m_gdkwindow, m_penGC,
window,
xsrc, ysrc, xx, yy,
width, height );
return true;
}
-void wxGTKWindowImplDC::DoDrawText( const wxString &text, wxCoord x, wxCoord y )
+void wxWindowDCImpl::DoDrawText( const wxString &text, wxCoord x, wxCoord y )
{
wxCHECK_RET( IsOk(), wxT("invalid window dc") );
- if (!m_window) return;
+ if (!m_gdkwindow) return;
if (text.empty()) return;
if ( m_backgroundMode == wxSOLID )
{
gdk_gc_set_foreground(m_textGC, m_textBackgroundColour.GetColor());
- gdk_draw_rectangle(m_window, m_textGC, TRUE, x, y, w, h);
+ gdk_draw_rectangle(m_gdkwindow, m_textGC, TRUE, x, y, w, h);
gdk_gc_set_foreground(m_textGC, m_textForegroundColour.GetColor());
}
// Draw layout.
- if (m_owningWindow && m_owningWindow->GetLayoutDirection() == wxLayout_RightToLeft)
- gdk_draw_layout( m_window, m_textGC, x-w, y, m_layout );
+ if (m_window && m_window->GetLayoutDirection() == wxLayout_RightToLeft)
+ gdk_draw_layout( m_gdkwindow, m_textGC, x-w, y, m_layout );
else
- gdk_draw_layout( m_window, m_textGC, x, y, m_layout );
+ gdk_draw_layout( m_gdkwindow, m_textGC, x, y, m_layout );
// reset unscaled size
pango_font_description_set_size( m_fontdesc, oldSize );
if ( m_backgroundMode == wxSOLID )
{
gdk_gc_set_foreground(m_textGC, m_textBackgroundColour.GetColor());
- gdk_draw_rectangle(m_window, m_textGC, TRUE, x, y, w, h);
+ gdk_draw_rectangle(m_gdkwindow, m_textGC, TRUE, x, y, w, h);
gdk_gc_set_foreground(m_textGC, m_textForegroundColour.GetColor());
}
// Draw layout.
- if (m_owningWindow && m_owningWindow->GetLayoutDirection() == wxLayout_RightToLeft)
- gdk_draw_layout( m_window, m_textGC, x-w, y, m_layout );
+ if (m_window && m_window->GetLayoutDirection() == wxLayout_RightToLeft)
+ gdk_draw_layout( m_gdkwindow, m_textGC, x-w, y, m_layout );
else
- gdk_draw_layout( m_window, m_textGC, x, y, m_layout );
+ gdk_draw_layout( m_gdkwindow, m_textGC, x, y, m_layout );
}
if (underlined)
// a better approach here:
// http://www.daa.com.au/pipermail/pygtk/2003-April/005052.html
-void wxGTKWindowImplDC::DoDrawRotatedText( const wxString &text, wxCoord x, wxCoord y, double angle )
+void wxWindowDCImpl::DoDrawRotatedText( const wxString &text, wxCoord x, wxCoord y, double angle )
{
#if wxUSE_IMAGE
- if (!m_window || text.empty())
+ if (!m_gdkwindow || text.empty())
return;
wxCHECK_RET( IsOk(), wxT("invalid window dc") );
#if 0
if ( m_font.GetUnderlined() )
{
- gdk_draw_line( m_window, m_textGC,
+ gdk_draw_line( m_gdkwindow, m_textGC,
XLOG2DEV(x + x4), YLOG2DEV(y + y4 + font->descent),
XLOG2DEV(x + x3), YLOG2DEV(y + y3 + font->descent));
}
#endif // wxUSE_IMAGE/!wxUSE_IMAGE
}
-void wxGTKWindowImplDC::DoGetTextExtent(const wxString &string,
+void wxWindowDCImpl::DoGetTextExtent(const wxString &string,
wxCoord *width, wxCoord *height,
wxCoord *descent, wxCoord *externalLeading,
const wxFont *theFont) const
}
-bool wxGTKWindowImplDC::DoGetPartialTextExtents(const wxString& text,
+bool wxWindowDCImpl::DoGetPartialTextExtents(const wxString& text,
wxArrayInt& widths) const
{
const size_t len = text.length();
}
-wxCoord wxGTKWindowImplDC::GetCharWidth() const
+wxCoord wxWindowDCImpl::GetCharWidth() const
{
pango_layout_set_text( m_layout, "H", 1 );
int w;
return w;
}
-wxCoord wxGTKWindowImplDC::GetCharHeight() const
+wxCoord wxWindowDCImpl::GetCharHeight() const
{
PangoFontMetrics *metrics = pango_context_get_metrics (m_context, m_fontdesc, pango_context_get_language(m_context));
wxCHECK_MSG( metrics, -1, _T("failed to get pango font metrics") );
return h;
}
-void wxGTKWindowImplDC::Clear()
+void wxWindowDCImpl::Clear()
{
wxCHECK_RET( IsOk(), wxT("invalid window dc") );
- if (!m_window) return;
+ if (!m_gdkwindow) return;
int width,height;
DoGetSize( &width, &height );
- gdk_draw_rectangle( m_window, m_bgGC, TRUE, 0, 0, width, height );
+ gdk_draw_rectangle( m_gdkwindow, m_bgGC, TRUE, 0, 0, width, height );
}
-void wxGTKWindowImplDC::SetFont( const wxFont &font )
+void wxWindowDCImpl::SetFont( const wxFont &font )
{
m_font = font;
m_fontdesc = pango_font_description_copy( m_font.GetNativeFontInfo()->description );
- if (m_owningWindow)
+ if (m_window)
{
PangoContext *oldContext = m_context;
- m_context = m_owningWindow->GtkGetPangoDefaultContext();
+ m_context = m_window->GtkGetPangoDefaultContext();
// If we switch back/forth between different contexts
// we also have to create a new layout. I think so,
}
}
-void wxGTKWindowImplDC::SetPen( const wxPen &pen )
+void wxWindowDCImpl::SetPen( const wxPen &pen )
{
wxCHECK_RET( IsOk(), wxT("invalid window dc") );
if (!m_pen.IsOk()) return;
- if (!m_window) return;
+ if (!m_gdkwindow) return;
gint width = m_pen.GetWidth();
if (width <= 0)
gdk_gc_set_foreground( m_penGC, m_pen.GetColour().GetColor() );
}
-void wxGTKWindowImplDC::SetBrush( const wxBrush &brush )
+void wxWindowDCImpl::SetBrush( const wxBrush &brush )
{
wxCHECK_RET( IsOk(), wxT("invalid window dc") );
if (!m_brush.IsOk()) return;
- if (!m_window) return;
+ if (!m_gdkwindow) return;
m_brush.GetColour().CalcPixel( m_cmap );
gdk_gc_set_foreground( m_brushGC, m_brush.GetColour().GetColor() );
}
}
-void wxGTKWindowImplDC::SetBackground( const wxBrush &brush )
+void wxWindowDCImpl::SetBackground( const wxBrush &brush )
{
/* CMB 21/7/98: Added SetBackground. Sets background brush
* for Clear() and bg colour for shapes filled with cross-hatch brush */
if (!m_backgroundBrush.IsOk()) return;
- if (!m_window) return;
+ if (!m_gdkwindow) return;
m_backgroundBrush.GetColour().CalcPixel( m_cmap );
gdk_gc_set_background( m_brushGC, m_backgroundBrush.GetColour().GetColor() );
}
}
-void wxGTKWindowImplDC::SetLogicalFunction( int function )
+void wxWindowDCImpl::SetLogicalFunction( int function )
{
wxCHECK_RET( IsOk(), wxT("invalid window dc") );
return;
// VZ: shouldn't this be a CHECK?
- if (!m_window)
+ if (!m_gdkwindow)
return;
GdkFunction mode;
gdk_gc_set_function( m_textGC, mode );
}
-void wxGTKWindowImplDC::SetTextForeground( const wxColour &col )
+void wxWindowDCImpl::SetTextForeground( const wxColour &col )
{
wxCHECK_RET( IsOk(), wxT("invalid window dc") );
m_textForegroundColour = col;
- if ( m_window )
+ if ( m_gdkwindow )
{
m_textForegroundColour.CalcPixel( m_cmap );
gdk_gc_set_foreground( m_textGC, m_textForegroundColour.GetColor() );
}
}
-void wxGTKWindowImplDC::SetTextBackground( const wxColour &col )
+void wxWindowDCImpl::SetTextBackground( const wxColour &col )
{
wxCHECK_RET( IsOk(), wxT("invalid window dc") );
m_textBackgroundColour = col;
- if ( m_window )
+ if ( m_gdkwindow )
{
m_textBackgroundColour.CalcPixel( m_cmap );
gdk_gc_set_background( m_textGC, m_textBackgroundColour.GetColor() );
}
}
-void wxGTKWindowImplDC::SetBackgroundMode( int mode )
+void wxWindowDCImpl::SetBackgroundMode( int mode )
{
wxCHECK_RET( IsOk(), wxT("invalid window dc") );
m_backgroundMode = mode;
- if (!m_window) return;
+ if (!m_gdkwindow) return;
// CMB 21/7/98: fill style of cross-hatch brushes is affected by
// transparent/solid background mode
}
}
-void wxGTKWindowImplDC::SetPalette( const wxPalette& WXUNUSED(palette) )
+void wxWindowDCImpl::SetPalette( const wxPalette& WXUNUSED(palette) )
{
- wxFAIL_MSG( wxT("wxGTKWindowImplDC::SetPalette not implemented") );
+ wxFAIL_MSG( wxT("wxWindowDCImpl::SetPalette not implemented") );
}
-void wxGTKWindowImplDC::DoSetClippingRegion( wxCoord x, wxCoord y, wxCoord width, wxCoord height )
+void wxWindowDCImpl::DoSetClippingRegion( wxCoord x, wxCoord y, wxCoord width, wxCoord height )
{
wxCHECK_RET( IsOk(), wxT("invalid window dc") );
- if (!m_window) return;
+ if (!m_gdkwindow) return;
wxRect rect;
rect.x = XLOG2DEV(x);
rect.width = XLOG2DEVREL(width);
rect.height = YLOG2DEVREL(height);
- if (m_owningWindow && m_owningWindow->m_wxwindow &&
- (m_owningWindow->GetLayoutDirection() == wxLayout_RightToLeft))
+ if (m_window && m_window->m_wxwindow &&
+ (m_window->GetLayoutDirection() == wxLayout_RightToLeft))
{
rect.x -= rect.width;
}
wxCoord xx, yy, ww, hh;
m_currentClippingRegion.GetBox( xx, yy, ww, hh );
#if wxUSE_NEW_DC
- wxGTKImplDC::DoSetClippingRegion( xx, yy, ww, hh );
+ wxGTKDCImpl::DoSetClippingRegion( xx, yy, ww, hh );
#else
wxDC::DoSetClippingRegion( xx, yy, ww, hh );
#endif
gdk_gc_set_clip_region( m_bgGC, m_currentClippingRegion.GetRegion() );
}
-void wxGTKWindowImplDC::DoSetClippingRegionAsRegion( const wxRegion ®ion )
+void wxWindowDCImpl::DoSetClippingRegionAsRegion( const wxRegion ®ion )
{
wxCHECK_RET( IsOk(), wxT("invalid window dc") );
return;
}
- if (!m_window) return;
+ if (!m_gdkwindow) return;
if (!m_currentClippingRegion.IsNull())
m_currentClippingRegion.Intersect( region );
wxCoord xx, yy, ww, hh;
m_currentClippingRegion.GetBox( xx, yy, ww, hh );
#if wxUSE_NEW_DC
- wxGTKImplDC::DoSetClippingRegion( xx, yy, ww, hh );
+ wxGTKDCImpl::DoSetClippingRegion( xx, yy, ww, hh );
#else
wxDC::DoSetClippingRegion( xx, yy, ww, hh );
#endif
gdk_gc_set_clip_region( m_bgGC, m_currentClippingRegion.GetRegion() );
}
-void wxGTKWindowImplDC::DestroyClippingRegion()
+void wxWindowDCImpl::DestroyClippingRegion()
{
wxCHECK_RET( IsOk(), wxT("invalid window dc") );
#if wxUSE_NEW_DC
- wxImplDC::DestroyClippingRegion();
+ wxDCImpl::DestroyClippingRegion();
#else
wxDC::DestroyClippingRegion();
#endif
m_currentClippingRegion.Union( m_paintClippingRegion );
#endif
- if (!m_window) return;
+ if (!m_gdkwindow) return;
if (m_currentClippingRegion.IsEmpty())
{
}
}
-void wxGTKWindowImplDC::Destroy()
+void wxWindowDCImpl::Destroy()
{
if (m_penGC) wxFreePoolGC( m_penGC );
m_penGC = (GdkGC*) NULL;
m_bgGC = (GdkGC*) NULL;
}
-void wxGTKWindowImplDC::SetDeviceOrigin( wxCoord x, wxCoord y )
+void wxWindowDCImpl::SetDeviceOrigin( wxCoord x, wxCoord y )
{
m_deviceOriginX = x;
m_deviceOriginY = y;
ComputeScaleAndOrigin();
}
-void wxGTKWindowImplDC::SetAxisOrientation( bool xLeftRight, bool yBottomUp )
+void wxWindowDCImpl::SetAxisOrientation( bool xLeftRight, bool yBottomUp )
{
m_signX = (xLeftRight ? 1 : -1);
m_signY = (yBottomUp ? -1 : 1);
- if (m_owningWindow && m_owningWindow->m_wxwindow &&
- (m_owningWindow->GetLayoutDirection() == wxLayout_RightToLeft))
+ if (m_window && m_window->m_wxwindow &&
+ (m_window->GetLayoutDirection() == wxLayout_RightToLeft))
m_signX = -m_signX;
ComputeScaleAndOrigin();
}
-void wxGTKWindowImplDC::ComputeScaleAndOrigin()
+void wxWindowDCImpl::ComputeScaleAndOrigin()
{
const wxRealPoint origScale(m_scaleX, m_scaleY);
#if wxUSE_NEW_DC
- wxImplDC::ComputeScaleAndOrigin();
+ wxDCImpl::ComputeScaleAndOrigin();
#else
wxDC::ComputeScaleAndOrigin();
#endif
}
// Resolution in pixels per logical inch
-wxSize wxGTKWindowImplDC::GetPPI() const
+wxSize wxWindowDCImpl::GetPPI() const
{
return wxSize( (int) (m_mm_to_pix_x * 25.4 + 0.5), (int) (m_mm_to_pix_y * 25.4 + 0.5));
}
-int wxGTKWindowImplDC::GetDepth() const
+int wxWindowDCImpl::GetDepth() const
{
- return gdk_drawable_get_depth(m_window);
+ return gdk_drawable_get_depth(m_gdkwindow);
}
//-----------------------------------------------------------------------------
-// wxClientDC
+// wxClientDCImpl
//-----------------------------------------------------------------------------
-#if wxUSE_NEW_DC
-IMPLEMENT_ABSTRACT_CLASS(wxGTKClientImplDC, wxGTKWindowImplDC)
-#else
-IMPLEMENT_ABSTRACT_CLASS(wxClientDC, wxWindowDC)
-#endif
+IMPLEMENT_ABSTRACT_CLASS(wxClientDCImpl, wxWindowDCImpl)
-#if wxUSE_NEW_DC
-wxGTKClientImplDC::wxGTKClientImplDC( wxDC *owner )
- : wxGTKWindowImplDC( owner )
+wxClientDCImpl::wxClientDCImpl( wxDC *owner )
+ : wxWindowDCImpl( owner )
{
}
-wxGTKClientImplDC::wxGTKClientImplDC( wxDC *owner, wxWindow *win )
- : wxGTKWindowImplDC( owner, win )
-#else
-wxClientDC::wxClientDC()
+wxClientDCImpl::wxClientDCImpl( wxDC *owner, wxWindow *win )
+ : wxWindowDCImpl( owner, win )
{
-}
-
-wxClientDC::wxClientDC( wxWindow *win )
- : wxWindowDC( win )
-#endif
-
-{
- wxCHECK_RET( win, _T("NULL window in wxGTKClientImplDC::wxClientDC") );
+ wxCHECK_RET( win, _T("NULL window in wxClientDCImpl::wxClientDC") );
#ifdef __WXUNIVERSAL__
wxPoint ptOrigin = win->GetClientAreaOrigin();
SetDeviceOrigin(ptOrigin.x, ptOrigin.y);
wxSize size = win->GetClientSize();
SetClippingRegion(wxPoint(0, 0), size);
-#endif // __WXUNIVERSAL__
+#endif
+ // __WXUNIVERSAL__
}
-void wxGTKClientImplDC::DoGetSize(int *width, int *height) const
+void wxClientDCImpl::DoGetSize(int *width, int *height) const
{
- wxCHECK_RET( m_owningWindow, _T("GetSize() doesn't work without window") );
+ wxCHECK_RET( m_window, _T("GetSize() doesn't work without window") );
- m_owningWindow->GetClientSize( width, height );
+ m_window->GetClientSize( width, height );
}
//-----------------------------------------------------------------------------
-// wxPaintDC
+// wxPaintDCImpl
//-----------------------------------------------------------------------------
-#if wxUSE_NEW_DC
-IMPLEMENT_ABSTRACT_CLASS(wxGTKPaintImplDC, wxGTKClientImplDC)
-#else
-IMPLEMENT_ABSTRACT_CLASS(wxPaintDC, wxClientDC)
-#endif
+IMPLEMENT_ABSTRACT_CLASS(wxPaintDCImpl, wxClientDCImpl)
// Limit the paint region to the window size. Sometimes
// the paint region is too big, and this risks X11 errors
}
}
-#if wxUSE_NEW_DC
-wxGTKPaintImplDC::wxGTKPaintImplDC( wxDC *owner )
- : wxGTKClientImplDC( owner )
+wxPaintDCImpl::wxPaintDCImpl( wxDC *owner )
+ : wxClientDCImpl( owner )
{
}
-wxGTKPaintImplDC::wxGTKPaintImplDC( wxDC *owner, wxWindow *win )
- : wxGTKClientImplDC( owner, win )
-#else
-wxPaintDC::wxPaintDC()
- : wxClientDC()
-{
-}
-
-wxPaintDC::wxPaintDC( wxWindow *win )
- : wxClientDC( win )
-#endif
+wxPaintDCImpl::wxPaintDCImpl( wxDC *owner, wxWindow *win )
+ : wxClientDCImpl( owner, win )
{
#if USE_PAINT_REGION
if (!win->m_clipPaintRegion)
gdk_gc_set_clip_region( m_textGC, region );
gdk_gc_set_clip_region( m_bgGC, region );
}
-#endif // USE_PAINT_REGION
+#endif
}
// ----------------------------------------------------------------------------
#include "wx/wxprec.h"
#include "wx/dcmemory.h"
+#include "wx/gtk/dcmemory.h"
#include <gdk/gdk.h>
#include <gtk/gtk.h>
//-----------------------------------------------------------------------------
-// wxMemoryDC
+// wxMemoryDCImpl
//-----------------------------------------------------------------------------
-#if wxUSE_NEW_DC
-IMPLEMENT_ABSTRACT_CLASS(wxGTKMemoryImplDC, wxGTKWindowImplDC)
-#else
-IMPLEMENT_ABSTRACT_CLASS(wxMemoryDC,wxWindowDC)
-#endif
+IMPLEMENT_ABSTRACT_CLASS(wxMemoryDCImpl, wxWindowDCImpl)
-#if wxUSE_NEW_DC
-wxGTKMemoryImplDC::wxGTKMemoryImplDC( wxMemoryDC *owner )
- : wxGTKWindowImplDC( owner )
+wxMemoryDCImpl::wxMemoryDCImpl( wxMemoryDC *owner )
+ : wxWindowDCImpl( owner )
{
Init();
}
-wxGTKMemoryImplDC::wxGTKMemoryImplDC( wxMemoryDC *owner, wxBitmap& bitmap)
- : wxGTKWindowImplDC( owner )
+wxMemoryDCImpl::wxMemoryDCImpl( wxMemoryDC *owner, wxBitmap& bitmap)
+ : wxWindowDCImpl( owner )
{
Init();
owner->SelectObject(bitmap);
}
-wxGTKMemoryImplDC::wxGTKMemoryImplDC( wxMemoryDC *owner, wxDC *WXUNUSED(dc) )
- : wxGTKWindowImplDC( owner )
+wxMemoryDCImpl::wxMemoryDCImpl( wxMemoryDC *owner, wxDC *WXUNUSED(dc) )
+ : wxWindowDCImpl( owner )
{
Init();
}
-#else
-wxMemoryDC::wxMemoryDC()
-{
- Init();
-}
-
-wxMemoryDC::wxMemoryDC(wxBitmap& bitmap)
-{
- Init();
- SelectObject(bitmap);
-}
-wxMemoryDC::wxMemoryDC( wxDC *WXUNUSED(dc) )
- : wxWindowDC()
-{
- Init();
-}
-#endif
-
-wxGTKMemoryImplDC::~wxGTKMemoryImplDC()
+wxMemoryDCImpl::~wxMemoryDCImpl()
{
g_object_unref(m_context);
}
-void wxGTKMemoryImplDC::Init()
+void wxMemoryDCImpl::Init()
{
m_ok = false;
m_fontdesc = pango_font_description_copy( pango_context_get_font_description( m_context ) );
}
-void wxGTKMemoryImplDC::DoSelect( const wxBitmap& bitmap )
+void wxMemoryDCImpl::DoSelect( const wxBitmap& bitmap )
{
Destroy();
m_selected = bitmap;
if (m_selected.Ok())
{
- m_window = m_selected.GetPixmap();
+ m_gdkwindow = m_selected.GetPixmap();
m_selected.PurgeOtherRepresentations(wxBitmap::Pixmap);
else
{
m_ok = false;
- m_window = (GdkWindow *) NULL;
+ m_gdkwindow = (GdkWindow *) NULL;
}
}
-void wxGTKMemoryImplDC::SetPen( const wxPen& penOrig )
+void wxMemoryDCImpl::SetPen( const wxPen& penOrig )
{
wxPen pen( penOrig );
if ( m_selected.Ok() &&
pen.SetColour( pen.GetColour() == *wxWHITE ? *wxBLACK : *wxWHITE );
}
- wxGTKWindowImplDC::SetPen( pen );
+ wxWindowDCImpl::SetPen( pen );
}
-void wxGTKMemoryImplDC::SetBrush( const wxBrush& brushOrig )
+void wxMemoryDCImpl::SetBrush( const wxBrush& brushOrig )
{
wxBrush brush( brushOrig );
if ( m_selected.Ok() &&
brush.SetColour( brush.GetColour() == *wxWHITE ? *wxBLACK : *wxWHITE);
}
- wxGTKWindowImplDC::SetBrush( brush );
+ wxWindowDCImpl::SetBrush( brush );
}
-void wxGTKMemoryImplDC::SetBackground( const wxBrush& brushOrig )
+void wxMemoryDCImpl::SetBackground( const wxBrush& brushOrig )
{
wxBrush brush(brushOrig);
brush.SetColour( brush.GetColour() == *wxWHITE ? *wxBLACK : *wxWHITE );
}
- wxGTKWindowImplDC::SetBackground( brush );
+ wxWindowDCImpl::SetBackground( brush );
}
-void wxGTKMemoryImplDC::SetTextForeground( const wxColour& col )
+void wxMemoryDCImpl::SetTextForeground( const wxColour& col )
{
if ( m_selected.Ok() && m_selected.GetDepth() == 1 )
- {
- wxGTKWindowImplDC::SetTextForeground( col == *wxWHITE ? *wxBLACK : *wxWHITE);
- }
+ wxWindowDCImpl::SetTextForeground( col == *wxWHITE ? *wxBLACK : *wxWHITE);
else
- {
- wxGTKWindowImplDC::SetTextForeground( col );
- }
+ wxWindowDCImpl::SetTextForeground( col );
}
-void wxGTKMemoryImplDC::SetTextBackground( const wxColour &col )
+void wxMemoryDCImpl::SetTextBackground( const wxColour &col )
{
if (m_selected.Ok() && m_selected.GetDepth() == 1)
- {
- wxGTKWindowImplDC::SetTextBackground( col == *wxWHITE ? *wxBLACK : *wxWHITE );
- }
+ wxWindowDCImpl::SetTextBackground( col == *wxWHITE ? *wxBLACK : *wxWHITE );
else
- {
- wxGTKWindowImplDC::SetTextBackground( col );
- }
+ wxWindowDCImpl::SetTextBackground( col );
}
-void wxGTKMemoryImplDC::DoGetSize( int *width, int *height ) const
+void wxMemoryDCImpl::DoGetSize( int *width, int *height ) const
{
if (m_selected.Ok())
{
}
}
-wxBitmap wxGTKMemoryImplDC::DoGetAsBitmap(const wxRect *subrect) const
+wxBitmap wxMemoryDCImpl::DoGetAsBitmap(const wxRect *subrect) const
{
wxBitmap bmp = GetSelectedBitmap();
return subrect ? bmp.GetSubBitmap(*subrect) : bmp;
}
-const wxBitmap& wxGTKMemoryImplDC::GetSelectedBitmap() const
+const wxBitmap& wxMemoryDCImpl::GetSelectedBitmap() const
{
return m_selected;
}
-wxBitmap& wxGTKMemoryImplDC::GetSelectedBitmap()
+wxBitmap& wxMemoryDCImpl::GetSelectedBitmap()
{
return m_selected;
}
#include "wx/wxprec.h"
#include "wx/dcscreen.h"
+#include "wx/gtk/dcscreen.h"
#ifndef WX_PRECOMP
#include "wx/window.h"
#include <gdk/gdkx.h>
#include <gtk/gtk.h>
-
//-----------------------------------------------------------------------------
-// wxScreenDC
+// wxScreenDCImpl
//-----------------------------------------------------------------------------
-#if wxUSE_NEW_DC
-IMPLEMENT_ABSTRACT_CLASS(wxGTKScreenImplDC, wxGTKWindowImplDC)
-#else
-IMPLEMENT_ABSTRACT_CLASS(wxScreenDC,wxWindowDC)
-#endif
+IMPLEMENT_ABSTRACT_CLASS(wxScreenDCImpl, wxWindowDCImpl)
-#if wxUSE_NEW_DC
-wxGTKScreenImplDC::wxGTKScreenImplDC( wxScreenDC *owner )
- : wxGTKWindowImplDC( owner )
+wxScreenDCImpl::wxScreenDCImpl( wxScreenDC *owner )
+ : wxWindowDCImpl( owner )
{
Init();
}
-#else
-wxScreenDC::wxScreenDC()
-{
- Init();
-}
-#endif
-
-void wxGTKScreenImplDC::Init()
+void wxScreenDCImpl::Init()
{
m_ok = false;
m_cmap = gdk_colormap_get_system();
- m_window = gdk_get_default_root_window();
+ m_gdkwindow = gdk_get_default_root_window();
m_context = gdk_pango_context_get();
// Note: The Sun customised version of Pango shipping with Solaris 10
gdk_gc_set_subwindow( m_bgGC, GDK_INCLUDE_INFERIORS );
}
-wxGTKScreenImplDC::~wxGTKScreenImplDC()
+wxScreenDCImpl::~wxScreenDCImpl()
{
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_bgGC, GDK_CLIP_BY_CHILDREN );
}
-void wxGTKScreenImplDC::DoGetSize(int *width, int *height) const
+void wxScreenDCImpl::DoGetSize(int *width, int *height) const
{
wxDisplaySize(width, height);
}
#if wxUSE_NEW_DC
-wxImplDC* wxGnomePrintFactory::CreatePrinterImplDC( wxPrinterDC *owner, const wxPrintData& data )
+wxDCImpl* wxGnomePrintFactory::CreatePrinterDCImpl( wxPrinterDC *owner, const wxPrintData& data )
{
- return new wxGnomePrinterImplDC( owner, data );
+ return new wxGnomePrinterDCImpl( owner, data );
}
#else
#define YLOG2DEVREL(x) ((double)(LogicalToDeviceYRel(x)) * DEV2PS)
#if wxUSE_NEW_DC
-IMPLEMENT_ABSTRACT_CLASS(wxGnomePrinterImplDC, wxImplDC)
+IMPLEMENT_ABSTRACT_CLASS(wxGnomePrinterDCImpl, wxDCImpl)
#else
IMPLEMENT_ABSTRACT_CLASS(wxGnomePrinterDC, wxDC)
#endif
#if wxUSE_NEW_DC
-wxGnomePrinterImplDC::wxGnomePrinterImplDC( wxPrinterDC *owner, const wxPrintData& data ) :
- wxImplDC( owner )
+wxGnomePrinterDCImpl::wxGnomePrinterDCImpl( wxPrinterDC *owner, const wxPrintData& data ) :
+ wxDCImpl( owner )
#else
wxGnomePrinterDC::wxGnomePrinterDC( const wxPrintData& data )
#endif
m_pageHeight = ph * PS2DEV;
}
-wxGnomePrinterImplDC::~wxGnomePrinterImplDC()
+wxGnomePrinterDCImpl::~wxGnomePrinterDCImpl()
{
}
-bool wxGnomePrinterImplDC::IsOk() const
+bool wxGnomePrinterDCImpl::IsOk() const
{
return true;
}
bool
-wxGnomePrinterImplDC::DoFloodFill(wxCoord WXUNUSED(x1),
+wxGnomePrinterDCImpl::DoFloodFill(wxCoord WXUNUSED(x1),
wxCoord WXUNUSED(y1),
const wxColour& WXUNUSED(col),
int WXUNUSED(style))
}
bool
-wxGnomePrinterImplDC::DoGetPixel(wxCoord WXUNUSED(x1),
+wxGnomePrinterDCImpl::DoGetPixel(wxCoord WXUNUSED(x1),
wxCoord WXUNUSED(y1),
wxColour * WXUNUSED(col)) const
{
return false;
}
-void wxGnomePrinterImplDC::DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2)
+void wxGnomePrinterDCImpl::DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2)
{
if (m_pen.GetStyle() == wxTRANSPARENT) return;
CalcBoundingBox( x2, y2 );
}
-void wxGnomePrinterImplDC::DoCrossHair(wxCoord WXUNUSED(x), wxCoord WXUNUSED(y))
+void wxGnomePrinterDCImpl::DoCrossHair(wxCoord WXUNUSED(x), wxCoord WXUNUSED(y))
{
}
-void wxGnomePrinterImplDC::DoDrawArc(wxCoord x1,wxCoord y1,wxCoord x2,wxCoord y2,wxCoord xc,wxCoord yc)
+void wxGnomePrinterDCImpl::DoDrawArc(wxCoord x1,wxCoord y1,wxCoord x2,wxCoord y2,wxCoord xc,wxCoord yc)
{
double dx = x1 - xc;
double dy = y1 - yc;
CalcBoundingBox (xc, yc);
}
-void wxGnomePrinterImplDC::DoDrawEllipticArc(wxCoord x,wxCoord y,wxCoord w,wxCoord h,double sa,double ea)
+void wxGnomePrinterDCImpl::DoDrawEllipticArc(wxCoord x,wxCoord y,wxCoord w,wxCoord h,double sa,double ea)
{
x += w/2;
y += h/2;
CalcBoundingBox( x+w, y+h );
}
-void wxGnomePrinterImplDC::DoDrawPoint(wxCoord WXUNUSED(x), wxCoord WXUNUSED(y))
+void wxGnomePrinterDCImpl::DoDrawPoint(wxCoord WXUNUSED(x), wxCoord WXUNUSED(y))
{
}
-void wxGnomePrinterImplDC::DoDrawLines(int n, wxPoint points[], wxCoord xoffset, wxCoord yoffset)
+void wxGnomePrinterDCImpl::DoDrawLines(int n, wxPoint points[], wxCoord xoffset, wxCoord yoffset)
{
if (m_pen.GetStyle() == wxTRANSPARENT) return;
gs_libGnomePrint->gnome_print_stroke ( m_gpc);
}
-void wxGnomePrinterImplDC::DoDrawPolygon(int n, wxPoint points[],
+void wxGnomePrinterDCImpl::DoDrawPolygon(int n, wxPoint points[],
wxCoord xoffset, wxCoord yoffset,
int WXUNUSED(fillStyle))
{
}
}
-void wxGnomePrinterImplDC::DoDrawPolyPolygon(int n, int count[], wxPoint points[], wxCoord xoffset, wxCoord yoffset, int fillStyle)
+void wxGnomePrinterDCImpl::DoDrawPolyPolygon(int n, int count[], wxPoint points[], wxCoord xoffset, wxCoord yoffset, int fillStyle)
{
#if wxUSE_NEW_DC
- wxImplDC::DoDrawPolyPolygon( n, count, points, xoffset, yoffset, fillStyle );
+ wxDCImpl::DoDrawPolyPolygon( n, count, points, xoffset, yoffset, fillStyle );
#else
wxDC::DoDrawPolyPolygon( n, count, points, xoffset, yoffset, fillStyle );
#endif
}
-void wxGnomePrinterImplDC::DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
+void wxGnomePrinterDCImpl::DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
{
width--;
height--;
}
}
-void wxGnomePrinterImplDC::DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius)
+void wxGnomePrinterDCImpl::DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius)
{
width--;
height--;
}
}
-void wxGnomePrinterImplDC::makeEllipticalPath(wxCoord x, wxCoord y,
+void wxGnomePrinterDCImpl::makeEllipticalPath(wxCoord x, wxCoord y,
wxCoord width, wxCoord height)
{
double r = 4 * (sqrt(2.) - 1) / 3;
gs_libGnomePrint->gnome_print_closepath(m_gpc);
}
-void wxGnomePrinterImplDC::DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
+void wxGnomePrinterDCImpl::DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
{
width--;
height--;
}
#if wxUSE_SPLINES
-void wxGnomePrinterImplDC::DoDrawSpline(const wxPointList *points)
+void wxGnomePrinterDCImpl::DoDrawSpline(const wxPointList *points)
{
SetPen (m_pen);
#endif // wxUSE_SPLINES
bool
-wxGnomePrinterImplDC::DoBlit(wxCoord xdest, wxCoord ydest,
+wxGnomePrinterDCImpl::DoBlit(wxCoord xdest, wxCoord ydest,
wxCoord width, wxCoord height,
wxDC *source,
wxCoord xsrc, wxCoord ysrc,
return true;
}
-void wxGnomePrinterImplDC::DoDrawIcon( const wxIcon& icon, wxCoord x, wxCoord y )
+void wxGnomePrinterDCImpl::DoDrawIcon( const wxIcon& icon, wxCoord x, wxCoord y )
{
DoDrawBitmap( icon, x, y, true );
}
void
-wxGnomePrinterImplDC::DoDrawBitmap(const wxBitmap& bitmap,
+wxGnomePrinterDCImpl::DoDrawBitmap(const wxBitmap& bitmap,
wxCoord x, wxCoord y,
bool WXUNUSED(useMask))
{
}
}
-void wxGnomePrinterImplDC::DoDrawText(const wxString& text, wxCoord x, wxCoord y )
+void wxGnomePrinterDCImpl::DoDrawText(const wxString& text, wxCoord x, wxCoord y )
{
DoDrawRotatedText( text, x, y, 0.0 );
}
-void wxGnomePrinterImplDC::DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y, double angle)
+void wxGnomePrinterDCImpl::DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y, double angle)
{
double xx = XLOG2DEV(x);
double yy = YLOG2DEV(y);
CalcBoundingBox (x + w, y + h);
}
-void wxGnomePrinterImplDC::Clear()
+void wxGnomePrinterDCImpl::Clear()
{
}
-void wxGnomePrinterImplDC::SetFont( const wxFont& font )
+void wxGnomePrinterDCImpl::SetFont( const wxFont& font )
{
m_font = font;
}
}
-void wxGnomePrinterImplDC::SetPen( const wxPen& pen )
+void wxGnomePrinterDCImpl::SetPen( const wxPen& pen )
{
if (!pen.Ok()) return;
}
}
-void wxGnomePrinterImplDC::SetBrush( const wxBrush& brush )
+void wxGnomePrinterDCImpl::SetBrush( const wxBrush& brush )
{
if (!brush.Ok()) return;
}
}
-void wxGnomePrinterImplDC::SetLogicalFunction(int WXUNUSED(function))
+void wxGnomePrinterDCImpl::SetLogicalFunction(int WXUNUSED(function))
{
}
-void wxGnomePrinterImplDC::SetBackground(const wxBrush& WXUNUSED(brush))
+void wxGnomePrinterDCImpl::SetBackground(const wxBrush& WXUNUSED(brush))
{
}
-void wxGnomePrinterImplDC::DoSetClippingRegion(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
+void wxGnomePrinterDCImpl::DoSetClippingRegion(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
{
#if wxUSE_NEW_DC
m_clipping = TRUE; // TODO move somewhere else
gs_libGnomePrint->gnome_print_clip( m_gpc );
}
-void wxGnomePrinterImplDC::DestroyClippingRegion()
+void wxGnomePrinterDCImpl::DestroyClippingRegion()
{
#if wxUSE_NEW_DC
- wxImplDC::DestroyClippingRegion();
+ wxDCImpl::DestroyClippingRegion();
#else
wxDC::DestroyClippingRegion();
#endif
#endif
}
-bool wxGnomePrinterImplDC::StartDoc(const wxString& WXUNUSED(message))
+bool wxGnomePrinterDCImpl::StartDoc(const wxString& WXUNUSED(message))
{
return true;
}
-void wxGnomePrinterImplDC::EndDoc()
+void wxGnomePrinterDCImpl::EndDoc()
{
gs_libGnomePrint->gnome_print_end_doc( m_gpc );
}
-void wxGnomePrinterImplDC::StartPage()
+void wxGnomePrinterDCImpl::StartPage()
{
gs_libGnomePrint->gnome_print_beginpage( m_gpc, (const guchar*) "page" );
}
-void wxGnomePrinterImplDC::EndPage()
+void wxGnomePrinterDCImpl::EndPage()
{
gs_libGnomePrint->gnome_print_showpage( m_gpc );
}
-wxCoord wxGnomePrinterImplDC::GetCharHeight() const
+wxCoord wxGnomePrinterDCImpl::GetCharHeight() const
{
pango_layout_set_text( m_layout, "H", 1 );
return h;
}
-wxCoord wxGnomePrinterImplDC::GetCharWidth() const
+wxCoord wxGnomePrinterDCImpl::GetCharWidth() const
{
pango_layout_set_text( m_layout, "H", 1 );
return w;
}
-void wxGnomePrinterImplDC::DoGetTextExtent(const wxString& string, wxCoord *width, wxCoord *height,
+void wxGnomePrinterDCImpl::DoGetTextExtent(const wxString& string, wxCoord *width, wxCoord *height,
wxCoord *descent,
wxCoord *externalLeading,
const wxFont *theFont ) const
pango_layout_set_font_description( m_layout, m_fontdesc );
}
-void wxGnomePrinterImplDC::DoGetSize(int* width, int* height) const
+void wxGnomePrinterDCImpl::DoGetSize(int* width, int* height) const
{
wxGnomePrintNativeData *native =
(wxGnomePrintNativeData*) m_printData.GetNativeData();
*height = wxRound( ph * PS2DEV );
}
-void wxGnomePrinterImplDC::DoGetSizeMM(int *width, int *height) const
+void wxGnomePrinterDCImpl::DoGetSizeMM(int *width, int *height) const
{
wxGnomePrintNativeData *native =
(wxGnomePrintNativeData*) m_printData.GetNativeData();
*height = (int) (ph + 0.5);
}
-wxSize wxGnomePrinterImplDC::GetPPI() const
+wxSize wxGnomePrinterDCImpl::GetPPI() const
{
return wxSize(DPI,DPI);
}
-void wxGnomePrinterImplDC::SetPrintData(const wxPrintData& data)
+void wxGnomePrinterDCImpl::SetPrintData(const wxPrintData& data)
{
m_printData = data;
// overridden for wxPrinterDC Impl
-int wxGnomePrinterImplDC::GetResolution()
+int wxGnomePrinterDCImpl::GetResolution()
{
return DPI;
}
-wxRect wxGnomePrinterImplDC::GetPaperRect()
+wxRect wxGnomePrinterDCImpl::GetPaperRect()
{
// GNOME print doesn't support printer margins
int w = 0;
wxSize sizeDevUnits(paper->GetSizeDeviceUnits());
- // TODO: get better resolution information from wxGnomePrinterImplDC, if possible.
+ // TODO: get better resolution information from wxGnomePrinterDCImpl, if possible.
sizeDevUnits.x = (wxCoord)((float)sizeDevUnits.x * resolution / 72.0);
sizeDevUnits.y = (wxCoord)((float)sizeDevUnits.y * resolution / 72.0);
#if wxUSE_MINIFRAME
#include "wx/minifram.h"
+#include "wx/gtk/dcclient.h"
#ifndef WX_PRECOMP
#include "wx/settings.h"
wxClientDC dc(win);
-#if wxUSE_NEW_DC
- wxImplDC *impl = dc.GetImpl();
- wxGTKClientImplDC *client_impl = wxDynamicCast( impl, wxGTKClientImplDC );
- // Hack alert
- client_impl->m_window = widget->window;
-#else
- // Hack alert
- dc.m_window = widget->window;
-#endif
+ wxDCImpl *impl = dc.GetImpl();
+ wxClientDCImpl *gtk_impl = wxDynamicCast( impl, wxClientDCImpl );
+ gtk_impl->m_gdkwindow = widget->window; // Hack alert
if (style & wxRESIZE_BORDER)
{
#if wxUSE_NEW_DC
-wxImplDC* wxGtkPrintFactory::CreatePrinterImplDC( wxPrinterDC *owner, const wxPrintData& data )
+wxDCImpl* wxGtkPrintFactory::CreatePrinterDCImpl( wxPrinterDC *owner, const wxPrintData& data )
{
- return new wxGtkPrinterImplDC( owner, data );
+ return new wxGtkPrinterDCImpl( owner, data );
}
#else
#if wxUSE_NEW_DC
-IMPLEMENT_ABSTRACT_CLASS(wxGtkPrinterImplDC, wxImplDC)
+IMPLEMENT_ABSTRACT_CLASS(wxGtkPrinterDCImpl, wxDCImpl)
#else
IMPLEMENT_ABSTRACT_CLASS(wxGtkPrinterDC, wxDC)
#endif
#if wxUSE_NEW_DC
-wxGtkPrinterImplDC::wxGtkPrinterImplDC( wxPrinterDC *owner, const wxPrintData& data ) :
- wxImplDC( owner )
+wxGtkPrinterDCImpl::wxGtkPrinterDCImpl( wxPrinterDC *owner, const wxPrintData& data ) :
+ wxDCImpl( owner )
#else
wxGtkPrinterDC::wxGtkPrinterDC( const wxPrintData& data )
#endif
gs_cairo->cairo_translate(m_cairo, -ml, -mt);
}
-wxGtkPrinterImplDC::~wxGtkPrinterImplDC()
+wxGtkPrinterDCImpl::~wxGtkPrinterDCImpl()
{
g_object_unref(m_context);
g_object_unref(m_layout);
}
-bool wxGtkPrinterImplDC::IsOk() const
+bool wxGtkPrinterDCImpl::IsOk() const
{
return m_gpc != NULL;
}
-bool wxGtkPrinterImplDC::DoFloodFill(wxCoord WXUNUSED(x1),
+bool wxGtkPrinterDCImpl::DoFloodFill(wxCoord WXUNUSED(x1),
wxCoord WXUNUSED(y1),
const wxColour& WXUNUSED(col),
int WXUNUSED(style))
return false;
}
-void wxGtkPrinterImplDC::DoGradientFillConcentric(const wxRect& rect, const wxColour& initialColour, const wxColour& destColour, const wxPoint& circleCenter)
+void wxGtkPrinterDCImpl::DoGradientFillConcentric(const wxRect& rect, const wxColour& initialColour, const wxColour& destColour, const wxPoint& circleCenter)
{
wxCoord xC = circleCenter.x;
wxCoord yC = circleCenter.y;
CalcBoundingBox(xR+w, yR+h);
}
-void wxGtkPrinterImplDC::DoGradientFillLinear(const wxRect& rect, const wxColour& initialColour, const wxColour& destColour, wxDirection nDirection)
+void wxGtkPrinterDCImpl::DoGradientFillLinear(const wxRect& rect, const wxColour& initialColour, const wxColour& destColour, wxDirection nDirection)
{
wxCoord x = rect.x;
wxCoord y = rect.y;
CalcBoundingBox(x+w, y+h);
}
-bool wxGtkPrinterImplDC::DoGetPixel(wxCoord WXUNUSED(x1),
+bool wxGtkPrinterDCImpl::DoGetPixel(wxCoord WXUNUSED(x1),
wxCoord WXUNUSED(y1),
wxColour * WXUNUSED(col)) const
{
return false;
}
-void wxGtkPrinterImplDC::DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2)
+void wxGtkPrinterDCImpl::DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2)
{
if (m_pen.GetStyle() == wxTRANSPARENT) return;
CalcBoundingBox( x2, y2 );
}
-void wxGtkPrinterImplDC::DoCrossHair(wxCoord x, wxCoord y)
+void wxGtkPrinterDCImpl::DoCrossHair(wxCoord x, wxCoord y)
{
int w, h;
DoGetSize(&w, &h);
CalcBoundingBox( w, h );
}
-void wxGtkPrinterImplDC::DoDrawArc(wxCoord x1,wxCoord y1,wxCoord x2,wxCoord y2,wxCoord xc,wxCoord yc)
+void wxGtkPrinterDCImpl::DoDrawArc(wxCoord x1,wxCoord y1,wxCoord x2,wxCoord y2,wxCoord xc,wxCoord yc)
{
double dx = x1 - xc;
double dy = y1 - yc;
CalcBoundingBox (x2, y2);
}
-void wxGtkPrinterImplDC::DoDrawEllipticArc(wxCoord x,wxCoord y,wxCoord w,wxCoord h,double sa,double ea)
+void wxGtkPrinterDCImpl::DoDrawEllipticArc(wxCoord x,wxCoord y,wxCoord w,wxCoord h,double sa,double ea)
{
gs_cairo->cairo_save( m_cairo );
CalcBoundingBox( x+w, y+h );
}
-void wxGtkPrinterImplDC::DoDrawPoint(wxCoord x, wxCoord y)
+void wxGtkPrinterDCImpl::DoDrawPoint(wxCoord x, wxCoord y)
{
if (m_pen.GetStyle() == wxTRANSPARENT) return;
CalcBoundingBox( x, y );
}
-void wxGtkPrinterImplDC::DoDrawLines(int n, wxPoint points[], wxCoord xoffset, wxCoord yoffset)
+void wxGtkPrinterDCImpl::DoDrawLines(int n, wxPoint points[], wxCoord xoffset, wxCoord yoffset)
{
if (m_pen.GetStyle() == wxTRANSPARENT) return;
gs_cairo->cairo_stroke ( m_cairo);
}
-void wxGtkPrinterImplDC::DoDrawPolygon(int n, wxPoint points[], wxCoord xoffset, wxCoord yoffset, int fillStyle)
+void wxGtkPrinterDCImpl::DoDrawPolygon(int n, wxPoint points[], wxCoord xoffset, wxCoord yoffset, int fillStyle)
{
if (n==0) return;
gs_cairo->cairo_restore(m_cairo);
}
-void wxGtkPrinterImplDC::DoDrawPolyPolygon(int n, int count[], wxPoint points[], wxCoord xoffset, wxCoord yoffset, int fillStyle)
+void wxGtkPrinterDCImpl::DoDrawPolyPolygon(int n, int count[], wxPoint points[], wxCoord xoffset, wxCoord yoffset, int fillStyle)
{
#if wxUSE_NEW_DC
- wxImplDC::DoDrawPolyPolygon( n, count, points, xoffset, yoffset, fillStyle );
+ wxDCImpl::DoDrawPolyPolygon( n, count, points, xoffset, yoffset, fillStyle );
#else
wxDC::DoDrawPolyPolygon( n, count, points, xoffset, yoffset, fillStyle );
#endif
}
-void wxGtkPrinterImplDC::DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
+void wxGtkPrinterDCImpl::DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
{
width--;
height--;
CalcBoundingBox( x + width, y + height );
}
-void wxGtkPrinterImplDC::DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius)
+void wxGtkPrinterDCImpl::DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius)
{
width--;
height--;
CalcBoundingBox(x+width,y+height);
}
-void wxGtkPrinterImplDC::DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
+void wxGtkPrinterDCImpl::DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
{
width--;
height--;
}
#if wxUSE_SPLINES
-void wxGtkPrinterImplDC::DoDrawSpline(const wxPointList *points)
+void wxGtkPrinterDCImpl::DoDrawSpline(const wxPointList *points)
{
SetPen (m_pen);
}
#endif // wxUSE_SPLINES
-bool wxGtkPrinterImplDC::DoBlit(wxCoord xdest, wxCoord ydest,
+bool wxGtkPrinterDCImpl::DoBlit(wxCoord xdest, wxCoord ydest,
wxCoord width, wxCoord height,
wxDC *source, wxCoord xsrc, wxCoord ysrc,
int rop, bool useMask,
return true;
}
-void wxGtkPrinterImplDC::DoDrawIcon( const wxIcon& icon, wxCoord x, wxCoord y )
+void wxGtkPrinterDCImpl::DoDrawIcon( const wxIcon& icon, wxCoord x, wxCoord y )
{
DoDrawBitmap( icon, x, y, true );
}
-void wxGtkPrinterImplDC::DoDrawBitmap( const wxBitmap& bitmap, wxCoord x, wxCoord y, bool useMask )
+void wxGtkPrinterDCImpl::DoDrawBitmap( const wxBitmap& bitmap, wxCoord x, wxCoord y, bool useMask )
{
- wxCHECK_RET( bitmap.IsOk(), wxT("Invalid bitmap in wxGtkPrinterImplDC::DoDrawBitmap"));
+ wxCHECK_RET( bitmap.IsOk(), wxT("Invalid bitmap in wxGtkPrinterDCImpl::DoDrawBitmap"));
cairo_surface_t* surface;
x = wxCoord(XLOG2DEV(x));
gs_cairo->cairo_restore(m_cairo);
}
-void wxGtkPrinterImplDC::DoDrawText(const wxString& text, wxCoord x, wxCoord y )
+void wxGtkPrinterDCImpl::DoDrawText(const wxString& text, wxCoord x, wxCoord y )
{
DoDrawRotatedText( text, x, y, 0.0 );
}
-void wxGtkPrinterImplDC::DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y, double angle)
+void wxGtkPrinterDCImpl::DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y, double angle)
{
double xx = XLOG2DEV(x);
double yy = YLOG2DEV(y);
CalcBoundingBox (x + w, y + h);
}
-void wxGtkPrinterImplDC::Clear()
+void wxGtkPrinterDCImpl::Clear()
{
// Clear does nothing for printing, but keep the code
// for later reuse
*/
}
-void wxGtkPrinterImplDC::SetFont( const wxFont& font )
+void wxGtkPrinterDCImpl::SetFont( const wxFont& font )
{
m_font = font;
}
}
-void wxGtkPrinterImplDC::SetPen( const wxPen& pen )
+void wxGtkPrinterDCImpl::SetPen( const wxPen& pen )
{
if (!pen.Ok()) return;
}
}
-void wxGtkPrinterImplDC::SetBrush( const wxBrush& brush )
+void wxGtkPrinterDCImpl::SetBrush( const wxBrush& brush )
{
if (!brush.Ok()) return;
}
}
-void wxGtkPrinterImplDC::SetLogicalFunction( int function )
+void wxGtkPrinterDCImpl::SetLogicalFunction( int function )
{
if (function == wxCLEAR)
gs_cairo->cairo_set_operator (m_cairo, CAIRO_OPERATOR_CLEAR);
gs_cairo->cairo_set_operator (m_cairo, CAIRO_OPERATOR_SOURCE);
}
-void wxGtkPrinterImplDC::SetBackground( const wxBrush& brush )
+void wxGtkPrinterDCImpl::SetBackground( const wxBrush& brush )
{
m_backgroundBrush = brush;
gs_cairo->cairo_save(m_cairo);
gs_cairo->cairo_restore(m_cairo);
}
-void wxGtkPrinterImplDC::SetBackgroundMode(int mode)
+void wxGtkPrinterDCImpl::SetBackgroundMode(int mode)
{
if (mode == wxSOLID)
m_backgroundMode = wxSOLID;
m_backgroundMode = wxTRANSPARENT;
}
-void wxGtkPrinterImplDC::DoSetClippingRegion(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
+void wxGtkPrinterDCImpl::DoSetClippingRegion(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
{
gs_cairo->cairo_rectangle ( m_cairo, XLOG2DEV(x), YLOG2DEV(y), XLOG2DEVREL(width), YLOG2DEVREL(height));
gs_cairo->cairo_clip(m_cairo);
}
-void wxGtkPrinterImplDC::DestroyClippingRegion()
+void wxGtkPrinterDCImpl::DestroyClippingRegion()
{
gs_cairo->cairo_reset_clip(m_cairo);
}
-bool wxGtkPrinterImplDC::StartDoc(const wxString& WXUNUSED(message))
+bool wxGtkPrinterDCImpl::StartDoc(const wxString& WXUNUSED(message))
{
return true;
}
-void wxGtkPrinterImplDC::EndDoc()
+void wxGtkPrinterDCImpl::EndDoc()
{
return;
}
-void wxGtkPrinterImplDC::StartPage()
+void wxGtkPrinterDCImpl::StartPage()
{
return;
}
-void wxGtkPrinterImplDC::EndPage()
+void wxGtkPrinterDCImpl::EndPage()
{
return;
}
-wxCoord wxGtkPrinterImplDC::GetCharHeight() const
+wxCoord wxGtkPrinterDCImpl::GetCharHeight() const
{
pango_layout_set_text( m_layout, "H", 1 );
return wxRound( h * m_PS2DEV );
}
-wxCoord wxGtkPrinterImplDC::GetCharWidth() const
+wxCoord wxGtkPrinterDCImpl::GetCharWidth() const
{
pango_layout_set_text( m_layout, "H", 1 );
return wxRound( w * m_PS2DEV );
}
-void wxGtkPrinterImplDC::DoGetTextExtent(const wxString& string, wxCoord *width, wxCoord *height,
+void wxGtkPrinterDCImpl::DoGetTextExtent(const wxString& string, wxCoord *width, wxCoord *height,
wxCoord *descent,
wxCoord *externalLeading,
const wxFont *theFont ) const
pango_layout_set_font_description( m_layout, m_fontdesc );
}
-void wxGtkPrinterImplDC::DoGetSize(int* width, int* height) const
+void wxGtkPrinterDCImpl::DoGetSize(int* width, int* height) const
{
GtkPageSetup *setup = gtk_print_context_get_page_setup( m_gpc );
*height = wxRound( gtk_page_setup_get_paper_height( setup, GTK_UNIT_POINTS ) * m_PS2DEV );
}
-void wxGtkPrinterImplDC::DoGetSizeMM(int *width, int *height) const
+void wxGtkPrinterDCImpl::DoGetSizeMM(int *width, int *height) const
{
GtkPageSetup *setup = gtk_print_context_get_page_setup( m_gpc );
*height = wxRound( gtk_page_setup_get_paper_height( setup, GTK_UNIT_MM ) );
}
-wxSize wxGtkPrinterImplDC::GetPPI() const
+wxSize wxGtkPrinterDCImpl::GetPPI() const
{
return wxSize( (int)m_resolution, (int)m_resolution );
}
-void wxGtkPrinterImplDC::SetPrintData(const wxPrintData& data)
+void wxGtkPrinterDCImpl::SetPrintData(const wxPrintData& data)
{
m_printData = data;
}
// overriden for wxPrinterDC Impl
-wxRect wxGtkPrinterImplDC::GetPaperRect()
+wxRect wxGtkPrinterDCImpl::GetPaperRect()
{
// Does GtkPrint support printer margins?
int w = 0;
return wxRect( 0,0,w,h );
}
-int wxGtkPrinterImplDC::GetResolution()
+int wxGtkPrinterDCImpl::GetResolution()
{
return m_resolution;
}
#include "wx/module.h"
#endif
+#include "wx/gtk/dc.h"
+
#include <gtk/gtk.h>
// ----------------------------------------------------------------------------
GdkWindow* gdk_window = NULL;
#if wxUSE_NEW_DC
- wxImplDC *impl = dc.GetImpl();
- wxGTKImplDC *gtk_impl = wxDynamicCast( impl, wxGTKImplDC );
+ wxDCImpl *impl = dc.GetImpl();
+ wxGTKDCImpl *gtk_impl = wxDynamicCast( impl, wxGTKDCImpl );
if (gtk_impl)
gdk_window = gtk_impl->GetGDKWindow();
#else
GdkWindow* gdk_window = NULL;
#if wxUSE_NEW_DC
- wxImplDC *impl = dc.GetImpl();
- wxGTKImplDC *gtk_impl = wxDynamicCast( impl, wxGTKImplDC );
+ wxDCImpl *impl = dc.GetImpl();
+ wxGTKDCImpl *gtk_impl = wxDynamicCast( impl, wxGTKDCImpl );
if (gtk_impl)
gdk_window = gtk_impl->GetGDKWindow();
#else
GdkWindow* gdk_window = NULL;
#if wxUSE_NEW_DC
- wxImplDC *impl = dc.GetImpl();
- wxGTKImplDC *gtk_impl = wxDynamicCast( impl, wxGTKImplDC );
+ wxDCImpl *impl = dc.GetImpl();
+ wxGTKDCImpl *gtk_impl = wxDynamicCast( impl, wxGTKDCImpl );
if (gtk_impl)
gdk_window = gtk_impl->GetGDKWindow();
#else
// are derived from it) and use its m_window.
GdkWindow* gdk_window = NULL;
#if wxUSE_NEW_DC
- wxImplDC *impl = dc.GetImpl();
- wxGTKImplDC *gtk_impl = wxDynamicCast( impl, wxGTKImplDC );
+ wxDCImpl *impl = dc.GetImpl();
+ wxGTKDCImpl *gtk_impl = wxDynamicCast( impl, wxGTKDCImpl );
if (gtk_impl)
gdk_window = gtk_impl->GetGDKWindow();
#else
GdkWindow* gdk_window = NULL;
#if wxUSE_NEW_DC
- wxImplDC *impl = dc.GetImpl();
- wxGTKImplDC *gtk_impl = wxDynamicCast( impl, wxGTKImplDC );
+ wxDCImpl *impl = dc.GetImpl();
+ wxGTKDCImpl *gtk_impl = wxDynamicCast( impl, wxGTKDCImpl );
if (gtk_impl)
gdk_window = gtk_impl->GetGDKWindow();
#else
GdkWindow* gdk_window = NULL;
#if wxUSE_NEW_DC
- wxImplDC *impl = dc.GetImpl();
- wxGTKImplDC *gtk_impl = wxDynamicCast( impl, wxGTKImplDC );
+ wxDCImpl *impl = dc.GetImpl();
+ wxGTKDCImpl *gtk_impl = wxDynamicCast( impl, wxGTKDCImpl );
if (gtk_impl)
gdk_window = gtk_impl->GetGDKWindow();
#else
{
GdkWindow* gdk_window = NULL;
#if wxUSE_NEW_DC
- wxImplDC *impl = dc.GetImpl();
- wxGTKImplDC *gtk_impl = wxDynamicCast( impl, wxGTKImplDC );
+ wxDCImpl *impl = dc.GetImpl();
+ wxGTKDCImpl *gtk_impl = wxDynamicCast( impl, wxGTKDCImpl );
if (gtk_impl)
gdk_window = gtk_impl->GetGDKWindow();
#else
{
GdkWindow* gdk_window = NULL;
#if wxUSE_NEW_DC
- wxImplDC *impl = dc.GetImpl();
- wxGTKImplDC *gtk_impl = wxDynamicCast( impl, wxGTKImplDC );
+ wxDCImpl *impl = dc.GetImpl();
+ wxGTKDCImpl *gtk_impl = wxDynamicCast( impl, wxGTKDCImpl );
if (gtk_impl)
gdk_window = gtk_impl->GetGDKWindow();
#else
return true;
case wxTOOL_STYLE_CONTROL:
+#if 1
GtkWidget* align = gtk_alignment_new(0.5, 0.5, 0, 0);
gtk_widget_show(align);
gtk_container_add((GtkContainer*)align, tool->GetControl()->m_widget);
(const char *) NULL,
posGtk
);
+#else
+ gtk_toolbar_insert_widget(
+ m_toolbar,
+ tool->GetControl()->m_widget,
+ (const char *) NULL,
+ (const char *) NULL,
+ posGtk
+ );
+#endif
// release reference obtained by wxInsertChildInToolBar
g_object_unref(tool->GetControl()->m_widget);
break;
if (style & wxNO_BORDER)
g_object_set (m_text, "has-frame", FALSE, NULL);
+
}
m_parent->DoAddChild( this );
/////////////////////////////////////////////////////////////////////////////
// Name: src/mac/carbon/dcclient.cpp
-// Purpose: wxClientDC class
+// Purpose: wxClientDCImpl class
// Author: Stefan Csomor
// Modified by:
// Created: 01/02/97
#include "wx/mac/private.h"
//-----------------------------------------------------------------------------
-// constants
+// wxWindowDCImpl
//-----------------------------------------------------------------------------
-//-----------------------------------------------------------------------------
-// wxPaintDC
-//-----------------------------------------------------------------------------
-
-IMPLEMENT_DYNAMIC_CLASS(wxWindowDC, wxDC)
-IMPLEMENT_DYNAMIC_CLASS(wxClientDC, wxWindowDC)
-IMPLEMENT_DYNAMIC_CLASS(wxPaintDC, wxWindowDC)
-
-/*
- * wxWindowDC
- */
+IMPLEMENT_ABSTRACT_CLASS(wxWindowDCImpl, wxGCDCImpl)
-#include "wx/mac/uma.h"
-#include "wx/notebook.h"
-#include "wx/tabctrl.h"
-
-
-
-wxWindowDC::wxWindowDC()
+wxWindowDCImpl::wxWindowDCImpl( wxDC *owner )
+ : wxGCDCImpl( owner )
{
- m_window = NULL ;
m_release = false;
}
-wxWindowDC::wxWindowDC(wxWindow *window)
+wxWindowDCImpl::wxWindowDCImpl( wxDC *owner, wxWindow *window )
+ : wxGCDCImpl( owner )
{
- m_window = window ;
+ m_window = window;
+
wxTopLevelWindowMac* rootwindow = window->MacGetTopLevelWindow() ;
if (!rootwindow)
return;
SetGraphicsContext( wxGraphicsContext::CreateFromNative( cg ) );
}
- SetClippingRegion( 0 , 0 , m_width , m_height ) ;
+ DoSetClippingRegion( 0 , 0 , m_width , m_height ) ;
SetBackground(wxBrush(window->GetBackgroundColour(),wxSOLID));
SetFont( window->GetFont() ) ;
}
-wxWindowDC::~wxWindowDC()
+wxWindowDCImpl::~wxWindowDCImpl()
{
if ( m_release )
{
}
}
-void wxWindowDC::DoGetSize( int* width, int* height ) const
+void wxWindowDCImpl::DoGetSize( int* width, int* height ) const
{
if ( width )
*width = m_width;
*height = m_height;
}
-wxBitmap wxWindowDC::DoGetAsBitmap(const wxRect *subrect) const
+wxBitmap wxWindowDCImpl::DoGetAsBitmap(const wxRect *subrect) const
{
// wxScreenDC is derived from wxWindowDC, so a screen dc will
// call this method when a Blit is performed with it as a source.
}
/*
- * wxClientDC
+ * wxClientDCImpl
*/
-wxClientDC::wxClientDC()
+IMPLEMENT_ABSTRACT_CLASS(wxClientDCImpl, wxWindowDCImpl)
+
+wxClientDCImpl::wxClientDCImpl( wxDC *owner )
+ : wxWindowDCImpl( owner )
{
- m_window = NULL ;
}
-wxClientDC::wxClientDC(wxWindow *window) :
- wxWindowDC( window )
+wxClientDCImpl::wxClientDCImpl( wxDC *owner, wxWindow *window ) :
+ wxWindowDCImpl( owner, window )
{
- wxCHECK_RET( window, _T("invalid window in wxClientDC") );
+ wxCHECK_RET( window, _T("invalid window in wxClientDCImpl") );
wxPoint origin = window->GetClientAreaOrigin() ;
m_window->GetClientSize( &m_width , &m_height);
SetDeviceOrigin( origin.x, origin.y );
- SetClippingRegion( 0 , 0 , m_width , m_height ) ;
+ DoSetClippingRegion( 0 , 0 , m_width , m_height ) ;
}
-wxClientDC::~wxClientDC()
+wxClientDCImpl::~wxClientDCImpl()
{
}
/*
- * wxPaintDC
+ * wxPaintDCImpl
*/
-wxPaintDC::wxPaintDC()
+IMPLEMENT_ABSTRACT_CLASS(wxPaintDCImpl, wxWindowDCImpl)
+
+wxPaintDCImpl::wxPaintDCImpl( wxDC *owner )
+ : wxWindowDCImpl( owner )
{
- m_window = NULL ;
}
-wxPaintDC::wxPaintDC(wxWindow *window) :
- wxWindowDC( window )
+wxPaintDCImpl::wxPaintDCImpl( wxDC *owner, wxWindow *window ) :
+ wxWindowDCImpl( owner, window )
{
wxPoint origin = window->GetClientAreaOrigin() ;
m_window->GetClientSize( &m_width , &m_height);
SetDeviceOrigin( origin.x, origin.y );
- SetClippingRegion( 0 , 0 , m_width , m_height ) ;
+ DoSetClippingRegion( 0 , 0 , m_width , m_height ) ;
}
-wxPaintDC::~wxPaintDC()
+wxPaintDCImpl::~wxPaintDCImpl()
{
}
#include "wx/mac/private.h"
//-----------------------------------------------------------------------------
-// wxMemoryDC
+// wxMemoryDCImpl
//-----------------------------------------------------------------------------
-IMPLEMENT_DYNAMIC_CLASS(wxMemoryDC,wxPaintDC)
+IMPLEMENT_ABSTRACT_CLASS(wxMemoryDCImpl,wxPaintDCImpl)
-void wxMemoryDC::Init()
+
+wxMemoryDCImpl::wxMemoryDCImpl( wxMemoryDC *owner )
+ : wxPaintDCImpl( owner )
+{
+ Init();
+}
+
+wxMemoryDCImpl::wxMemoryDCImpl( wxMemoryDC *owner, wxBitmap& bitmap )
+ : wxPaintDCImpl( owner )
+{
+ Init();
+ DoSelect(bitmap);
+}
+
+wxMemoryDCImpl::wxMemoryDCImpl( wxMemoryDC *owner, wxDC *dc )
+ : wxPaintDCImpl( owner )
+{
+ Init();
+}
+
+void wxMemoryDCImpl::Init()
{
m_ok = true;
SetBackground(*wxWHITE_BRUSH);
m_ok = false;
}
-wxMemoryDC::wxMemoryDC( wxDC *WXUNUSED(dc) )
-: m_selected()
-{
- Init();
-}
-
-wxMemoryDC::~wxMemoryDC()
+wxMemoryDCImpl::~wxMemoryDCImpl()
{
if ( m_selected.Ok() )
{
}
}
-void wxMemoryDC::DoSelect( const wxBitmap& bitmap )
+void wxMemoryDCImpl::DoSelect( const wxBitmap& bitmap )
{
if ( m_selected.Ok() )
{
}
}
-void wxMemoryDC::DoGetSize( int *width, int *height ) const
+void wxMemoryDCImpl::DoGetSize( int *width, int *height ) const
{
if (m_selected.Ok())
{
#include "wx/mac/uma.h"
#include "wx/mac/private/print.h"
+#include "wx/mac/carbon/dcprint.h"
#include "wx/graphics.h"
-IMPLEMENT_CLASS(wxPrinterDC, wxDC)
+IMPLEMENT_ABSTRACT_CLASS(wxPrinterDCImpl, wxGCDCImpl)
class wxNativePrinterDC
{
if ( m_err )
return false ;
- wxMacCarbonPrintData *native = (wxMacCarbonPrintData*) dc->GetPrintData().GetNativeData() ;
+ wxPrinterDCImpl *impl = (wxPrinterDCImpl*) dc->GetImpl();
+ wxMacCarbonPrintData *native = (wxMacCarbonPrintData*) impl->GetPrintData().GetNativeData() ;
m_err = PMSessionBeginCGDocumentNoDialog(native->m_macPrintSession,
native->m_macPrintSettings,
if ( m_err )
return ;
- wxMacCarbonPrintData *native = (wxMacCarbonPrintData*) dc->GetPrintData().GetNativeData() ;
+ wxPrinterDCImpl *impl = (wxPrinterDCImpl*) dc->GetImpl();
+ wxMacCarbonPrintData *native = (wxMacCarbonPrintData*) impl->GetPrintData().GetNativeData() ;
m_err = PMSessionEndDocumentNoDialog(native->m_macPrintSession);
}
if ( m_err )
return ;
- wxMacCarbonPrintData *native = (wxMacCarbonPrintData*) dc->GetPrintData().GetNativeData() ;
+ wxPrinterDCImpl *impl = (wxPrinterDCImpl*) dc->GetImpl();
+ wxMacCarbonPrintData *native = (wxMacCarbonPrintData*) impl->GetPrintData().GetNativeData() ;
m_err = PMSessionBeginPageNoDialog(native->m_macPrintSession,
native->m_macPageFormat,
// since this is a non-critical error, we set the flag back
m_err = noErr ;
}
- dc->SetGraphicsContext( wxGraphicsContext::CreateFromNative( pageContext ) );
+ impl->SetGraphicsContext( wxGraphicsContext::CreateFromNative( pageContext ) );
}
void wxMacCarbonPrinterDC::EndPage( wxPrinterDC* dc )
if ( m_err )
return ;
- wxMacCarbonPrintData *native = (wxMacCarbonPrintData*) dc->GetPrintData().GetNativeData() ;
+ wxPrinterDCImpl *impl = (wxPrinterDCImpl*) dc->GetImpl();
+ wxMacCarbonPrintData *native = (wxMacCarbonPrintData*) impl->GetPrintData().GetNativeData() ;
m_err = PMSessionEndPageNoDialog(native->m_macPrintSession);
if ( m_err != noErr )
PMSessionEndDocumentNoDialog(native->m_macPrintSession);
}
// the cg context we got when starting the page isn't valid anymore, so replace it
- dc->SetGraphicsContext( wxGraphicsContext::Create() );
+ impl->SetGraphicsContext( wxGraphicsContext::Create() );
}
void wxMacCarbonPrinterDC::GetSize( int *w , int *h) const
//
//
-wxPrinterDC::wxPrinterDC(const wxPrintData& printdata)
+wxPrinterDCImpl::wxPrinterDCImpl( wxPrinterDC *owner, const wxPrintData& printdata )
+ : wxGCDCImpl( owner )
{
m_ok = false ;
m_printData = printdata ;
}
}
-wxSize wxPrinterDC::GetPPI() const
+wxSize wxPrinterDCImpl::GetPPI() const
{
return m_nativePrinterDC->GetPPI() ;
}
-wxPrinterDC::~wxPrinterDC(void)
+wxPrinterDCImpl::~wxPrinterDCImpl()
{
delete m_nativePrinterDC ;
}
-bool wxPrinterDC::StartDoc( const wxString& message )
+bool wxPrinterDCImpl::StartDoc( const wxString& message )
{
wxASSERT_MSG( Ok() , wxT("Called wxPrinterDC::StartDoc from an invalid object") ) ;
if ( !m_ok )
return false ;
- if ( m_nativePrinterDC->StartDoc(this, message ) )
+ if ( m_nativePrinterDC->StartDoc( (wxPrinterDC*) GetOwner(), message ) )
{
// in case we have to do additional things when successful
}
return m_ok ;
}
-void wxPrinterDC::EndDoc(void)
+void wxPrinterDCImpl::EndDoc(void)
{
if ( !m_ok )
return ;
- m_nativePrinterDC->EndDoc( this ) ;
+ m_nativePrinterDC->EndDoc( (wxPrinterDC*) GetOwner() ) ;
m_ok = m_nativePrinterDC->Ok() ;
if ( !m_ok )
}
}
-wxRect wxPrinterDC::GetPaperRect()
+wxRect wxPrinterDCImpl::GetPaperRect()
{
wxCoord w, h;
- GetSize(&w, &h);
+ GetOwner()->GetSize(&w, &h);
wxRect pageRect(0, 0, w, h);
wxMacCarbonPrintData *native = (wxMacCarbonPrintData*) m_printData.GetNativeData() ;
OSStatus err = noErr ;
wxCoord(rPaper.right - rPaper.left), wxCoord(rPaper.bottom - rPaper.top));
}
-void wxPrinterDC::StartPage(void)
+void wxPrinterDCImpl::StartPage()
{
if ( !m_ok )
return ;
m_brush = *wxTRANSPARENT_BRUSH;
m_backgroundBrush = *wxWHITE_BRUSH;
- m_nativePrinterDC->StartPage(this) ;
+ m_nativePrinterDC->StartPage( (wxPrinterDC*) GetOwner() ) ;
m_ok = m_nativePrinterDC->Ok() ;
}
-void wxPrinterDC::EndPage(void)
+void wxPrinterDCImpl::EndPage()
{
if ( !m_ok )
return ;
- m_nativePrinterDC->EndPage(this) ;
+ m_nativePrinterDC->EndPage( (wxPrinterDC*) GetOwner() );
m_ok = m_nativePrinterDC->Ok() ;
}
-void wxPrinterDC::DoGetSize(int *width, int *height) const
+void wxPrinterDCImpl::DoGetSize(int *width, int *height) const
{
wxCHECK_RET( m_ok , _T("GetSize() doesn't work without a valid wxPrinterDC") );
m_nativePrinterDC->GetSize(width, height ) ;
#include "wx/wxprec.h"
#include "wx/dcscreen.h"
+#include "wx/mac/carbon/dcscreen.h"
#include "wx/mac/uma.h"
#include "wx/graphics.h"
-IMPLEMENT_DYNAMIC_CLASS(wxScreenDC, wxWindowDC)
+IMPLEMENT_ABSTRACT_CLASS(wxScreenDCImpl, wxWindowDCImpl)
// TODO : for the Screenshot use case, which doesn't work in Quartz
// we should do a GetAsBitmap using something like
// http://www.cocoabuilder.com/archive/message/cocoa/2005/8/13/144256
// Create a DC representing the whole screen
-wxScreenDC::wxScreenDC()
+wxScreenDCImpl::wxScreenDCImpl( wxDC *owner ) :
+ wxWindowDCImpl( owner )
{
#ifdef __LP64__
m_graphicContext = NULL;
#endif
}
-wxScreenDC::~wxScreenDC()
+wxScreenDCImpl::~wxScreenDCImpl()
{
delete m_graphicContext;
m_graphicContext = NULL;
// Context
virtual wxGraphicsContext * CreateContext( const wxWindowDC& dc);
+ virtual wxGraphicsContext * CreateContext( const wxMemoryDC& dc);
virtual wxGraphicsContext * CreateContextFromNativeContext( void * context );
return &gs_MacCoreGraphicsRenderer;
}
-wxGraphicsContext * wxMacCoreGraphicsRenderer::CreateContext( const wxWindowDC& dc)
+wxGraphicsContext * wxMacCoreGraphicsRenderer::CreateContext( const wxWindowDC& dc )
{
- wxMemoryDC* mdc = wxDynamicCast(&dc, wxMemoryDC);
- if ( mdc )
- {
- return new wxMacCoreGraphicsContext(this,
- (CGContextRef)mdc->GetGraphicsContext()->GetNativeContext());
- }
- else
- {
- return new wxMacCoreGraphicsContext(this,(CGContextRef)dc.GetWindow()->MacGetCGContextRef() );
- }
+ const wxDCImpl* impl = dc.GetImpl();
+ wxWindowDCImpl *win_impl = wxDynamicCast( impl, wxWindowDCImpl );
+ if (win_impl)
+ return new wxMacCoreGraphicsContext( this,
+ (CGContextRef)(win_impl->GetWindow()->MacGetCGContextRef()) );
+
+ return NULL;
+}
+
+wxGraphicsContext * wxMacCoreGraphicsRenderer::CreateContext( const wxMemoryDC& dc )
+{
+ const wxDCImpl* impl = dc.GetImpl();
+ wxMemoryDCImpl *mem_impl = wxDynamicCast( impl, wxMemoryDCImpl );
+ if (mem_impl)
+ return new wxMacCoreGraphicsContext( this,
+ (CGContextRef)(mem_impl->GetGraphicsContext()->GetNativeContext()) );
+
+ return NULL;
}
wxGraphicsContext * wxMacCoreGraphicsRenderer::CreateContextFromNativeContext( void * context )
#include "wx/clipbrd.h"
#include "wx/mac/uma.h"
#include "wx/graphics.h"
+#include "wx/mac/carbon/metafile.h"
#include <stdio.h>
#include <string.h>
IMPLEMENT_DYNAMIC_CLASS(wxMetafile, wxObject)
IMPLEMENT_ABSTRACT_CLASS(wxMetafileDC, wxDC)
+IMPLEMENT_ABSTRACT_CLASS(wxMetafileDCImpl, wxGCDCImpl)
#define M_METAFILEREFDATA( a ) ((wxMetafileRefData*)(a).GetRefData())
if (!m_refData)
return false;
- if (!dc->Ok())
+ if (!dc->IsOk())
return false;
{
- CGContextRef cg = (CGContextRef) dc->GetGraphicsContext()->GetNativeContext();
- CGPDFDocumentRef doc = M_METAFILEDATA->GetPDFDocument();
- CGPDFPageRef page = CGPDFDocumentGetPage( doc, 1 );
- wxMacCGContextStateSaver save(cg);
- CGContextDrawPDFPage( cg, page );
+ wxDCImpl *impl = dc->GetImpl();
+ wxGCDCImpl *gc_impl = wxDynamicCast(impl, wxGCDCImpl);
+ if (gc_impl)
+ {
+ CGContextRef cg = (CGContextRef) (gc_impl->GetGraphicsContext()->GetNativeContext());
+ CGPDFDocumentRef doc = M_METAFILEDATA->GetPDFDocument();
+ CGPDFPageRef page = CGPDFDocumentGetPage( doc, 1 );
+ wxMacCGContextStateSaver save(cg);
+ CGContextDrawPDFPage( cg, page );
+ }
// CGContextTranslateCTM( cg, 0, bounds.size.width );
// CGContextScaleCTM( cg, 1, -1 );
}
// New constructor that takes origin and extent. If you use this, don't
// give origin/extent arguments to wxMakeMetaFilePlaceable.
-wxMetaFileDC::wxMetaFileDC(
+wxMetafileDCImpl::wxMetafileDCImpl(
+ wxDC *owner,
const wxString& filename,
int width, int height,
- const wxString& WXUNUSED(description) )
+ const wxString& WXUNUSED(description) ) :
+ wxGCDCImpl( owner )
{
wxASSERT_MSG( width != 0 || height != 0, wxT("no arbitration of metafile size supported") );
wxASSERT_MSG( filename.empty(), wxT("no file based metafile support yet"));
SetMapMode( wxMM_TEXT );
}
-wxMetaFileDC::~wxMetaFileDC()
+wxMetafileDCImpl::~wxMetafileDCImpl()
{
}
-void wxMetaFileDC::DoGetSize(int *width, int *height) const
+void wxMetafileDCImpl::DoGetSize(int *width, int *height) const
{
wxCHECK_RET( m_metaFile, wxT("GetSize() doesn't work without a metafile") );
(*height) = sz.y;
}
-wxMetaFile *wxMetaFileDC::Close()
+wxMetaFile *wxMetafileDCImpl::Close()
{
delete m_graphicContext;
m_graphicContext = NULL;
void wxOverlayImpl::BeginDrawing( wxWindowDC* dc)
{
- dc->SetGraphicsContext( wxGraphicsContext::CreateFromNative( m_overlayContext ) );
- wxSize size = dc->GetSize() ;
- dc->SetClippingRegion( 0 , 0 , size.x , size.y ) ;
+ wxDCImpl *impl = dc->GetImpl();
+ wxWindowDCImpl *win_impl = wxDynamicCast(impl,wxWindowDCImpl);
+ if (win_impl)
+ {
+ win_impl->SetGraphicsContext( wxGraphicsContext::CreateFromNative( m_overlayContext ) );
+ wxSize size = dc->GetSize() ;
+ dc->SetClippingRegion( 0 , 0 , size.x , size.y ) ;
+ }
}
void wxOverlayImpl::EndDrawing( wxWindowDC* dc)
{
- dc->SetGraphicsContext(NULL);
+ wxDCImpl *impl = dc->GetImpl();
+ wxWindowDCImpl *win_impl = wxDynamicCast(impl,wxWindowDCImpl);
+ if (win_impl)
+ win_impl->SetGraphicsContext(NULL);
+
CGContextFlush( m_overlayContext );
}
}
// May have pressed cancel.
- if (!dc || !dc->Ok())
+ if (!dc || !dc->IsOk())
{
if (dc)
delete dc;
// Get a device context for the currently selected printer
wxPrinterDC printerDC(m_printDialogData.GetPrintData());
- if (printerDC.Ok())
+ if (printerDC.IsOk())
{
printerDC.GetSizeMM(&ww, &hh);
printerDC.GetSize( &w , &h ) ;
else
{
CGContextRef cgContext;
-
- cgContext = (CGContextRef) dc.GetGraphicsContext()->GetNativeContext();
+ wxGCDCImpl *impl = (wxGCDCImpl*) dc.GetImpl();
+
+ cgContext = (CGContextRef) impl->GetGraphicsContext()->GetNativeContext();
{
HIThemeButtonDrawInfo drawInfo;
{
CGContextRef cgContext;
- cgContext = (CGContextRef) dc.GetGraphicsContext()->GetNativeContext();
+ wxGCDCImpl *impl = (wxGCDCImpl*) dc.GetImpl();
+ cgContext = (CGContextRef) impl->GetGraphicsContext()->GetNativeContext();
HIThemeButtonDrawInfo drawInfo;
HIRect labelRect;
else
{
CGContextRef cgContext;
-
- cgContext = (CGContextRef) dc.GetGraphicsContext()->GetNativeContext();
+ wxGCDCImpl *impl = (wxGCDCImpl*) dc.GetImpl();
+ cgContext = (CGContextRef) impl->GetGraphicsContext()->GetNativeContext();
HIThemeSplitterDrawInfo drawInfo;
drawInfo.version = 0;
}
else
{
+ wxGCDCImpl *impl = (wxGCDCImpl*) dc.GetImpl();
CGContextRef cgContext;
- cgContext = (CGContextRef) dc.GetGraphicsContext()->GetNativeContext();
+ cgContext = (CGContextRef) impl->GetGraphicsContext()->GetNativeContext();
HIThemeButtonDrawInfo drawInfo;
HIRect labelRect;
// if it's likely that the app has finished with them, that is, we
// get an idle event and we're not dragging anything.
if (!::GetKeyState(MK_LBUTTON) && !::GetKeyState(MK_MBUTTON) && !::GetKeyState(MK_RBUTTON))
- wxDC::ClearCache();
+ wxMSWDCImpl::ClearCache();
#endif // wxUSE_DC_CACHEING
}
bool wxBitmap::Create(int width, int height, const wxDC& dc)
{
- wxCHECK_MSG( dc.Ok(), false, _T("invalid HDC in wxBitmap::Create()") );
+ wxCHECK_MSG( dc.IsOk(), false, _T("invalid HDC in wxBitmap::Create()") );
- return DoCreate(width, height, -1, dc.GetHDC());
+ const wxMSWDCImpl *impl = wxDynamicCast( dc.GetImpl(), wxMSWDCImpl );
+
+ if (impl)
+ return DoCreate(width, height, -1, impl->GetHDC());
+ else
+ return false;
}
bool wxBitmap::DoCreate(int w, int h, int d, WXHDC hdc)
bool wxBitmap::CreateFromImage(const wxImage& image, const wxDC& dc)
{
- wxCHECK_MSG( dc.Ok(), false,
+ wxCHECK_MSG( dc.IsOk(), false,
_T("invalid HDC in wxBitmap::CreateFromImage()") );
- return CreateFromImage(image, -1, dc.GetHDC());
+ const wxMSWDCImpl *impl = wxDynamicCast( dc.GetImpl(), wxMSWDCImpl );
+
+ if (impl)
+ return CreateFromImage(image, -1, impl->GetHDC());
+ else
+ return false;
}
#if wxUSE_WXDIB
if ( !wxOwnerDrawn::OnDrawItem(dc, rc, act, stat) )
return false;
+ wxMSWDCImpl *impl = (wxMSWDCImpl*) dc.GetImpl();
// now draw the check mark part
- HDC hdc = GetHdcOf(dc);
+ HDC hdc = GetHdcOf(*impl);
int nBmpWidth = ::GetSystemMetrics(SM_CXMENUCHECK),
nBmpHeight = ::GetSystemMetrics(SM_CYMENUCHECK);
#if wxUSE_UXTHEME
#include "wx/msw/uxtheme.h"
#endif
+#include "wx/msw/dc.h"
// Change to #if 1 to include tmschema.h for easier testing of theme
// parameters.
#if wxUSE_UXTHEME
const bool isEnabled = IsEnabled();
- HDC hDc = GetHdcOf(dc);
+ wxMSWDCImpl *impl = (wxMSWDCImpl*) dc.GetImpl();
+ HDC hDc = GetHdcOf(*impl);
HWND hWnd = GetHwndOf(this);
wxUxThemeEngine* theme = NULL;
#define WXMICROWIN_CHECK_HDC_RET(x)
#endif
-IMPLEMENT_ABSTRACT_CLASS(wxDC, wxDCBase)
+IMPLEMENT_ABSTRACT_CLASS(wxMSWDCImpl, wxDCImpl)
// ---------------------------------------------------------------------------
// constants
class wxColourChanger
{
public:
- wxColourChanger(wxDC& dc);
+ wxColourChanger(wxMSWDCImpl& dc);
~wxColourChanger();
private:
- wxDC& m_dc;
+ wxMSWDCImpl& m_dc;
COLORREF m_colFgOld, m_colBgOld;
// wxColourChanger
// ----------------------------------------------------------------------------
-wxColourChanger::wxColourChanger(wxDC& dc) : m_dc(dc)
+wxColourChanger::wxColourChanger(wxMSWDCImpl& dc) : m_dc(dc)
{
const wxBrush& brush = dc.GetBrush();
if ( brush.Ok() && brush.GetStyle() == wxSTIPPLE_MASK_OPAQUE )
}
// ---------------------------------------------------------------------------
-// wxDC
+// wxMSWDCImpl
// ---------------------------------------------------------------------------
-wxDC::~wxDC()
+wxMSWDCImpl::wxMSWDCImpl( wxDC *owner, WXHDC hDC ) :
+ wxDCImpl( owner )
+{
+ Init();
+ m_hDC = hDC;
+}
+
+wxMSWDCImpl::~wxMSWDCImpl()
{
if ( m_hDC != 0 )
{
}
else // we don't own our HDC
{
- if (m_canvas)
+ if (m_window)
{
- ::ReleaseDC(GetHwndOf(m_canvas), GetHdc());
+ ::ReleaseDC(GetHwndOf(m_window), GetHdc());
}
else
{
// This will select current objects out of the DC,
// which is what you have to do before deleting the
// DC.
-void wxDC::SelectOldObjects(WXHDC dc)
+void wxMSWDCImpl::SelectOldObjects(WXHDC dc)
{
if (dc)
{
// clipping
// ---------------------------------------------------------------------------
-void wxDC::UpdateClipBox()
+void wxMSWDCImpl::UpdateClipBox()
{
WXMICROWIN_CHECK_HDC
}
void
-wxDC::DoGetClippingBox(wxCoord *x, wxCoord *y, wxCoord *w, wxCoord *h) const
+wxMSWDCImpl::DoGetClippingBox(wxCoord *x, wxCoord *y, wxCoord *w, wxCoord *h) const
{
// check if we should try to retrieve the clipping region possibly not set
// by our SetClippingRegion() but preset by Windows:this can only happen
// when we're associated with an existing HDC usign SetHDC(), see there
if ( m_clipping && !m_clipX1 && !m_clipX2 )
{
- wxDC *self = wxConstCast(this, wxDC);
+ wxMSWDCImpl *self = wxConstCast(this, wxMSWDCImpl);
self->UpdateClipBox();
if ( !m_clipX1 && !m_clipX2 )
self->m_clipping = false;
}
- wxDCBase::DoGetClippingBox(x, y, w, h);
+ wxDCImpl::DoGetClippingBox(x, y, w, h);
}
// common part of DoSetClippingRegion() and DoSetClippingRegionAsRegion()
-void wxDC::SetClippingHrgn(WXHRGN hrgn)
+void wxMSWDCImpl::SetClippingHrgn(WXHRGN hrgn)
{
wxCHECK_RET( hrgn, wxT("invalid clipping region") );
UpdateClipBox();
}
-void wxDC::DoSetClippingRegion(wxCoord x, wxCoord y, wxCoord w, wxCoord h)
+void wxMSWDCImpl::DoSetClippingRegion(wxCoord x, wxCoord y, wxCoord w, wxCoord h)
{
// the region coords are always the device ones, so do the translation
// manually
}
}
-void wxDC::DoSetClippingRegionAsRegion(const wxRegion& region)
+void wxMSWDCImpl::DoSetClippingRegionAsRegion(const wxRegion& region)
{
SetClippingHrgn(region.GetHRGN());
}
-void wxDC::DestroyClippingRegion()
+void wxMSWDCImpl::DestroyClippingRegion()
{
WXMICROWIN_CHECK_HDC
#endif
}
- wxDCBase::DestroyClippingRegion();
+ wxDCImpl::DestroyClippingRegion();
}
// ---------------------------------------------------------------------------
// query capabilities
// ---------------------------------------------------------------------------
-bool wxDC::CanDrawBitmap() const
+bool wxMSWDCImpl::CanDrawBitmap() const
{
return true;
}
-bool wxDC::CanGetTextExtent() const
+bool wxMSWDCImpl::CanGetTextExtent() const
{
#ifdef __WXMICROWIN__
// TODO Extend MicroWindows' GetDeviceCaps function
#endif
}
-int wxDC::GetDepth() const
+int wxMSWDCImpl::GetDepth() const
{
WXMICROWIN_CHECK_HDC_RET(16)
// drawing
// ---------------------------------------------------------------------------
-void wxDC::Clear()
+void wxMSWDCImpl::Clear()
{
WXMICROWIN_CHECK_HDC
RECT rect;
- if ( m_canvas )
+ if (m_window)
{
- GetClientRect((HWND) m_canvas->GetHWND(), &rect);
+ GetClientRect((HWND) m_window->GetHWND(), &rect);
}
else
{
RealizeScaleAndOrigin();
}
-bool wxDC::DoFloodFill(wxCoord WXUNUSED_IN_WINCE(x),
+bool wxMSWDCImpl::DoFloodFill(wxCoord WXUNUSED_IN_WINCE(x),
wxCoord WXUNUSED_IN_WINCE(y),
const wxColour& WXUNUSED_IN_WINCE(col),
int WXUNUSED_IN_WINCE(style))
#endif
}
-bool wxDC::DoGetPixel(wxCoord x, wxCoord y, wxColour *col) const
+bool wxMSWDCImpl::DoGetPixel(wxCoord x, wxCoord y, wxColour *col) const
{
WXMICROWIN_CHECK_HDC_RET(false)
- wxCHECK_MSG( col, false, _T("NULL colour parameter in wxDC::GetPixel") );
+ wxCHECK_MSG( col, false, _T("NULL colour parameter in wxMSWDCImpl::GetPixel") );
// get the color of the pixel
COLORREF pixelcolor = ::GetPixel(GetHdc(), XLOG2DEV(x), YLOG2DEV(y));
return true;
}
-void wxDC::DoCrossHair(wxCoord x, wxCoord y)
+void wxMSWDCImpl::DoCrossHair(wxCoord x, wxCoord y)
{
WXMICROWIN_CHECK_HDC
CalcBoundingBox(x2, y2);
}
-void wxDC::DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2)
+void wxMSWDCImpl::DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2)
{
WXMICROWIN_CHECK_HDC
// Draws an arc of a circle, centred on (xc, yc), with starting point (x1, y1)
// and ending at (x2, y2)
-void wxDC::DoDrawArc(wxCoord x1, wxCoord y1,
+void wxMSWDCImpl::DoDrawArc(wxCoord x1, wxCoord y1,
wxCoord x2, wxCoord y2,
wxCoord xc, wxCoord yc)
{
// treat the special case of full circle separately
if ( x1 == x2 && y1 == y2 )
{
- DrawEllipse(xc - r, yc - r, 2*r, 2*r);
+ GetOwner()->DrawEllipse(xc - r, yc - r, 2*r, 2*r);
return;
}
#endif
}
-void wxDC::DoDrawCheckMark(wxCoord x1, wxCoord y1,
+void wxMSWDCImpl::DoDrawCheckMark(wxCoord x1, wxCoord y1,
wxCoord width, wxCoord height)
{
// cases when we don't have DrawFrameControl()
#endif // Microwin/Normal
}
-void wxDC::DoDrawPoint(wxCoord x, wxCoord y)
+void wxMSWDCImpl::DoDrawPoint(wxCoord x, wxCoord y)
{
WXMICROWIN_CHECK_HDC
CalcBoundingBox(x, y);
}
-void wxDC::DoDrawPolygon(int n,
+void wxMSWDCImpl::DoDrawPolygon(int n,
wxPoint points[],
wxCoord xoffset,
wxCoord yoffset,
}
void
-wxDC::DoDrawPolyPolygon(int n,
+wxMSWDCImpl::DoDrawPolyPolygon(int n,
int count[],
wxPoint points[],
wxCoord xoffset,
// __WXWINCE__
}
-void wxDC::DoDrawLines(int n, wxPoint points[], wxCoord xoffset, wxCoord yoffset)
+void wxMSWDCImpl::DoDrawLines(int n, wxPoint points[], wxCoord xoffset, wxCoord yoffset)
{
WXMICROWIN_CHECK_HDC
}
}
-void wxDC::DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
+void wxMSWDCImpl::DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
{
WXMICROWIN_CHECK_HDC
CalcBoundingBox(x2, y2);
}
-void wxDC::DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius)
+void wxMSWDCImpl::DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius)
{
WXMICROWIN_CHECK_HDC
CalcBoundingBox(x2, y2);
}
-void wxDC::DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
+void wxMSWDCImpl::DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
{
WXMICROWIN_CHECK_HDC
}
#if wxUSE_SPLINES
-void wxDC::DoDrawSpline(const wxPointList *points)
+void wxMSWDCImpl::DoDrawSpline(const wxPointList *points)
{
#ifdef __WXWINCE__
// WinCE does not support ::PolyBezier so use generic version
#endif
// Chris Breeze 20/5/98: first implementation of DrawEllipticArc on Windows
-void wxDC::DoDrawEllipticArc(wxCoord x,wxCoord y,wxCoord w,wxCoord h,double sa,double ea)
+void wxMSWDCImpl::DoDrawEllipticArc(wxCoord x,wxCoord y,wxCoord w,wxCoord h,double sa,double ea)
{
#ifdef __WXWINCE__
DoDrawEllipticArcRot( x, y, w, h, sa, ea );
#endif
}
-void wxDC::DoDrawIcon(const wxIcon& icon, wxCoord x, wxCoord y)
+void wxMSWDCImpl::DoDrawIcon(const wxIcon& icon, wxCoord x, wxCoord y)
{
WXMICROWIN_CHECK_HDC
CalcBoundingBox(x + icon.GetWidth(), y + icon.GetHeight());
}
-void wxDC::DoDrawBitmap( const wxBitmap &bmp, wxCoord x, wxCoord y, bool useMask )
+void wxMSWDCImpl::DoDrawBitmap( const wxBitmap &bmp, wxCoord x, wxCoord y, bool useMask )
{
WXMICROWIN_CHECK_HDC
- wxCHECK_RET( bmp.Ok(), _T("invalid bitmap in wxDC::DrawBitmap") );
+ wxCHECK_RET( bmp.Ok(), _T("invalid bitmap in wxMSWDCImpl::DrawBitmap") );
int width = bmp.GetWidth(),
height = bmp.GetHeight();
if ( !ok )
#endif // Win32
{
- // Rather than reproduce wxDC::Blit, let's do it at the wxWin API
+ // Rather than reproduce wxMSWDCImpl::Blit, let's do it at the wxWin API
// level
wxMemoryDC memDC;
memDC.SelectObjectAsSource(bmp);
- Blit(x, y, width, height, &memDC, 0, 0, wxCOPY, useMask);
+ GetOwner()->Blit(x, y, width, height, &memDC, 0, 0, wxCOPY, useMask);
memDC.SelectObject(wxNullBitmap);
}
}
}
-void wxDC::DoDrawText(const wxString& text, wxCoord x, wxCoord y)
+void wxMSWDCImpl::DoDrawText(const wxString& text, wxCoord x, wxCoord y)
{
WXMICROWIN_CHECK_HDC
CalcBoundingBox(x, y);
wxCoord w, h;
- GetTextExtent(text, &w, &h);
+ GetOwner()->GetTextExtent(text, &w, &h);
CalcBoundingBox(x + w, y + h);
}
-void wxDC::DrawAnyText(const wxString& text, wxCoord x, wxCoord y)
+void wxMSWDCImpl::DrawAnyText(const wxString& text, wxCoord x, wxCoord y)
{
WXMICROWIN_CHECK_HDC
SetBkMode(GetHdc(), TRANSPARENT);
}
-void wxDC::DoDrawRotatedText(const wxString& text,
+void wxMSWDCImpl::DoDrawRotatedText(const wxString& text,
wxCoord x, wxCoord y,
double angle)
{
// containing the text to it (simpler and probably not slower than
// determining which of them is really topmost/leftmost/...)
wxCoord w, h;
- GetTextExtent(text, &w, &h);
+ GetOwner()->GetTextExtent(text, &w, &h);
double rad = DegToRad(angle);
#if wxUSE_PALETTE
-void wxDC::DoSelectPalette(bool realize)
+void wxMSWDCImpl::DoSelectPalette(bool realize)
{
WXMICROWIN_CHECK_HDC
}
}
-void wxDC::SetPalette(const wxPalette& palette)
+void wxMSWDCImpl::SetPalette(const wxPalette& palette)
{
if ( palette.Ok() )
{
}
}
-void wxDC::InitializePalette()
+void wxMSWDCImpl::InitializePalette()
{
if ( wxDisplayDepth() <= 8 )
{
// look for any window or parent that has a custom palette. If any has
// one then we need to use it in drawing operations
- wxWindow *win = m_canvas->GetAncestorWithCustomPalette();
+ wxWindow *win = m_window->GetAncestorWithCustomPalette();
m_hasCustomPalette = win && win->HasCustomPalette();
if ( m_hasCustomPalette )
// SetFont/Pen/Brush() really ask to be implemented as a single template
// function... but doing it is not worth breaking OpenWatcom build <sigh>
-void wxDC::SetFont(const wxFont& font)
+void wxMSWDCImpl::SetFont(const wxFont& font)
{
WXMICROWIN_CHECK_HDC
}
}
-void wxDC::SetPen(const wxPen& pen)
+void wxMSWDCImpl::SetPen(const wxPen& pen)
{
WXMICROWIN_CHECK_HDC
}
}
-void wxDC::SetBrush(const wxBrush& brush)
+void wxMSWDCImpl::SetBrush(const wxBrush& brush)
{
WXMICROWIN_CHECK_HDC
}
}
-void wxDC::SetBackground(const wxBrush& brush)
+void wxMSWDCImpl::SetBackground(const wxBrush& brush)
{
WXMICROWIN_CHECK_HDC
}
}
-void wxDC::SetBackgroundMode(int mode)
+void wxMSWDCImpl::SetBackgroundMode(int mode)
{
WXMICROWIN_CHECK_HDC
// and m_backgroundMode is used there
}
-void wxDC::SetLogicalFunction(int function)
+void wxMSWDCImpl::SetLogicalFunction(int function)
{
WXMICROWIN_CHECK_HDC
SetRop(m_hDC);
}
-void wxDC::SetRop(WXHDC dc)
+void wxMSWDCImpl::SetRop(WXHDC dc)
{
if ( !dc || m_logicalFunction < 0 )
return;
SetROP2(GetHdc(), rop);
}
-bool wxDC::StartDoc(const wxString& WXUNUSED(message))
+bool wxMSWDCImpl::StartDoc(const wxString& WXUNUSED(message))
{
// We might be previewing, so return true to let it continue.
return true;
}
-void wxDC::EndDoc()
+void wxMSWDCImpl::EndDoc()
{
}
-void wxDC::StartPage()
+void wxMSWDCImpl::StartPage()
{
}
-void wxDC::EndPage()
+void wxMSWDCImpl::EndPage()
{
}
// text metrics
// ---------------------------------------------------------------------------
-wxCoord wxDC::GetCharHeight() const
+wxCoord wxMSWDCImpl::GetCharHeight() const
{
WXMICROWIN_CHECK_HDC_RET(0)
return lpTextMetric.tmHeight;
}
-wxCoord wxDC::GetCharWidth() const
+wxCoord wxMSWDCImpl::GetCharWidth() const
{
WXMICROWIN_CHECK_HDC_RET(0)
return lpTextMetric.tmAveCharWidth;
}
-void wxDC::DoGetTextExtent(const wxString& string, wxCoord *x, wxCoord *y,
+void wxMSWDCImpl::DoGetTextExtent(const wxString& string, wxCoord *x, wxCoord *y,
wxCoord *descent, wxCoord *externalLeading,
const wxFont *font) const
{
HFONT hfontOld;
if ( font )
{
- wxASSERT_MSG( font->Ok(), _T("invalid font in wxDC::GetTextExtent") );
+ wxASSERT_MSG( font->Ok(), _T("invalid font in wxMSWDCImpl::GetTextExtent") );
hfontOld = (HFONT)::SelectObject(GetHdc(), GetHfontOf(*font));
}
// Each element of the array will be the width of the string up to and
// including the coresoponding character in text.
-bool wxDC::DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths) const
+bool wxMSWDCImpl::DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths) const
{
static int maxLenText = -1;
static int maxWidth = -1;
return true;
}
-void wxDC::RealizeScaleAndOrigin()
+void wxMSWDCImpl::RealizeScaleAndOrigin()
{
// VZ: it seems very wasteful to always use MM_ANISOTROPIC when in 99% of
// cases we could do with MM_TEXT and in the remaining 0.9% with
}
-void wxDC::SetMapMode(int mode)
+void wxMSWDCImpl::SetMapMode(int mode)
{
WXMICROWIN_CHECK_HDC
RealizeScaleAndOrigin();
}
-void wxDC::SetUserScale(double x, double y)
+void wxMSWDCImpl::SetUserScale(double x, double y)
{
WXMICROWIN_CHECK_HDC
if ( x == m_userScaleX && y == m_userScaleY )
return;
- wxDCBase::SetUserScale(x,y);
+ wxDCImpl::SetUserScale(x,y);
RealizeScaleAndOrigin();
}
-void wxDC::SetAxisOrientation(bool xLeftRight,
+void wxMSWDCImpl::SetAxisOrientation(bool xLeftRight,
bool yBottomUp)
{
WXMICROWIN_CHECK_HDC
if (signX == m_signX && signY == m_signY)
return;
- wxDCBase::SetAxisOrientation( xLeftRight, yBottomUp );
+ wxDCImpl::SetAxisOrientation( xLeftRight, yBottomUp );
RealizeScaleAndOrigin();
}
-void wxDC::SetLogicalOrigin(wxCoord x, wxCoord y)
+void wxMSWDCImpl::SetLogicalOrigin(wxCoord x, wxCoord y)
{
WXMICROWIN_CHECK_HDC
if ( x == m_logicalOriginX && y == m_logicalOriginY )
return;
- wxDCBase::SetLogicalOrigin( x, y );
+ wxDCImpl::SetLogicalOrigin( x, y );
#ifndef __WXWINCE__
::SetWindowOrgEx(GetHdc(), (int)m_logicalOriginX, (int)m_logicalOriginY, NULL);
#endif
}
-void wxDC::SetDeviceOrigin(wxCoord x, wxCoord y)
+void wxMSWDCImpl::SetDeviceOrigin(wxCoord x, wxCoord y)
{
WXMICROWIN_CHECK_HDC
if ( x == m_deviceOriginX && y == m_deviceOriginY )
return;
- wxDCBase::SetDeviceOrigin( x, y );
+ wxDCImpl::SetDeviceOrigin( x, y );
::SetViewportOrgEx(GetHdc(), (int)m_deviceOriginX, (int)m_deviceOriginY, NULL);
}
// bit blit
// ---------------------------------------------------------------------------
-bool wxDC::DoBlit(wxCoord dstX, wxCoord dstY,
+bool wxMSWDCImpl::DoBlit(wxCoord dstX, wxCoord dstY,
wxCoord dstWidth, wxCoord dstHeight,
wxDC *source,
wxCoord srcX, wxCoord srcY,
return DoStretchBlit(dstX, dstY, dstWidth, dstHeight, source, srcX, srcY, dstWidth, dstHeight, rop, useMask, srcMaskX, srcMaskY);
}
-bool wxDC::DoStretchBlit(wxCoord xdest, wxCoord ydest,
+bool wxMSWDCImpl::DoStretchBlit(wxCoord xdest, wxCoord ydest,
wxCoord dstWidth, wxCoord dstHeight,
wxDC *source,
wxCoord xsrc, wxCoord ysrc,
int rop, bool useMask,
wxCoord xsrcMask, wxCoord ysrcMask)
{
- wxCHECK_MSG( source, false, _T("wxDC::Blit(): NULL wxDC pointer") );
+ wxCHECK_MSG( source, false, _T("wxMSWDCImpl::Blit(): NULL wxDC pointer") );
WXMICROWIN_CHECK_HDC_RET(false)
+ wxDCImpl *impl = source->GetImpl();
+ wxMSWDCImpl *msw_impl = wxDynamicCast( impl, wxMSWDCImpl );
+ if (!msw_impl)
+ {
+ // TODO: Do we want to be able to blit
+ // from other DCs too?
+ return false;
+ }
+
// if either the source or destination has alpha channel, we must use
// AlphaBlt() as other function don't handle it correctly
- const wxBitmap& bmpSrc = source->m_selectedBitmap;
+ const wxBitmap& bmpSrc = msw_impl->GetSelectedBitmap();
if ( bmpSrc.Ok() && (bmpSrc.HasAlpha() ||
(m_selectedBitmap.Ok() && m_selectedBitmap.HasAlpha())) )
{
if ( AlphaBlt(GetHdc(), xdest, ydest, dstWidth, dstHeight,
- xsrc, ysrc, srcWidth, srcHeight, GetHdcOf(*source), bmpSrc) )
+ xsrc, ysrc, srcWidth, srcHeight, GetHdcOf(*msw_impl), bmpSrc) )
return true;
}
(
GetHdc(),
xdest, ydest, dstWidth, dstHeight,
- GetHdcOf(*source),
+ GetHdcOf(*msw_impl),
xsrc, ysrc,
(HBITMAP)mask->GetMaskBitmap(),
xsrcMask, ysrcMask,
#if wxUSE_DC_CACHEING
// create a temp buffer bitmap and DCs to access it and the mask
- wxDCCacheEntry* dcCacheEntry1 = FindDCInCache(NULL, source->GetHDC());
+ wxDCCacheEntry* dcCacheEntry1 = FindDCInCache(NULL, msw_impl->GetHDC());
dc_mask = (HDC) dcCacheEntry1->m_dc;
wxDCCacheEntry* dcCacheEntry2 = FindDCInCache(dcCacheEntry1, GetHDC());
// copy src to buffer using selected raster op
if ( !::StretchBlt(dc_buffer, 0, 0, (int)dstWidth, (int)dstHeight,
- GetHdcOf(*source), xsrc, ysrc, srcWidth, srcHeight, dwRop) )
+ GetHdcOf(*msw_impl), xsrc, ysrc, srcWidth, srcHeight, dwRop) )
{
wxLogLastError(wxT("StretchBlt"));
}
(
GetHdc(),
xdest, ydest, dstWidth, dstHeight,
- GetHdcOf(*source),
+ GetHdcOf(*msw_impl),
xsrc, ysrc, srcWidth, srcHeight,
dwRop
) )
GetHdc(),
xdest, ydest,
(int)dstWidth, (int)dstHeight,
- GetHdcOf(*source),
+ GetHdcOf(*msw_impl),
xsrc, ysrc,
dwRop
) )
return success;
}
-void wxDC::GetDeviceSize(int *width, int *height) const
+void wxMSWDCImpl::GetDeviceSize(int *width, int *height) const
{
WXMICROWIN_CHECK_HDC
*height = ::GetDeviceCaps(GetHdc(), VERTRES);
}
-void wxDC::DoGetSizeMM(int *w, int *h) const
+void wxMSWDCImpl::DoGetSizeMM(int *w, int *h) const
{
WXMICROWIN_CHECK_HDC
}
}
-wxSize wxDC::GetPPI() const
+wxSize wxMSWDCImpl::GetPPI() const
{
WXMICROWIN_CHECK_HDC_RET(wxSize(0,0))
}
// For use by wxWidgets only, unless custom units are required.
-void wxDC::SetLogicalScale(double x, double y)
+void wxMSWDCImpl::SetLogicalScale(double x, double y)
{
WXMICROWIN_CHECK_HDC
- wxDCBase::SetLogicalScale(x,y);
+ wxDCImpl::SetLogicalScale(x,y);
}
// ----------------------------------------------------------------------------
* entry for the bitmap, and two for the DCs. -- JACS
*/
-wxList wxDC::sm_bitmapCache;
-wxList wxDC::sm_dcCache;
+wxObjectList wxMSWDCImpl::sm_bitmapCache;
+wxObjectList wxMSWDCImpl::sm_dcCache;
wxDCCacheEntry::wxDCCacheEntry(WXHBITMAP hBitmap, int w, int h, int depth)
{
::DeleteDC((HDC) m_dc);
}
-wxDCCacheEntry* wxDC::FindBitmapInCache(WXHDC dc, int w, int h)
+wxDCCacheEntry* wxMSWDCImpl::FindBitmapInCache(WXHDC dc, int w, int h)
{
int depth = ::GetDeviceCaps((HDC) dc, PLANES) * ::GetDeviceCaps((HDC) dc, BITSPIXEL);
wxList::compatibility_iterator node = sm_bitmapCache.GetFirst();
return entry;
}
-wxDCCacheEntry* wxDC::FindDCInCache(wxDCCacheEntry* notThis, WXHDC dc)
+wxDCCacheEntry* wxMSWDCImpl::FindDCInCache(wxDCCacheEntry* notThis, WXHDC dc)
{
int depth = ::GetDeviceCaps((HDC) dc, PLANES) * ::GetDeviceCaps((HDC) dc, BITSPIXEL);
wxList::compatibility_iterator node = sm_dcCache.GetFirst();
return entry;
}
-void wxDC::AddToBitmapCache(wxDCCacheEntry* entry)
+void wxMSWDCImpl::AddToBitmapCache(wxDCCacheEntry* entry)
{
sm_bitmapCache.Append(entry);
}
-void wxDC::AddToDCCache(wxDCCacheEntry* entry)
+void wxMSWDCImpl::AddToDCCache(wxDCCacheEntry* entry)
{
sm_dcCache.Append(entry);
}
-void wxDC::ClearCache()
+void wxMSWDCImpl::ClearCache()
{
WX_CLEAR_LIST(wxList, sm_dcCache);
WX_CLEAR_LIST(wxList, sm_bitmapCache);
{
public:
virtual bool OnInit() { return true; }
- virtual void OnExit() { wxDC::ClearCache(); }
+ virtual void OnExit() { wxMSWDCImpl::ClearCache(); }
private:
DECLARE_DYNAMIC_CLASS(wxDCModule)
#endif // #ifdef wxHAVE_RAW_BITMAP
-void wxDC::DoGradientFillLinear (const wxRect& rect,
+void wxMSWDCImpl::DoGradientFillLinear (const wxRect& rect,
const wxColour& initialColour,
const wxColour& destColour,
wxDirection nDirection)
}
#endif // wxUSE_DYNLIB_CLASS
- wxDCBase::DoGradientFillLinear(rect, initialColour, destColour, nDirection);
+ wxDCImpl::DoGradientFillLinear(rect, initialColour, destColour, nDirection);
}
#if wxUSE_DYNLIB_CLASS
return s_pfnGetLayout ? s_pfnGetLayout(hdc) : (DWORD)-1;
}
-wxLayoutDirection wxDC::GetLayoutDirection() const
+wxLayoutDirection wxMSWDCImpl::GetLayoutDirection() const
{
DWORD layout = wxGetDCLayout(GetHdc());
return layout & LAYOUT_RTL ? wxLayout_RightToLeft : wxLayout_LeftToRight;
}
-void wxDC::SetLayoutDirection(wxLayoutDirection dir)
+void wxMSWDCImpl::SetLayoutDirection(wxLayoutDirection dir)
{
typedef DWORD (WINAPI *SetLayout_t)(HDC, DWORD);
static SetLayout_t
#else // !wxUSE_DYNLIB_CLASS
// we can't provide RTL support without dynamic loading, so stub it out
-wxLayoutDirection wxDC::GetLayoutDirection() const
+wxLayoutDirection wxMSWDCImpl::GetLayoutDirection() const
{
return wxLayout_Default;
}
-void wxDC::SetLayoutDirection(wxLayoutDirection WXUNUSED(dir))
+void wxMSWDCImpl::SetLayoutDirection(wxLayoutDirection WXUNUSED(dir))
{
}
#endif
#include "wx/dcclient.h"
+#include "wx/msw/dcclient.h"
#ifndef WX_PRECOMP
#include "wx/string.h"
struct WXDLLEXPORT wxPaintDCInfo
{
- wxPaintDCInfo(wxWindow *win, wxDC *dc)
+ wxPaintDCInfo(wxWindow *win, wxPaintDCImpl *dc)
{
hwnd = win->GetHWND();
hdc = dc->GetHDC();
// macros
// ----------------------------------------------------------------------------
-IMPLEMENT_DYNAMIC_CLASS(wxWindowDC, wxDC)
-IMPLEMENT_DYNAMIC_CLASS(wxClientDC, wxWindowDC)
-IMPLEMENT_DYNAMIC_CLASS(wxPaintDC, wxClientDC)
-IMPLEMENT_CLASS(wxPaintDCEx, wxPaintDC)
-
// ----------------------------------------------------------------------------
// global variables
// ----------------------------------------------------------------------------
// ===========================================================================
// ----------------------------------------------------------------------------
-// wxWindowDC
+// wxMSWWindowDCImpl
// ----------------------------------------------------------------------------
-wxWindowDC::wxWindowDC()
+IMPLEMENT_ABSTRACT_CLASS(wxWindowDCImpl, wxMSWDCImpl)
+
+wxWindowDCImpl::wxWindowDCImpl( wxDC *owner ) :
+ wxMSWDCImpl( owner )
{
- m_canvas = NULL;
}
-wxWindowDC::wxWindowDC(wxWindow *canvas)
+wxWindowDCImpl::wxWindowDCImpl( wxDC *owner, wxWindow *window ) :
+ wxMSWDCImpl( owner )
{
- wxCHECK_RET( canvas, _T("invalid window in wxWindowDC") );
+ wxCHECK_RET( window, _T("invalid window in wxWindowDCImpl") );
- m_canvas = canvas;
- m_hDC = (WXHDC) ::GetWindowDC(GetHwndOf(m_canvas));
+ m_window = window;
+ m_hDC = (WXHDC) ::GetWindowDC(GetHwndOf(m_window));
// m_bOwnsDC was already set to false in the base class ctor, so the DC
// will be released (and not deleted) in ~wxDC
InitDC();
}
-void wxWindowDC::InitDC()
+void wxWindowDCImpl::InitDC()
{
// the background mode is only used for text background and is set in
// DrawText() to OPAQUE as required, otherwise always TRANSPARENT,
::SetBkMode(GetHdc(), TRANSPARENT);
// default bg colour is pne of the window
- SetBackground(wxBrush(m_canvas->GetBackgroundColour(), wxSOLID));
+ SetBackground(wxBrush(m_window->GetBackgroundColour(), wxSOLID));
// since we are a window dc we need to grab the palette from the window
#if wxUSE_PALETTE
#endif
}
-void wxWindowDC::DoGetSize(int *width, int *height) const
+void wxWindowDCImpl::DoGetSize(int *width, int *height) const
{
- wxCHECK_RET( m_canvas, _T("wxWindowDC without a window?") );
+ wxCHECK_RET( m_window, _T("wxWindowDCImpl without a window?") );
- m_canvas->GetSize(width, height);
+ m_window->GetSize(width, height);
}
// ----------------------------------------------------------------------------
-// wxClientDC
+// wxClientDCImpl
// ----------------------------------------------------------------------------
-wxClientDC::wxClientDC()
+IMPLEMENT_ABSTRACT_CLASS(wxClientDCImpl, wxWindowDCImpl)
+
+wxClientDCImpl::wxClientDCImpl( wxDC *owner ) :
+ wxWindowDCImpl( owner )
{
- m_canvas = NULL;
}
-wxClientDC::wxClientDC(wxWindow *canvas)
+wxClientDCImpl::wxClientDCImpl( wxDC *owner, wxWindow *window ) :
+ wxWindowDCImpl( owner )
{
- wxCHECK_RET( canvas, _T("invalid window in wxClientDC") );
+ wxCHECK_RET( window, _T("invalid window in wxClientDCImpl") );
- m_canvas = canvas;
- m_hDC = (WXHDC)::GetDC(GetHwndOf(m_canvas));
+ m_window = window;
+ m_hDC = (WXHDC)::GetDC(GetHwndOf(window));
// m_bOwnsDC was already set to false in the base class ctor, so the DC
// will be released (and not deleted) in ~wxDC
InitDC();
}
-void wxClientDC::InitDC()
+void wxClientDCImpl::InitDC()
{
- wxWindowDC::InitDC();
+ wxWindowDCImpl::InitDC();
// in wxUniv build we must manually do some DC adjustments usually
// performed by Windows for us
// Windows CE because they're just another control there, not anything
// special as usually under Windows
#if defined(__WXUNIVERSAL__) || defined(__WXWINCE__)
- wxPoint ptOrigin = m_canvas->GetClientAreaOrigin();
+ wxPoint ptOrigin = m_window->GetClientAreaOrigin();
if ( ptOrigin.x || ptOrigin.y )
{
// no need to shift DC origin if shift is null
}
// clip the DC to avoid overwriting the non client area
- SetClippingRegion(wxPoint(0,0), m_canvas->GetClientSize());
+ SetClippingRegion(wxPoint(0,0), m_window->GetClientSize());
#endif // __WXUNIVERSAL__ || __WXWINCE__
}
-wxClientDC::~wxClientDC()
+wxClientDCImpl::~wxClientDCImpl()
{
}
-void wxClientDC::DoGetSize(int *width, int *height) const
+void wxClientDCImpl::DoGetSize(int *width, int *height) const
{
- wxCHECK_RET( m_canvas, _T("wxClientDC without a window?") );
+ wxCHECK_RET( m_window, _T("wxClientDCImpl without a window?") );
- m_canvas->GetClientSize(width, height);
+ m_window->GetClientSize(width, height);
}
// ----------------------------------------------------------------------------
-// wxPaintDC
+// wxPaintDCImpl
// ----------------------------------------------------------------------------
// VZ: initial implementation (by JACS) only remembered the last wxPaintDC
// "wxPaintDC *" parameter to wxPaintEvent which should be used if it's
// !NULL instead of creating a new DC.
-wxArrayDCInfo wxPaintDC::ms_cache;
+IMPLEMENT_ABSTRACT_CLASS(wxPaintDCImpl, wxClientDCImpl)
-wxPaintDC::wxPaintDC()
+wxArrayDCInfo wxPaintDCImpl::ms_cache;
+
+wxPaintDCImpl::wxPaintDCImpl( wxDC *owner ) :
+ wxClientDCImpl( owner )
{
- m_canvas = NULL;
}
-wxPaintDC::wxPaintDC(wxWindow *canvas)
+wxPaintDCImpl::wxPaintDCImpl( wxDC *owner, wxWindow *window ) :
+ wxClientDCImpl( owner )
{
- wxCHECK_RET( canvas, wxT("NULL canvas in wxPaintDC ctor") );
+ wxCHECK_RET( window, wxT("NULL canvas in wxPaintDCImpl ctor") );
#ifdef __WXDEBUG__
if ( g_isPainting <= 0 )
{
- wxFAIL_MSG( wxT("wxPaintDC may be created only in EVT_PAINT handler!") );
+ wxFAIL_MSG( wxT("wxPaintDCImpl may be created only in EVT_PAINT handler!") );
return;
}
#endif // __WXDEBUG__
- m_canvas = canvas;
+ m_window = window;
// do we have a DC for this window in the cache?
wxPaintDCInfo *info = FindInCache();
}
else // not in cache, create a new one
{
- m_hDC = (WXHDC)::BeginPaint(GetHwndOf(m_canvas), &g_paintStruct);
+ m_hDC = (WXHDC)::BeginPaint(GetHwndOf(m_window), &g_paintStruct);
if (m_hDC)
- ms_cache.Add(new wxPaintDCInfo(m_canvas, this));
+ ms_cache.Add(new wxPaintDCInfo(m_window, this));
}
// Note: at this point m_hDC can be NULL under MicroWindows, when dragging.
m_clipping = true;
}
-wxPaintDC::~wxPaintDC()
+wxPaintDCImpl::~wxPaintDCImpl()
{
if ( m_hDC )
{
if ( --info->count == 0 )
{
- ::EndPaint(GetHwndOf(m_canvas), &g_paintStruct);
+ ::EndPaint(GetHwndOf(m_window), &g_paintStruct);
ms_cache.RemoveAt(index);
}
}
-wxPaintDCInfo *wxPaintDC::FindInCache(size_t *index) const
+wxPaintDCInfo *wxPaintDCImpl::FindInCache(size_t *index) const
{
wxPaintDCInfo *info = NULL;
size_t nCache = ms_cache.GetCount();
for ( size_t n = 0; n < nCache; n++ )
{
wxPaintDCInfo *info1 = &ms_cache[n];
- if ( info1->hwnd == m_canvas->GetHWND() )
+ if ( info1->hwnd == m_window->GetHWND() )
{
info = info1;
if ( index )
}
// find the entry for this DC in the cache (keyed by the window)
-WXHDC wxPaintDC::FindDCInCache(wxWindow* win)
+WXHDC wxPaintDCImpl::FindDCInCache(wxWindow* win)
{
size_t nCache = ms_cache.GetCount();
for ( size_t n = 0; n < nCache; n++ )
* wxPaintDCEx
*/
-// TODO: don't duplicate wxPaintDC code here!!
+// TODO: don't duplicate wxPaintDCImpl code here!!
-wxPaintDCEx::wxPaintDCEx(wxWindow *canvas, WXHDC dc) : saveState(0)
+class wxPaintDCExImpl: public wxPaintDCImpl
{
- wxCHECK_RET( dc, wxT("wxPaintDCEx requires an existing device context") );
+public:
+ wxPaintDCExImpl( wxDC *owner, wxWindow *window, WXHDC dc );
+ ~wxPaintDCExImpl();
+
+ int m_saveState;
+};
- m_canvas = canvas;
- wxPaintDCInfo *info = FindInCache();
- if ( info )
- {
- m_hDC = info->hdc;
- info->count++;
- }
- else // not in cache, create a new one
- {
- m_hDC = dc;
- ms_cache.Add(new wxPaintDCInfo(m_canvas, this));
- saveState = SaveDC((HDC) dc);
- }
+IMPLEMENT_ABSTRACT_CLASS(wxPaintDCEx,wxPaintDC)
+
+wxPaintDCEx::wxPaintDCEx( wxWindow *window, WXHDC dc )
+{
+ m_pimpl = new wxPaintDCExImpl( this, window, dc );
}
-wxPaintDCEx::~wxPaintDCEx()
+
+
+wxPaintDCExImpl::wxPaintDCExImpl( wxDC *owner, wxWindow *window, WXHDC dc ) :
+ wxPaintDCImpl( owner )
{
- size_t index;
- wxPaintDCInfo *info = FindInCache(&index);
+ wxCHECK_RET( dc, wxT("wxPaintDCEx requires an existing device context") );
- wxCHECK_RET( info, wxT("existing DC should have a cache entry") );
+ m_saveState = 0;
+
+ m_window = window;
- if ( --info->count == 0 )
- {
- RestoreDC((HDC) m_hDC, saveState);
- ms_cache.RemoveAt(index);
+ wxPaintDCInfo *info = FindInCache();
+ if ( info )
+ {
+ m_hDC = info->hdc;
+ info->count++;
+ }
+ else // not in cache, create a new one
+ {
+ m_hDC = dc;
+ ms_cache.Add(new wxPaintDCInfo(m_window, this));
+ m_saveState = SaveDC((HDC) dc);
+ }
+}
- // Reduce the number of bogus reports of non-freed memory
- // at app exit
- if (ms_cache.IsEmpty())
- ms_cache.Clear();
- }
- //else: cached DC entry is still in use
+wxPaintDCExImpl::~wxPaintDCExImpl()
+{
+ size_t index;
+ wxPaintDCInfo *info = FindInCache(&index);
+
+ wxCHECK_RET( info, wxT("existing DC should have a cache entry") );
- // prevent the base class dtor from ReleaseDC()ing it again
- m_hDC = 0;
+ if ( --info->count == 0 )
+ {
+ RestoreDC((HDC) m_hDC, m_saveState);
+ ms_cache.RemoveAt(index);
+
+ // Reduce the number of bogus reports of non-freed memory
+ // at app exit
+ if (ms_cache.IsEmpty())
+ ms_cache.Clear();
+ }
+ //else: cached DC entry is still in use
+
+ // prevent the base class dtor from ReleaseDC()ing it again
+ m_hDC = 0;
}
+
+
#endif
#include "wx/dcmemory.h"
+#include "wx/msw/dcmemory.h"
#ifndef WX_PRECOMP
#include "wx/utils.h"
#include "wx/msw/private.h"
// ----------------------------------------------------------------------------
-// wxWin macros
+// wxMemoryDCImpl
// ----------------------------------------------------------------------------
-IMPLEMENT_DYNAMIC_CLASS(wxMemoryDC, wxDC)
+IMPLEMENT_ABSTRACT_CLASS(wxMemoryDCImpl, wxMSWDCImpl)
-// ============================================================================
-// implementation
-// ============================================================================
+wxMemoryDCImpl::wxMemoryDCImpl( wxMemoryDC *owner )
+ : wxMSWDCImpl( owner )
+{
+ CreateCompatible(NULL);
+ Init();
+}
-// ----------------------------------------------------------------------------
-// wxMemoryDC
-// ----------------------------------------------------------------------------
+wxMemoryDCImpl::wxMemoryDCImpl( wxMemoryDC *owner, wxBitmap& bitmap )
+ : wxMSWDCImpl( owner )
+{
+ CreateCompatible(NULL);
+ Init();
+ DoSelect(bitmap);
+}
-wxMemoryDC::wxMemoryDC(wxDC *dc)
+wxMemoryDCImpl::wxMemoryDCImpl( wxMemoryDC *owner, wxDC *dc )
+ : wxMSWDCImpl( owner )
{
wxCHECK_RET( dc, _T("NULL dc in wxMemoryDC ctor") );
Init();
}
-void wxMemoryDC::Init()
+void wxMemoryDCImpl::Init()
{
if ( m_ok )
{
}
}
-bool wxMemoryDC::CreateCompatible(wxDC *dc)
+bool wxMemoryDCImpl::CreateCompatible(wxDC *dc)
{
- m_hDC = (WXHDC)::CreateCompatibleDC(dc ? GetHdcOf(*dc) : NULL);
+ wxDCImpl *impl = dc->GetImpl();
+ wxMSWDCImpl *msw_impl = wxDynamicCast( impl, wxMSWDCImpl );
+ if (!msw_impl)
+ {
+ m_ok = false;
+ return false;
+ }
+
+ m_hDC = (WXHDC)::CreateCompatibleDC(dc ? GetHdcOf(*msw_impl) : NULL);
// as we created the DC, we must delete it in the dtor
m_bOwnsDC = true;
return m_ok;
}
-void wxMemoryDC::DoSelect( const wxBitmap& bitmap)
+void wxMemoryDCImpl::DoSelect( const wxBitmap& bitmap )
{
// select old bitmap out of the device context
if ( m_oldBitmap )
}
}
-void wxMemoryDC::DoGetSize(int *width, int *height) const
+void wxMemoryDCImpl::DoGetSize(int *width, int *height) const
{
if ( m_selectedBitmap.Ok() )
{
#endif // wxUSE_MEMORY_DC_DRAW_RECTANGLE
-void wxMemoryDC::DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
+void wxMemoryDCImpl::DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
{
// Set this to 1 to work around an apparent video driver bug
// (visible with e.g. 70x70 rectangle on a memory DC; see Drawing sample)
else
#endif // wxUSE_MEMORY_DC_DRAW_RECTANGLE
{
- wxDC::DoDrawRectangle(x, y, width, height);
+ wxMSWDCImpl::DoDrawRectangle(x, y, width, height);
}
}
#if wxUSE_PRINTING_ARCHITECTURE
#include "wx/dcprint.h"
+#include "wx/msw/dcprint.h"
#ifndef WX_PRECOMP
#include "wx/msw/wrapcdlg.h"
// wxWin macros
// ----------------------------------------------------------------------------
-IMPLEMENT_CLASS(wxPrinterDC, wxDC)
+IMPLEMENT_ABSTRACT_CLASS(wxPrinterDCImpl, wxMSWDCImpl)
// ============================================================================
// implementation
// wxPrinterDC construction
// ----------------------------------------------------------------------------
+#if 0
// This form is deprecated
wxPrinterDC::wxPrinterDC(const wxString& driver_name,
const wxString& device_name,
Init();
}
+#endif
-wxPrinterDC::wxPrinterDC(const wxPrintData& printData)
+wxPrinterDCImpl::wxPrinterDCImpl( wxPrinterDC *owner, const wxPrintData& printData ) :
+ wxMSWDCImpl( owner )
{
m_printData = printData;
}
-wxPrinterDC::wxPrinterDC(WXHDC dc)
+wxPrinterDCImpl::wxPrinterDCImpl( wxPrinterDC *owner, WXHDC dc ) :
+ wxMSWDCImpl( owner )
{
m_isInteractive = false;
m_ok = true;
}
-void wxPrinterDC::Init()
+void wxPrinterDCImpl::Init()
{
if ( m_hDC )
{
}
// ----------------------------------------------------------------------------
-// wxPrinterDC {Start/End}{Page/Doc} methods
+// wxPrinterDCImpl {Start/End}{Page/Doc} methods
// ----------------------------------------------------------------------------
-bool wxPrinterDC::StartDoc(const wxString& message)
+bool wxPrinterDCImpl::StartDoc(const wxString& message)
{
DOCINFO docinfo;
docinfo.cbSize = sizeof(DOCINFO);
return true;
}
-void wxPrinterDC::EndDoc()
+void wxPrinterDCImpl::EndDoc()
{
if (m_hDC) ::EndDoc((HDC) m_hDC);
}
-void wxPrinterDC::StartPage()
+void wxPrinterDCImpl::StartPage()
{
if (m_hDC)
::StartPage((HDC) m_hDC);
}
-void wxPrinterDC::EndPage()
+void wxPrinterDCImpl::EndPage()
{
if (m_hDC)
::EndPage((HDC) m_hDC);
}
-wxRect wxPrinterDC::GetPaperRect()
+wxRect wxPrinterDCImpl::GetPaperRect()
{
- if (!Ok()) return wxRect(0, 0, 0, 0);
+ if (!IsOk()) return wxRect(0, 0, 0, 0);
int w = ::GetDeviceCaps((HDC) m_hDC, PHYSICALWIDTH);
int h = ::GetDeviceCaps((HDC) m_hDC, PHYSICALHEIGHT);
int x = -::GetDeviceCaps((HDC) m_hDC, PHYSICALOFFSETX);
}
// ----------------------------------------------------------------------------
-// wxPrinterDC bit blitting/bitmap drawing
+// wxPrinterDCImpl bit blitting/bitmap drawing
// ----------------------------------------------------------------------------
// helper of DoDrawBitmap() and DoBlit()
#endif
}
-void wxPrinterDC::DoDrawBitmap(const wxBitmap& bmp,
+void wxPrinterDCImpl::DoDrawBitmap(const wxBitmap& bmp,
wxCoord x, wxCoord y,
bool useMask)
{
memDC.SelectObjectAsSource(bmp);
- Blit(x, y, width, height, &memDC, 0, 0, wxCOPY, useMask);
+ GetOwner()->Blit(x, y, width, height, &memDC, 0, 0, wxCOPY, useMask);
memDC.SelectObject(wxNullBitmap);
}
}
-bool wxPrinterDC::DoBlit(wxCoord xdest, wxCoord ydest,
+bool wxPrinterDCImpl::DoBlit(wxCoord xdest, wxCoord ydest,
wxCoord width, wxCoord height,
wxDC *source,
wxCoord WXUNUSED(xsrc), wxCoord WXUNUSED(ysrc),
int WXUNUSED(rop), bool useMask,
wxCoord WXUNUSED(xsrcMask), wxCoord WXUNUSED(ysrcMask))
{
- wxBitmap& bmp = source->GetSelectedBitmap();
+ wxDCImpl *impl = source->GetImpl();
+ wxMSWDCImpl *msw_impl = wxDynamicCast(impl, wxMSWDCImpl);
+ if (!msw_impl)
+ return false;
+
+ wxBitmap& bmp = msw_impl->GetSelectedBitmap();
wxMask *mask = useMask ? bmp.GetMask() : NULL;
if ( mask )
{
// If we are printing source colours are screen colours not printer
// colours and so we need copy the bitmap pixel by pixel.
RECT rect;
- HDC dcSrc = GetHdcOf(*source);
+ HDC dcSrc = GetHdcOf(*msw_impl);
MemoryHDC dcMask(dcSrc);
SelectInHDC selectMask(dcMask, (HBITMAP)mask->GetMaskBitmap());
// as we are printing, source colours are screen colours not
// printer colours and so we need copy the bitmap pixel by pixel.
- HDC dcSrc = GetHdcOf(*source);
+ HDC dcSrc = GetHdcOf(*msw_impl);
RECT rect;
for (int y = 0; y < height; y++)
{
#pragma hdrstop
#endif
-#include "wx/dcscreen.h"
+#include "wx/msw/dcscreen.h"
#ifndef WX_PRECOMP
#include "wx/string.h"
#include "wx/msw/private.h"
-IMPLEMENT_DYNAMIC_CLASS(wxScreenDC, wxDC)
+IMPLEMENT_ABSTRACT_CLASS(wxScreenDCImpl, wxMSWDCImpl)
// Create a DC representing the whole screen
-wxScreenDC::wxScreenDC()
+wxScreenDCImpl::wxScreenDCImpl( wxScreenDC *owner ) :
+ wxMSWDCImpl( owner )
{
m_hDC = (WXHDC) ::GetDC((HWND) NULL);
// DrawText() to OPAQUE as required, otherwise always TRANSPARENT
::SetBkMode( GetHdc(), TRANSPARENT );
}
+
#include "wx/intl.h"
#endif //WX_PRECOMP
+#include "wx/dc.h"
+#include "wx/msw/dc.h"
+
#include "wx/metafile.h"
#include "wx/clipbrd.h"
// ----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxEnhMetaFile, wxObject)
-IMPLEMENT_ABSTRACT_CLASS(wxEnhMetaFileDC, wxDC)
// ----------------------------------------------------------------------------
// macros
rect.bottom = size.y;
}
- if ( !::PlayEnhMetaFile(GetHdcOf(*dc), GetEMF(), &rect) )
+ wxDCImpl *impl = dc->GetImpl();
+ wxMSWDCImpl *msw_impl = wxDynamicCast( impl, wxMSWDCImpl );
+ if (!msw_impl)
+ return false;
+
+ if ( !::PlayEnhMetaFile(GetHdcOf(*msw_impl), GetEMF(), &rect) )
{
wxLogLastError(_T("PlayEnhMetaFile"));
// wxEnhMetaFileDC
// ----------------------------------------------------------------------------
+class wxEnhMetaFileDCImpl : public wxMSWDCImpl
+{
+public:
+ wxEnhMetaFileDCImpl( wxEnhMetaFileDC *owner,
+ const wxString& filename, int width, int height,
+ const wxString& description );
+ virtual ~wxEnhMetaFileDCImpl();
+
+ // obtain a pointer to the new metafile (caller should delete it)
+ wxEnhMetaFile *Close();
+
+protected:
+ virtual void DoGetSize(int *width, int *height) const;
+
+private:
+ // size passed to ctor and returned by DoGetSize()
+ int m_width,
+ m_height;
+};
+
+
+IMPLEMENT_ABSTRACT_CLASS(wxEnhMetaFileDC, wxDC)
+
wxEnhMetaFileDC::wxEnhMetaFileDC(const wxString& filename,
int width, int height,
const wxString& description)
+{
+ m_pimpl = new wxEnhMetaFileDCImpl( this, filename, width, height, description );
+}
+
+
+wxEnhMetaFileDCImpl::wxEnhMetaFileDCImpl( wxEnhMetaFileDC* owner,
+ const wxString& filename,
+ int width, int height,
+ const wxString& description )
+ : wxMSWDCImpl( owner )
{
m_width = width;
m_height = height;
}
}
-void wxEnhMetaFileDC::DoGetSize(int *width, int *height) const
+void wxEnhMetaFileDCImpl::DoGetSize(int *width, int *height) const
{
if ( width )
*width = m_width;
*height = m_height;
}
-wxEnhMetaFile *wxEnhMetaFileDC::Close()
+wxEnhMetaFile *wxEnhMetaFileDCImpl::Close()
{
- wxCHECK_MSG( Ok(), NULL, _T("invalid wxEnhMetaFileDC") );
+ wxCHECK_MSG( IsOk(), NULL, _T("invalid wxEnhMetaFileDC") );
HENHMETAFILE hMF = ::CloseEnhMetaFile(GetHdc());
if ( !hMF )
return mf;
}
-wxEnhMetaFileDC::~wxEnhMetaFileDC()
+wxEnhMetaFileDCImpl::~wxEnhMetaFileDCImpl()
{
// avoid freeing it in the base class dtor
m_hDC = 0;
#endif
#include "wx/imaglist.h"
+#include "wx/dc.h"
+#include "wx/msw/dc.h"
#include "wx/msw/private.h"
// ----------------------------------------------------------------------------
int flags,
bool solidBackground)
{
- HDC hDC = GetHdcOf(dc);
+ wxDCImpl *impl = dc.GetImpl();
+ wxMSWDCImpl *msw_impl = wxDynamicCast( impl, wxMSWDCImpl );
+ if (!msw_impl)
+ return false;
+
+ HDC hDC = GetHdcOf(*msw_impl);
wxCHECK_MSG( hDC, false, _T("invalid wxDC in wxImageList::Draw") );
COLORREF clr = CLR_NONE; // transparent by default
hbr = GetHbrushOf(brush);
}
- ::FillRect(GetHdcOf(memdc), &rc, hbr);
+ wxMSWDCImpl *impl = (wxMSWDCImpl*) memdc.GetImpl();
- MSWDefWindowProc(WM_PAINT, (WPARAM)memdc.GetHDC(), 0);
+ ::FillRect(GetHdcOf(*impl), &rc, hbr);
+
+ MSWDefWindowProc(WM_PAINT, (WPARAM)(impl->GetHDC()), 0);
// For some reason in RTL mode, source offset has to be -1, otherwise the
// right border (physical) remains unpainted.
}
- HDC hdc = GetHdcOf(dc);
+ wxMSWDCImpl *impl = (wxMSWDCImpl*) dc.GetImpl();
+ HDC hdc = GetHdcOf(*impl);
COLORREF colOldText = ::SetTextColor(hdc, colText),
colOldBack = ::SetBkColor(hdc, colBack);
#include "wx/printdlg.h"
#include "wx/msw/printdlg.h"
+#include "wx/msw/dcprint.h"
#include "wx/paper.h"
#include <stdlib.h>
if ( ret && (pd->hDC) )
{
- wxPrinterDC *pdc = new wxPrinterDC( (WXHDC) pd->hDC );
+ wxPrinterDC *pdc = new wxPrinterDCFromHDC( (WXHDC) pd->hDC );
m_printerDC = pdc;
ConvertFromNative( m_printDialogData );
return wxID_OK;
#include "wx/msw/printwin.h"
#include "wx/msw/printdlg.h"
#include "wx/msw/private.h"
+#include "wx/msw/dcprint.h"
#include <stdlib.h>
}
// May have pressed cancel.
- if (!dc || !dc->Ok())
+ if (!dc || !dc->IsOk())
{
if (dc) delete dc;
return false;
}
+ wxPrinterDCImpl *impl = (wxPrinterDCImpl*) dc->GetImpl();
+
HDC hdc = ::GetDC(NULL);
int logPPIScreenX = ::GetDeviceCaps(hdc, LOGPIXELSX);
int logPPIScreenY = ::GetDeviceCaps(hdc, LOGPIXELSY);
::ReleaseDC(NULL, hdc);
- int logPPIPrinterX = ::GetDeviceCaps((HDC) dc->GetHDC(), LOGPIXELSX);
- int logPPIPrinterY = ::GetDeviceCaps((HDC) dc->GetHDC(), LOGPIXELSY);
+ int logPPIPrinterX = ::GetDeviceCaps((HDC) impl->GetHDC(), LOGPIXELSX);
+ int logPPIPrinterY = ::GetDeviceCaps((HDC) impl->GetHDC(), LOGPIXELSY);
if (logPPIPrinterX == 0 || logPPIPrinterY == 0)
{
delete dc;
#if defined(__WATCOMC__) || defined(__BORLANDC__) || defined(__GNUWIN32__) || defined(__SALFORDC__) || !defined(__WIN32__)
#ifdef STRICT
- ::SetAbortProc((HDC) dc->GetHDC(), (ABORTPROC) m_lpAbortProc);
+ ::SetAbortProc((HDC) impl->GetHDC(), (ABORTPROC) m_lpAbortProc);
#else
- ::SetAbortProc((HDC) dc->GetHDC(), (FARPROC) m_lpAbortProc);
+ ::SetAbortProc((HDC) impl->GetHDC(), (FARPROC) m_lpAbortProc);
#endif
#else
- ::SetAbortProc((HDC) dc->GetHDC(), (int (_stdcall *)
+ ::SetAbortProc((HDC) impl->GetHDC(), (int (_stdcall *)
// cast it to right type only if required
// FIXME it's really cdecl and we're casting it to stdcall - either there is
// something I don't understand or it will crash at first usage
wxRect paperRect;
- if ( printerDC.Ok() )
+ if ( printerDC.IsOk() )
{
- HDC dc = GetHdcOf(printerDC);
+ wxPrinterDCImpl *impl = (wxPrinterDCImpl*) printerDC.GetImpl();
+ HDC dc = GetHdcOf(*impl);
printerWidthMM = ::GetDeviceCaps(dc, HORZSIZE);
printerHeightMM = ::GetDeviceCaps(dc, VERTSIZE);
printerXRes = ::GetDeviceCaps(dc, HORZRES);
if ( flags & wxCONTROL_PRESSED )
style |= DFCS_PUSHED | DFCS_FLAT;
- ::DrawFrameControl(GetHdcOf(dc), &r, DFC_SCROLL, style);
+ ::DrawFrameControl(GetHdcOf(*((wxMSWDCImpl*)dc.GetImpl())), &r, DFC_SCROLL, style);
}
void
if ( flags & wxCONTROL_CURRENT )
style |= DFCS_HOT;
- ::DrawFrameControl(GetHdcOf(dc), &r, DFC_BUTTON, style);
+ ::DrawFrameControl(GetHdcOf(*((wxMSWDCImpl*)dc.GetImpl())), &r, DFC_BUTTON, style);
}
void
RECT rc;
wxCopyRectToRECT(rect, rc);
- ::DrawFrameControl(GetHdcOf(dc), &rc, DFC_BUTTON, style);
+ ::DrawFrameControl(GetHdcOf(*((wxMSWDCImpl*)dc.GetImpl())), &rc, DFC_BUTTON, style);
}
void wxRendererMSW::DrawFocusRect(wxWindow * WXUNUSED(win),
RECT rc;
wxCopyRectToRECT(rect, rc);
- ::DrawFocusRect(GetHdcOf(dc), &rc);
+ ::DrawFocusRect(GetHdcOf(*((wxMSWDCImpl*)dc.GetImpl())), &rc);
}
int wxRendererMSW::GetHeaderButtonHeight(wxWindow * WXUNUSED(win))
wxUxThemeEngine::Get()->DrawThemeBackground
(
hTheme,
- GetHdcOf(dc),
+ GetHdcOf(*((wxMSWDCImpl*)dc.GetImpl())),
CP_DROPDOWNBUTTON,
state,
&r,
wxUxThemeEngine::Get()->DrawThemeBackground
(
hTheme,
- GetHdcOf(dc),
+ GetHdcOf(*((wxMSWDCImpl*)dc.GetImpl())),
HP_HEADERITEM,
state,
&r,
wxUxThemeEngine::Get()->DrawThemeBackground
(
hTheme,
- GetHdcOf(dc),
+ GetHdcOf(*((wxMSWDCImpl*)dc.GetImpl())),
TVP_GLYPH,
state,
&r,
wxUxThemeEngine::Get()->DrawThemeBackground
(
hTheme,
- GetHdcOf(dc),
+ GetHdcOf(*((wxMSWDCImpl*)dc.GetImpl())),
BP_CHECKBOX,
state,
&r,
wxUxThemeEngine::Get()->DrawThemeBackground
(
hTheme,
- GetHdcOf(dc),
+ GetHdcOf(*((wxMSWDCImpl*)dc.GetImpl())),
BP_PUSHBUTTON,
state,
&r,
// 3. this is backwards compatible behaviour and some people rely on it,
// see http://groups.google.com/groups?selm=4252E932.3080801%40able.es
wxWindow *parent = GetParent();
- HBRUSH hbr = (HBRUSH)parent->MSWGetBgBrush(dc.GetHDC(), GetHWND());
+ wxMSWDCImpl *impl = (wxMSWDCImpl*) dc.GetImpl();
+ HBRUSH hbr = (HBRUSH)parent->MSWGetBgBrush(impl->GetHDC(), GetHWND());
// if there is no special brush for painting this control, just use the
// solid background colour
hbr = GetHbrushOf(brush);
}
- ::FillRect(GetHdcOf(dc), &rc, hbr);
+ ::FillRect(GetHdcOf(*impl), &rc, hbr);
}
void wxStaticBox::PaintForeground(wxDC& dc, const RECT& rc)
{
- MSWDefWindowProc(WM_PAINT, (WPARAM)GetHdcOf(dc), 0);
+ wxMSWDCImpl *impl = (wxMSWDCImpl*) dc.GetImpl();
+ MSWDefWindowProc(WM_PAINT, (WPARAM)GetHdcOf(*impl), 0);
// when using XP themes, neither setting the text colour nor transparent
// background mode doesn't change anything: the static box def window proc
if ( m_hasFgCol && wxUxThemeEngine::GetIfActive() )
{
// draw over the text in default colour in our colour
- HDC hdc = GetHdcOf(dc);
+ HDC hdc = GetHdcOf(*impl);
::SetTextColor(hdc, GetForegroundColour().GetPixel());
const bool rtl = wxTheApp->GetLayoutDirection() == wxLayout_RightToLeft;
// the label: this is consistent with the behaviour under pre-XP
// systems (i.e. without visual themes) and generally makes sense
wxBrush brush = wxBrush(GetBackgroundColour());
- ::FillRect(GetHdcOf(dc), &dimensions, GetHbrushOf(brush));
+ wxMSWDCImpl *impl = (wxMSWDCImpl*) dc.GetImpl();
+ ::FillRect(GetHdcOf(*impl), &dimensions, GetHbrushOf(brush));
}
else // paint parent background
{
// and also the box itself
MSWGetRegionWithoutSelf((WXHRGN) hrgn, rc.right, rc.bottom);
- HDCClipper clipToBg(GetHdcOf(dc), hrgn);
+ wxMSWDCImpl *impl = (wxMSWDCImpl*) dc.GetImpl();
+ HDCClipper clipToBg(GetHdcOf(*impl), hrgn);
// paint the inside of the box (excluding box itself and child controls)
PaintBackground(dc, rc);
#endif
#include "wx/sysopt.h"
+#include "wx/dcclient.h"
#include "wx/msw/private.h"
void wxToolBar::OnEraseBackground(wxEraseEvent& event)
{
RECT rect = wxGetClientRect(GetHwnd());
- HDC hdc = GetHdcOf((*event.GetDC()));
+
+ wxDC *dc = event.GetDC();
+ if (!dc) return;
+ wxMSWDCImpl *impl = (wxMSWDCImpl*) dc->GetImpl();
+ HDC hdc = GetHdcOf(*impl);
int majorVersion, minorVersion;
wxGetOsVersion(& majorVersion, & minorVersion);
r.right = clientSize.x;
r.top = 0;
r.bottom = clientSize.y;
-
- HRESULT hr = theme->DrawThemeBackground(hTheme, (HDC) dc.GetHDC(), 0, 0, & r, & clipRect);
+
+ wxMSWDCImpl *impl = (wxMSWDCImpl*) dc.GetImpl();
+ HRESULT hr = theme->DrawThemeBackground(hTheme, GetHdcOf(*impl), 0, 0, & r, & clipRect);
if ( hr == S_OK )
haveRefreshed = true;
}
#endif
#include "wx/msw/private.h"
+#include "wx/msw/dcclient.h"
#if wxUSE_TOOLTIPS
#include "wx/tooltip.h"
wxUxThemeHandle hTheme((wxWindow *)this, L"EDIT");
RECT rcClient = { 0, 0, 0, 0 };
wxClientDC dc((wxWindow *)this);
+ wxMSWDCImpl *impl = (wxMSWDCImpl*) dc.GetImpl();
if (theme->GetThemeBackgroundContentRect(
- hTheme, GetHdcOf(dc), EP_EDITTEXT, ETS_NORMAL,
+ hTheme, GetHdcOf(*impl), EP_EDITTEXT, ETS_NORMAL,
&rect, &rcClient) == S_OK)
{
InflateRect(&rcClient, -1, -1);
wxUxThemeHandle hTheme((wxWindow *)this, L"EDIT");
wxWindowDC dc((wxWindow *)this);
+ wxMSWDCImpl *impl = (wxMSWDCImpl*) dc.GetImpl();
// Clip the DC so that you only draw on the non-client area
RECT rcBorder;
RECT rcClient;
theme->GetThemeBackgroundContentRect(
- hTheme, GetHdcOf(dc), EP_EDITTEXT, ETS_NORMAL, &rcBorder, &rcClient);
+ hTheme, GetHdcOf(*impl), EP_EDITTEXT, ETS_NORMAL, &rcBorder, &rcClient);
InflateRect(&rcClient, -1, -1);
- ::ExcludeClipRect(GetHdcOf(dc), rcClient.left, rcClient.top,
+ ::ExcludeClipRect(GetHdcOf(*impl), rcClient.left, rcClient.top,
rcClient.right, rcClient.bottom);
// Make sure the background is in a proper state
if (theme->IsThemeBackgroundPartiallyTransparent(hTheme, EP_EDITTEXT, ETS_NORMAL))
{
- theme->DrawThemeParentBackground(GetHwnd(), GetHdcOf(dc), &rcBorder);
+ theme->DrawThemeParentBackground(GetHwnd(), GetHdcOf(*impl), &rcBorder);
}
// Draw the border
// nState = ETS_READONLY;
else
nState = ETS_NORMAL;
- theme->DrawThemeBackground(hTheme, GetHdcOf(dc), EP_EDITTEXT, nState, &rcBorder, NULL);
+ theme->DrawThemeBackground(hTheme, GetHdcOf(*impl), EP_EDITTEXT, nState, &rcBorder, NULL);
}
}
break;
#ifdef __WXUNIVERSAL__
event.Skip();
#else
- HDC hDC = (HDC) wxPaintDC::FindDCInCache((wxWindow*) event.GetEventObject());
+ HDC hDC = (HDC) wxPaintDCImpl::FindDCInCache((wxWindow*) event.GetEventObject());
if (hDC != 0)
{
MSWDefWindowProc(WM_PAINT, (WPARAM) hDC, 0);
bool wxWindowMSW::HandleEraseBkgnd(WXHDC hdc)
{
wxDCTemp dc(hdc, GetClientSize());
+ wxDCTempImpl *impl = (wxDCTempImpl*) dc.GetImpl();
- dc.SetHDC(hdc);
- dc.SetWindow((wxWindow *)this);
+ impl->SetHDC(hdc);
+ impl->SetWindow((wxWindow *)this);
wxEraseEvent event(m_windowId, &dc);
event.SetEventObject(this);
bool rc = HandleWindowEvent(event);
// must be called manually as ~wxDC doesn't do anything for wxDCTemp
- dc.SelectOldObjects(hdc);
+ impl->SelectOldObjects(hdc);
return rc;
}
return;
}
+ wxDC *dc = event.GetDC();
+ if (!dc) return;
+ wxMSWDCImpl *impl = (wxMSWDCImpl*) dc->GetImpl();
// do default background painting
- if ( !DoEraseBackground(GetHdcOf(*event.GetDC())) )
+ if ( !DoEraseBackground(GetHdcOf(*impl)) )
{
// let the system paint the background
event.Skip();