Further wxDC changes

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@49949 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
2007-11-14 14:49:40 +00:00
parent 677dc0ed1a
commit 4f37154e98
16 changed files with 493 additions and 284 deletions

View File

@@ -434,14 +434,19 @@ public:
virtual void DoDrawLines(int n, wxPoint points[],
wxCoord xoffset, wxCoord yoffset) = 0;
wxCoord xoffset, wxCoord yoffset ) = 0;
virtual void DrawLines(const wxPointList *list,
wxCoord xoffset, wxCoord yoffset );
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);
void DrawPolygon(const wxPointList *list,
wxCoord xoffset, wxCoord yoffset,
int fillStyle );
#if wxUSE_SPLINES
@@ -450,6 +455,26 @@ public:
virtual void DoDrawSpline(const wxPointList *points);
#endif
// ---------------------------------------------------------
// wxMemoryDC Impl API
virtual void DoSelect(const wxBitmap& WXUNUSED(bmp))
{ }
virtual const wxBitmap& GetSelectedBitmap() const
{ return wxNullBitmap; }
virtual wxBitmap& GetSelectedBitmap()
{ return wxNullBitmap; }
// ---------------------------------------------------------
// wxPrinterDC Impl API
virtual wxRect GetPaperRect()
{ int w = 0; int h = 0; DoGetSize( &w, &h ); return wxRect(0,0,w,h); }
virtual int GetResolution()
{ return -1; }
private:
wxDC *m_owner;
@@ -562,6 +587,9 @@ public:
wxSize GetPPI() const
{ return m_pimpl->GetPPI(); }
virtual int GetResolution()
{ return m_pimpl->GetResolution(); }
// Right-To-Left (RTL) modes
void SetLayoutDirection(wxLayoutDirection dir)
@@ -847,30 +875,31 @@ public:
void DrawLines(int n, wxPoint points[],
wxCoord xoffset = 0, wxCoord yoffset = 0)
{ m_pimpl->DoDrawLines(n, points, xoffset, yoffset); }
#if 0
// needs to be removed
void DrawLines(const wxPointList *list,
wxCoord xoffset = 0, wxCoord yoffset = 0)
#endif
{ m_pimpl->DrawLines( list, xoffset, yoffset ); }
#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)
{ m_pimpl->DoDrawPolygon(n, points, xoffset, yoffset, fillStyle); }
#if 0
// needs to be removed
void DrawPolygon(const wxPointList *list,
wxCoord xoffset = 0, wxCoord yoffset = 0,
int fillStyle = wxODDEVEN_RULE)
{ m_pimpl->DrawPolygon( list, xoffset, yoffset, fillStyle ); }
#endif
void DrawPolyPolygon(int n, int count[], wxPoint points[],
wxCoord xoffset = 0, wxCoord yoffset = 0,
int fillStyle = wxODDEVEN_RULE)
{ m_pimpl->DoDrawPolyPolygon(n, count, points, xoffset, yoffset, fillStyle); }
#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 DrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
{ m_pimpl->DoDrawRectangle(x, y, width, height); }
@@ -1477,6 +1506,9 @@ public:
// 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; }

View File

@@ -22,18 +22,6 @@
// wxMemoryDC
//-----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxMemoryImplDCBase
{
public:
wxMemoryImplDCBase() { }
virtual void DoSelect(const wxBitmap& bmp) = 0;
virtual const wxBitmap& DoGetSelectedBitmap() const = 0;
virtual wxBitmap& DoGetSelectedBitmap() = 0;
};
class WXDLLIMPEXP_CORE wxMemoryDC: public wxDC
{
public:

View File

@@ -24,21 +24,17 @@
// wxPrinterDC
//-----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxPrinterImplDCBase
{
public:
wxPrinterImplDCBase() { }
virtual wxRect DoGetPaperRect() = 0;
};
class WXDLLIMPEXP_CORE wxPrinterDC: public wxDC
{
public:
wxPrinterDC();
wxPrinterDC( const wxPrintData& data );
wxRect GetPaperRect();
int GetResolution();
private:
DECLARE_DYNAMIC_CLASS()
};
#else

View File

@@ -22,6 +22,13 @@ class WXDLLIMPEXP_CORE wxScreenDC : public wxWindowDC
public:
wxScreenDC();
static bool StartDrawingOnTop(wxWindow * WXUNUSED(window))
{ return true; }
static bool StartDrawingOnTop(wxRect * WXUNUSED(rect) = NULL)
{ return true; }
static bool EndDrawingOnTop()
{ return true; }
private:
DECLARE_DYNAMIC_CLASS(wxScreenDC)
};

View File

@@ -16,6 +16,7 @@
#if wxUSE_PRINTING_ARCHITECTURE && wxUSE_POSTSCRIPT
#include "wx/dc.h"
#include "wx/dcprint.h"
#include "wx/dialog.h"
#include "wx/module.h"
#include "wx/cmndata.h"
@@ -25,7 +26,10 @@
// wxPostScriptDC
//-----------------------------------------------------------------------------
class WXDLLEXPORT wxPostScriptDC: public wxDC
#if wxUSE_NEW_DC
class WXDLLEXPORT wxPostScriptDC : public wxDC
{
public:
wxPostScriptDC();
@@ -33,7 +37,35 @@ public:
// Recommended constructor
wxPostScriptDC(const wxPrintData& printData);
virtual ~wxPostScriptDC();
private:
DECLARE_DYNAMIC_CLASS(wxPostScriptDC)
};
#endif
#if wxUSE_NEW_DC
class WXDLLEXPORT wxPostScriptImplDC : public wxImplDC
#else
#define wxPostScriptImplDC 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 );
#else
wxPostScriptDC();
// Recommended constructor
wxPostScriptDC(const wxPrintData& printData);
#endif
void Init();
virtual ~wxPostScriptImplDC();
virtual bool Ok() const { return IsOk(); }
virtual bool IsOk() const;
@@ -83,12 +115,12 @@ public:
virtual int GetDepth() const { return 24; }
static void SetResolution(int ppi);
static int GetResolution();
void PsPrint( const wxString& psdata );
private:
// Overrridden for wxPrinterDC Impl
virtual int GetResolution();
virtual wxRect GetPaperRect();
protected:
bool DoFloodFill(wxCoord x1, wxCoord y1, const wxColour &col, int style = wxFLOOD_SURFACE);
@@ -106,7 +138,7 @@ protected:
void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
#if wxUSE_SPLINES
void DoDrawSpline(const wxPointList *points);
#endif // wxUSE_SPLINES
#endif
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);
@@ -136,7 +168,7 @@ protected:
double m_pageHeight;
private:
DECLARE_DYNAMIC_CLASS(wxPostScriptDC)
DECLARE_DYNAMIC_CLASS(wxPostScriptImplDC)
};
#endif

View File

@@ -18,7 +18,7 @@
#if wxUSE_NEW_DC
class WXDLLIMPEXP_CORE wxGTKMemoryImplDC : public wxGTKWindowImplDC, public wxMemoryImplDCBase
class WXDLLIMPEXP_CORE wxGTKMemoryImplDC : public wxGTKWindowImplDC
#else
#define wxGTKMemoryImplDC wxMemoryDC
class WXDLLIMPEXP_CORE wxMemoryDC : public wxWindowDC, public wxMemoryDCBase
@@ -48,19 +48,19 @@ public:
virtual void SetTextForeground( const wxColour &col );
virtual void SetTextBackground( const wxColour &col );
// implementation
wxBitmap GetSelectedBitmap() const { return m_selected; }
protected:
// overridden from wxImplDC
virtual void DoGetSize( int *width, int *height ) const;
virtual wxBitmap DoGetAsBitmap(const wxRect *subrect) const;
// overridden from wxMemoryImplDCBase
// overridden for wxMemoryDC Impl
virtual void DoSelect(const wxBitmap& bitmap);
virtual const wxBitmap& DoGetSelectedBitmap() const;
virtual wxBitmap& DoGetSelectedBitmap();
public:
virtual const wxBitmap& GetSelectedBitmap() const;
virtual wxBitmap& GetSelectedBitmap();
private:
wxBitmap m_selected;
private:

View File

@@ -91,7 +91,11 @@ public:
virtual wxPageSetupDialogBase *CreatePageSetupDialog( wxWindow *parent,
wxPageSetupDialogData * data = NULL );
#if wxUSE_NEW_DC
virtual wxImplDC* CreatePrinterImplDC( wxPrinterDC *owner, const wxPrintData& data );
#else
virtual wxDC* CreatePrinterDC( const wxPrintData& data );
#endif
virtual bool HasPrintSetupDialog();
virtual wxDialog *CreatePrintSetupDialog( wxWindow *parent, wxPrintData *data );
@@ -207,11 +211,20 @@ private:
// wxGnomePrinterDC
//-----------------------------------------------------------------------------
class wxGnomePrinterDC: public wxDC
#if wxUSE_NEW_DC
class wxGnomePrinterImplDC : public wxImplDC
#else
#define wxGnomePrinterImplDC wxGnomePrinterDC
class wxGnomePrinterDC : public wxDC
#endif
{
public:
#if wxUSE_NEW_DC
wxGnomePrinterImplDC( wxPrinterDC *owner, const wxPrintData& data );
#else
wxGnomePrinterDC( const wxPrintData& data );
virtual ~wxGnomePrinterDC();
#endif
virtual ~wxGnomePrinterImplDC();
bool Ok() const { return IsOk(); }
bool IsOk() const;
@@ -235,8 +248,6 @@ public:
virtual int GetDepth() const { return 24; }
void SetBackgroundMode(int WXUNUSED(mode)) { }
void SetPalette(const wxPalette& WXUNUSED(palette)) { }
static void SetResolution(int ppi);
static int GetResolution();
protected:
bool DoFloodFill(wxCoord x1, wxCoord y1, const wxColour &col, int style=wxFLOOD_SURFACE );
@@ -274,6 +285,10 @@ protected:
void SetPrintData(const wxPrintData& data);
wxPrintData& GetPrintData() { return m_printData; }
// overriden for wxPrinterDC Impl
virtual wxRect GetPaperRect();
virtual int GetResolution();
private:
wxPrintData m_printData;
PangoContext *m_context;
@@ -292,8 +307,8 @@ private:
void makeEllipticalPath(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
private:
DECLARE_DYNAMIC_CLASS(wxGnomePrinterDC)
DECLARE_NO_COPY_CLASS(wxGnomePrinterDC)
DECLARE_DYNAMIC_CLASS(wxGnomePrinterImplDC)
DECLARE_NO_COPY_CLASS(wxGnomePrinterImplDC)
};
// ----------------------------------------------------------------------------

View File

@@ -53,7 +53,11 @@ public:
virtual wxPageSetupDialogBase *CreatePageSetupDialog( wxWindow *parent,
wxPageSetupDialogData * data = NULL );
#if wxUSE_NEW_DC
virtual wxImplDC* CreatePrinterImplDC( wxPrinterDC *owner, const wxPrintData& data );
#else
virtual wxDC* CreatePrinterDC( const wxPrintData& data );
#endif
virtual bool HasPrintSetupDialog();
virtual wxDialog *CreatePrintSetupDialog( wxWindow *parent, wxPrintData *data );
@@ -218,11 +222,20 @@ private:
// wxGtkPrinterDC
//-----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxGtkPrinterDC: public wxDC
#if wxUSE_NEW_DC
class WXDLLIMPEXP_CORE wxGtkPrinterImplDC : public wxImplDC
#else
#define wxGtkPrinterImplDC wxGtkPrinterDC
class WXDLLIMPEXP_CORE wxGtkPrinterDC : public wxDC
#endif
{
public:
#if wxUSE_NEW_DC
wxGtkPrinterImplDC( wxPrinterDC *owner, const wxPrintData& data );
#else
wxGtkPrinterDC( const wxPrintData& data );
virtual ~wxGtkPrinterDC();
#endif
virtual ~wxGtkPrinterImplDC();
bool Ok() const { return IsOk(); }
bool IsOk() const;
@@ -247,7 +260,10 @@ public:
void SetBackgroundMode(int mode);
void SetPalette(const wxPalette& WXUNUSED(palette)) { }
void SetResolution(int ppi);
int GetResolution();
// overriden for wxPrinterDC Impl
virtual int GetResolution();
virtual wxRect GetPaperRect();
protected:
bool DoFloodFill(wxCoord x1, wxCoord y1, const wxColour &col, int style=wxFLOOD_SURFACE );
@@ -304,8 +320,8 @@ private:
double m_PS2DEV;
double m_DEV2PS;
DECLARE_DYNAMIC_CLASS(wxGtkPrinterDC)
DECLARE_NO_COPY_CLASS(wxGtkPrinterDC)
DECLARE_DYNAMIC_CLASS(wxGtkPrinterImplDC)
DECLARE_NO_COPY_CLASS(wxGtkPrinterImplDC)
};
// ----------------------------------------------------------------------------