DC reorganization

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@50348 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
2007-11-30 13:48:22 +00:00
parent 908eeca88d
commit 888dde65f4
85 changed files with 1831 additions and 2836 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -41,7 +41,7 @@
// 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.
@@ -149,7 +149,7 @@ private:
// 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.
@@ -219,7 +219,7 @@ private:
#ifdef __WXDEBUG__
class wxAutoBufferedPaintDC : public wxAutoBufferedPaintDCBase
class WXDLLIMPEXP_CORE wxAutoBufferedPaintDC : public wxAutoBufferedPaintDCBase
{
public:
@@ -247,7 +247,7 @@ private:
#else // !__WXDEBUG__
// In release builds, just use typedef
typedef wxAutoBufferedPaintDCBase wxAutoBufferedPaintDC;
typedef WXDLLIMPEXP_CORE wxAutoBufferedPaintDCBase wxAutoBufferedPaintDC;
#endif

View File

@@ -12,31 +12,49 @@
#ifndef _WX_DCCLIENT_H_BASE_
#define _WX_DCCLIENT_H_BASE_
#include "wx/defs.h"
#include "wx/dc.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
//-----------------------------------------------------------------------------
// 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_

View File

@@ -20,27 +20,32 @@
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();
@@ -190,6 +195,10 @@ protected:
double m_formerScaleX, m_formerScaleY;
wxGraphicsContext* m_graphicContext;
private:
DECLARE_CLASS(wxGCDCImpl)
DECLARE_NO_COPY_CLASS(wxGCDCImpl)
};
#endif

View File

@@ -15,9 +15,6 @@
#include "wx/dc.h"
#include "wx/bitmap.h"
#if wxUSE_NEW_DC
//-----------------------------------------------------------------------------
// wxMemoryDC
//-----------------------------------------------------------------------------
@@ -44,70 +41,5 @@ private:
};
#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_

View File

@@ -16,8 +16,6 @@
#if wxUSE_PRINTING_ARCHITECTURE
#if wxUSE_NEW_DC
#include "wx/dc.h"
//-----------------------------------------------------------------------------
@@ -38,22 +36,9 @@ private:
DECLARE_DYNAMIC_CLASS()
};
#else
#endif
// wxUSE_PRINTING_ARCHITECTURE
#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
// _WX_DCPRINT_H_BASE_

View File

@@ -15,9 +15,7 @@
#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();
@@ -33,32 +31,6 @@ private:
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_

View File

@@ -31,23 +31,23 @@ class WXDLLIMPEXP_FWD_BASE wxFileOutputStream;
#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; }
@@ -217,7 +217,7 @@ private:
double m_dpi;
private:
DECLARE_ABSTRACT_CLASS(wxSVGFileImplDC)
DECLARE_ABSTRACT_CLASS(wxSVGFileDCImpl)
};
@@ -228,7 +228,7 @@ public:
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

View File

@@ -44,18 +44,18 @@ private:
#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();
@@ -65,7 +65,7 @@ public:
void Init();
virtual ~wxPostScriptImplDC();
virtual ~wxPostScriptDCImpl();
virtual bool Ok() const { return IsOk(); }
virtual bool IsOk() const;
@@ -168,7 +168,7 @@ protected:
double m_pageHeight;
private:
DECLARE_DYNAMIC_CLASS(wxPostScriptImplDC)
DECLARE_DYNAMIC_CLASS(wxPostScriptDCImpl)
};
#endif

View File

@@ -23,6 +23,7 @@
#include "wx/printdlg.h"
#include "wx/listctrl.h"
#include "wx/dc.h"
#if wxUSE_POSTSCRIPT
#include "wx/dcps.h"
#endif

View File

@@ -395,10 +395,7 @@ public:
virtual ~wxGraphicsContext();
static wxGraphicsContext* Create( const wxWindowDC& dc) ;
#ifdef __WXMSW__
static wxGraphicsContext * Create( const wxMemoryDC& dc) ;
#endif
static wxGraphicsContext* CreateFromNative( void * context ) ;
@@ -654,9 +651,8 @@ public :
// 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;

View File

@@ -414,7 +414,7 @@ protected:
virtual void DoSetIndent();
private:
friend class wxDataViewCtrlDC;
friend class wxDataViewCtrlDCImpl;
friend class wxDataViewColumn;
friend class wxGtkDataViewModelNotifier;
GtkWidget *m_treeview;

View File

@@ -15,22 +15,11 @@
// 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); };
@@ -52,10 +41,10 @@ protected:
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

View File

@@ -11,33 +11,23 @@
#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; }
@@ -116,14 +106,13 @@ public:
// 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;
@@ -137,63 +126,43 @@ public:
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__

View File

@@ -10,33 +10,21 @@
#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:
wxMemoryDCImpl( wxMemoryDC *owner );
wxMemoryDCImpl( wxMemoryDC *owner, wxBitmap& bitmap );
wxMemoryDCImpl( wxMemoryDC *owner, wxDC *dc );
#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
virtual ~wxGTKMemoryImplDC();
virtual ~wxMemoryDCImpl();
// these get reimplemented for mono-bitmaps to behave
// more like their Win32 couterparts. They now interpret
@@ -49,7 +37,7 @@ public:
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;
@@ -66,7 +54,9 @@ private:
private:
void Init();
DECLARE_ABSTRACT_CLASS(wxGTKMemoryImplDC)
DECLARE_ABSTRACT_CLASS(wxMemoryDCImpl)
};
#endif // _WX_GTK_DCMEMORY_H_
#endif
// _WX_GTK_DCMEMORY_H_

View File

@@ -10,35 +10,18 @@
#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;
@@ -46,7 +29,7 @@ protected:
void Init();
private:
DECLARE_ABSTRACT_CLASS(wxGTKScreenImplDC)
DECLARE_ABSTRACT_CLASS(wxScreenDCImpl)
};
#endif // __GTKDCSCREENH__

View File

@@ -92,7 +92,7 @@ public:
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
@@ -212,19 +212,19 @@ private:
//-----------------------------------------------------------------------------
#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;
@@ -307,8 +307,8 @@ private:
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)
};
// ----------------------------------------------------------------------------

View File

@@ -54,7 +54,7 @@ public:
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
@@ -223,19 +223,19 @@ private:
//-----------------------------------------------------------------------------
#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;
@@ -320,8 +320,8 @@ private:
double m_PS2DEV;
double m_DEV2PS;
DECLARE_DYNAMIC_CLASS(wxGtkPrinterImplDC)
DECLARE_NO_COPY_CLASS(wxGtkPrinterImplDC)
DECLARE_DYNAMIC_CLASS(wxGtkPrinterDCImpl)
DECLARE_NO_COPY_CLASS(wxGtkPrinterDCImpl)
};
// ----------------------------------------------------------------------------

View File

@@ -15,6 +15,9 @@
#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.

View File

@@ -13,6 +13,7 @@
#define _WX_DCCLIENT_H_
#include "wx/dc.h"
#include "wx/dcgraph.h"
//-----------------------------------------------------------------------------
// classes
@@ -21,59 +22,52 @@
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:
wxWindowDCImpl( wxDC *owner );
wxWindowDCImpl( wxDC *owner, wxWindow *window );
virtual ~wxWindowDCImpl();
public:
wxWindowDC(void);
// Create a DC corresponding to a canvas
wxWindowDC(wxWindow *win);
virtual ~wxWindowDC(void);
wxWindow *GetWindow() const { return m_window; }
protected :
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;
private:
DECLARE_CLASS(wxWindowDCImpl)
DECLARE_NO_COPY_CLASS(wxWindowDCImpl)
};
class WXDLLEXPORT wxClientDC: public wxWindowDC
class WXDLLEXPORT wxClientDCImpl: public wxWindowDCImpl
{
DECLARE_DYNAMIC_CLASS(wxClientDC)
public:
wxClientDCImpl( wxDC *owner );
wxClientDCImpl( wxDC *owner, wxWindow *window );
virtual ~wxClientDCImpl();
public:
wxClientDC(void);
private:
DECLARE_CLASS(wxClientDCImpl)
DECLARE_NO_COPY_CLASS(wxClientDCImpl)
};
// Create a DC corresponding to a canvas
wxClientDC(wxWindow *win);
virtual ~wxClientDC(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)
};
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);
protected:
};
#endif
// _WX_DCCLIENT_H_

View File

@@ -12,22 +12,16 @@
#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);
wxMemoryDCImpl( wxMemoryDC *owner );
wxMemoryDCImpl( wxMemoryDC *owner, wxBitmap& bitmap );
wxMemoryDCImpl( wxMemoryDC *owner, wxDC *dc );
const wxBitmap& GetSelectedBitmap() const { return m_selected; }
wxBitmap GetSelectedBitmap() { return m_selected; }
wxBitmap GetSelectedObject() { return GetSelectedBitmap() ; }
virtual ~wxMemoryDCImpl();
protected:
virtual void DoGetSize( int *width, int *height ) const;
@@ -39,6 +33,10 @@ private:
void Init();
wxBitmap m_selected;
private:
DECLARE_CLASS(wxMemoryDCImpl)
DECLARE_NO_COPY_CLASS(wxMemoryDCImpl)
};
#endif

View File

@@ -13,19 +13,18 @@
#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) ;
@@ -36,10 +35,15 @@ class WXDLLEXPORT wxPrinterDC: public wxDC
wxPrintData& GetPrintData() { return m_printData; }
virtual wxSize GetPPI() const;
protected:
protected:
virtual void DoGetSize( int *width, int *height ) const;
wxPrintData m_printData ;
wxNativePrinterDC* m_nativePrinterDC ;
private:
DECLARE_CLASS(wxPrinterDC)
#endif // wxUSE_PRINTING_ARCHITECTURE
};

View File

@@ -13,23 +13,20 @@
#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:
private:
void* m_overlayWindow;
private:
DECLARE_CLASS(wxScreenDCImpl)
DECLARE_NO_COPY_CLASS(wxScreenDCImpl)
};
#endif

View File

@@ -22,6 +22,8 @@
#include "wx/dataobj.h"
#endif
#include "wx/mac/carbon/dcclient.h"
/*
* Metafile and metafile device context classes
*
@@ -65,32 +67,56 @@ public:
#endif
};
class WXDLLEXPORT wxMetafileDC: public wxDC
class WXDLLEXPORT wxMetafileDCImpl: public wxGCDCImpl
{
DECLARE_DYNAMIC_CLASS(wxMetafileDC)
public:
wxMetafileDCImpl( wxDC *owner,
const wxString& filename,
int width, int height,
const wxString& description );
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);
virtual ~wxMetafileDC(void);
virtual ~wxMetafileDCImpl();
// Should be called at end of drawing
virtual wxMetafile *Close(void);
virtual wxMetafile *Close();
// Implementation
inline wxMetafile *GetMetaFile(void) const { return m_metaFile; }
inline void SetMetaFile(wxMetafile *mf) { m_metaFile = mf; }
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;
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,

View File

@@ -29,6 +29,9 @@ typedef SInt32 SRefCon;
#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
{

View File

@@ -13,6 +13,7 @@
#define _WX_MSW_DC_H_
#include "wx/defs.h"
#include "wx/dc.h"
// ---------------------------------------------------------------------------
// macros
@@ -42,11 +43,11 @@ public:
// 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
// ----------------------------------
@@ -94,10 +95,9 @@ public:
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
@@ -145,7 +145,6 @@ public:
protected:
void Init()
{
m_canvas = NULL;
m_bOwnsDC = false;
m_hDC = NULL;
@@ -161,7 +160,7 @@ protected:
// create an uninitialized DC: this should be only used by the derived
// classes
wxDC() { Init(); }
wxMSWDCImpl( wxDC *owner ) : wxDCImpl( owner ) { Init(); }
void RealizeScaleAndOrigin();
@@ -302,12 +301,12 @@ protected:
#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)
};
// ----------------------------------------------------------------------------
@@ -315,18 +314,18 @@ protected:
// 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);
@@ -349,8 +348,20 @@ private:
// 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_

View File

@@ -17,6 +17,8 @@
// ----------------------------------------------------------------------------
#include "wx/dc.h"
#include "wx/msw/dc.h"
#include "wx/dcclient.h"
#include "wx/dynarray.h"
// ----------------------------------------------------------------------------
@@ -32,14 +34,14 @@ WX_DECLARE_EXPORTED_OBJARRAY(wxPaintDCInfo, wxArrayDCInfo);
// 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
@@ -49,19 +51,20 @@ protected:
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();
@@ -70,18 +73,19 @@ protected:
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);
@@ -93,7 +97,8 @@ protected:
wxPaintDCInfo *FindInCache(size_t *index = NULL) const;
private:
DECLARE_DYNAMIC_CLASS_NO_COPY(wxPaintDC)
DECLARE_CLASS(wxPaintDCImpl)
DECLARE_NO_COPY_CLASS(wxPaintDCImpl)
};
/*
@@ -106,10 +111,8 @@ class WXDLLEXPORT wxPaintDCEx : public wxPaintDC
{
public:
wxPaintDCEx(wxWindow *canvas, WXHDC dc);
virtual ~wxPaintDCEx();
private:
int saveState;
private:
DECLARE_CLASS(wxPaintDCEx)
DECLARE_NO_COPY_CLASS(wxPaintDCEx)
};

View File

@@ -12,14 +12,15 @@
#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:
@@ -38,7 +39,8 @@ protected:
void Init();
private:
DECLARE_DYNAMIC_CLASS_NO_COPY(wxMemoryDC)
DECLARE_CLASS(wxMemoryDCImpl)
DECLARE_NO_COPY_CLASS(wxMemoryDCImpl)
};
#endif

View File

@@ -14,19 +14,20 @@
#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);
@@ -34,7 +35,7 @@ public:
virtual void StartPage();
virtual void EndPage();
wxRect GetPaperRect();
virtual wxRect GetPaperRect();
protected:
virtual void DoDrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y,
@@ -55,15 +56,26 @@ protected:
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_

View File

@@ -12,19 +12,14 @@
#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
@@ -33,7 +28,8 @@ protected:
}
private:
DECLARE_DYNAMIC_CLASS_NO_COPY(wxScreenDC)
DECLARE_CLASS(wxScreenDCImpl)
DECLARE_NO_COPY_CLASS(wxScreenDCImpl)
};
#endif // _WX_MSW_DCSCREEN_H_

View File

@@ -82,19 +82,6 @@ public:
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)
};

View File

@@ -72,20 +72,13 @@ private:
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,
@@ -107,9 +100,37 @@ protected:
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,

View File

@@ -213,6 +213,11 @@ struct WinStruct : public T
#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)
{

View File

@@ -22,6 +22,7 @@
#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;
@@ -77,7 +78,7 @@ public:
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?
@@ -121,7 +122,7 @@ public:
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 );

View File

@@ -33,6 +33,7 @@
#include "wx/colordlg.h"
#include "wx/image.h"
#include "wx/artprov.h"
#include "wx/dcgraph.h"
#define wxTEST_GRAPHICS 1

View File

@@ -412,7 +412,8 @@ void wxAuiDefaultDockArt::DrawSash(wxDC& dc, wxWindow *window, int orientation,
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 ;

View File

@@ -70,6 +70,7 @@ DEFINE_EVENT_TYPE(wxEVT_AUI_FIND_MANAGER)
#ifdef __WXMSW__
#include "wx/msw/wrapwin.h"
#include "wx/msw/private.h"
#include "wx/msw/dc.h"
#endif
IMPLEMENT_DYNAMIC_CLASS(wxAuiManagerEvent, wxEvent)
@@ -297,7 +298,8 @@ static void DrawResizeHint(wxDC& dc, const wxRect& rect)
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);
@@ -771,6 +773,7 @@ void wxAuiManager::UpdateHintWindowConfig()
{
wxFrame* f = static_cast<wxFrame*>(w);
can_do_transparent = f->CanSetTransparent();
break;
}

View File

@@ -36,10 +36,26 @@
#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
#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
//----------------------------------------------------------------------------
@@ -66,280 +82,60 @@ wxDCFactory *wxDCFactory::GetFactory()
// 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 )
wxDCImpl* 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
return new wxClientDCImpl( owner );
}
wxImplDC* wxNativeDCFactory::CreateClientDC( wxClientDC *owner, wxWindow *window )
wxDCImpl* 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
return new wxClientDCImpl( owner, window );
}
wxImplDC* wxNativeDCFactory::CreatePaintDC( wxPaintDC *owner )
wxDCImpl* 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
return new wxPaintDCImpl( owner );
}
wxImplDC* wxNativeDCFactory::CreatePaintDC( wxPaintDC *owner, wxWindow *window )
wxDCImpl* 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
return new wxPaintDCImpl( owner, window );
}
wxImplDC* wxNativeDCFactory::CreateMemoryDC( wxMemoryDC *owner )
wxDCImpl* 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
return new wxMemoryDCImpl( owner );
}
wxImplDC* wxNativeDCFactory::CreateMemoryDC( wxMemoryDC *owner, wxBitmap &bitmap )
wxDCImpl* 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
return new wxMemoryDCImpl( owner, bitmap );
}
wxImplDC* wxNativeDCFactory::CreateMemoryDC( wxMemoryDC *owner, wxDC *dc )
wxDCImpl* 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
return new wxMemoryDCImpl( owner, dc );
}
wxImplDC* wxNativeDCFactory::CreateScreenDC( wxScreenDC *owner )
wxDCImpl* 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
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 );
}
//-----------------------------------------------------------------------------
@@ -350,8 +146,6 @@ IMPLEMENT_DYNAMIC_CLASS(wxWindowDC, wxDC)
wxWindowDC::wxWindowDC()
{
wxDCFactory *factory = wxDCFactory::GetFactory();
m_pimpl = factory->CreateWindowDC( this );
}
wxWindowDC::wxWindowDC( wxWindow *win )
@@ -364,12 +158,10 @@ 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 )
@@ -433,12 +225,10 @@ wxBitmap& wxMemoryDC::GetSelectedBitmap()
// 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 )
@@ -467,8 +257,9 @@ IMPLEMENT_DYNAMIC_CLASS(wxPrinterDC, wxDC)
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 )
@@ -493,13 +284,14 @@ int wxPrinterDC::GetResolution()
//-----------------------------------------------------------------------------
// 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)
@@ -538,7 +330,7 @@ wxImplDC::wxImplDC( wxDC *owner )
ResetClipping();
}
wxImplDC::~wxImplDC()
wxDCImpl::~wxDCImpl()
{
}
@@ -546,53 +338,53 @@ wxImplDC::~wxImplDC()
// 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)
{
@@ -616,7 +408,7 @@ void wxImplDC::SetMapMode( int mode )
m_mappingMode = mode;
}
void wxImplDC::SetUserScale( double x, double y )
void wxDCImpl::SetUserScale( double x, double y )
{
// allow negative ? -> no
m_userScaleX = x;
@@ -624,7 +416,7 @@ void wxImplDC::SetUserScale( double x, double y )
ComputeScaleAndOrigin();
}
void wxImplDC::SetLogicalScale( double x, double y )
void wxDCImpl::SetLogicalScale( double x, double y )
{
// allow negative ?
m_logicalScaleX = x;
@@ -632,28 +424,28 @@ void wxImplDC::SetLogicalScale( double x, double y )
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
@@ -692,7 +484,7 @@ public:
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;
@@ -736,7 +528,7 @@ bool wxImplDC::DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths)
return true;
}
void wxImplDC::GetMultiLineTextExtent(const wxString& text,
void wxDCImpl::GetMultiLineTextExtent(const wxString& text,
wxCoord *x,
wxCoord *y,
wxCoord *h,
@@ -802,7 +594,7 @@ void wxImplDC::GetMultiLineTextExtent(const wxString& text,
*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") );
@@ -824,7 +616,7 @@ void wxImplDC::DoDrawCheckMark(wxCoord x1, wxCoord y1,
}
bool
wxImplDC::DoStretchBlit(wxCoord xdest, wxCoord ydest,
wxDCImpl::DoStretchBlit(wxCoord xdest, wxCoord ydest,
wxCoord dstWidth, wxCoord dstHeight,
wxDC *source,
wxCoord xsrc, wxCoord ysrc,
@@ -855,7 +647,7 @@ wxImplDC::DoStretchBlit(wxCoord xdest, wxCoord ydest,
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];
@@ -873,7 +665,7 @@ void wxImplDC::DrawLines(const wxPointList *list, wxCoord xoffset, wxCoord yoffs
delete [] points;
}
void wxImplDC::DrawPolygon(const wxPointList *list,
void wxDCImpl::DrawPolygon(const wxPointList *list,
wxCoord xoffset, wxCoord yoffset,
int fillStyle)
{
@@ -894,7 +686,7 @@ void wxImplDC::DrawPolygon(const wxPointList *list,
}
void
wxImplDC::DoDrawPolyPolygon(int n,
wxDCImpl::DoDrawPolyPolygon(int n,
int count[],
wxPoint points[],
wxCoord xoffset, wxCoord yoffset,
@@ -938,7 +730,7 @@ wxImplDC::DoDrawPolyPolygon(int n,
#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;
@@ -963,7 +755,7 @@ void wxImplDC::DoDrawSpline(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2, wxCo
}
}
void wxImplDC::DoDrawSpline(int n, wxPoint points[])
void wxDCImpl::DoDrawSpline(int n, wxPoint points[])
{
wxPointList list;
for (int i =0; i < n; i++)
@@ -1085,7 +877,7 @@ static void wx_spline_draw_point_array(wxDC *dc)
}
}
void wxImplDC::DoDrawSpline( const wxPointList *points )
void wxDCImpl::DoDrawSpline( const wxPointList *points )
{
wxCHECK_RET( IsOk(), wxT("invalid window dc") );
@@ -1149,7 +941,7 @@ void wxImplDC::DoDrawSpline( const wxPointList *points )
void wxImplDC::DoGradientFillLinear(const wxRect& rect,
void wxDCImpl::DoGradientFillLinear(const wxRect& rect,
const wxColour& initialColour,
const wxColour& destColour,
wxDirection nDirection)
@@ -1245,7 +1037,7 @@ void wxImplDC::DoGradientFillLinear(const wxRect& rect,
SetBrush(oldBrush);
}
void wxImplDC::DoGradientFillConcentric(const wxRect& rect,
void wxDCImpl::DoGradientFillConcentric(const wxRect& rect,
const wxColour& initialColour,
const wxColour& destColour,
const wxPoint& circleCenter)

View File

@@ -19,6 +19,7 @@
#if wxUSE_GRAPHICS_CONTEXT
#include "wx/graphics.h"
#include "wx/dcgraph.h"
#ifndef WX_PRECOMP
#include "wx/icon.h"
@@ -49,18 +50,46 @@ static inline double DegToRad(double deg)
// 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()
{
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 wxGCDC::SetGraphicsContext( wxGraphicsContext* ctx )
void wxGCDCImpl::SetGraphicsContext( wxGraphicsContext* ctx )
{
delete m_graphicContext;
m_graphicContext = ctx;
@@ -76,21 +105,21 @@ void wxGCDC::SetGraphicsContext( wxGraphicsContext* 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;
@@ -106,15 +135,15 @@ void wxGCDC::Init()
}
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 )
{
@@ -130,10 +159,10 @@ void wxGCDC::DoDrawBitmap( const wxBitmap &bmp, wxCoord x, wxCoord y, bool WXUNU
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();
@@ -141,33 +170,33 @@ void wxGCDC::DoDrawIcon( const wxIcon &icon, wxCoord x, wxCoord y )
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 )
@@ -188,10 +217,10 @@ void wxGCDC::DoSetClippingRegion( wxCoord x, wxCoord y, wxCoord w, wxCoord h )
}
}
void wxGCDC::DoSetClippingRegionAsRegion( const wxRegion &region )
void wxGCDCImpl::DoSetClippingRegionAsRegion( const wxRegion &region )
{
// 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())
{
@@ -224,13 +253,13 @@ void wxGCDC::DoSetClippingRegionAsRegion( const wxRegion &region )
}
}
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 );
@@ -239,20 +268,20 @@ void wxGCDC::DestroyClippingRegion()
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 )
{
@@ -261,14 +290,14 @@ void wxGCDC::SetTextForeground( const wxColour &col )
}
}
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)
{
@@ -297,7 +326,7 @@ void wxGCDC::SetMapMode( int mode )
ComputeScaleAndOrigin();
}
void wxGCDC::SetUserScale( double x, double y )
void wxGCDCImpl::SetUserScale( double x, double y )
{
// allow negative ? -> no
@@ -306,7 +335,7 @@ void wxGCDC::SetUserScale( double x, double y )
ComputeScaleAndOrigin();
}
void wxGCDC::SetLogicalScale( double x, double y )
void wxGCDCImpl::SetLogicalScale( double x, double y )
{
// allow negative ?
m_logicalScaleX = x;
@@ -314,38 +343,38 @@ void wxGCDC::SetLogicalScale( double x, double y )
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;
@@ -363,29 +392,29 @@ void wxGCDC::ComputeScaleAndOrigin()
}
}
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;
@@ -397,7 +426,7 @@ void wxGCDC::SetPen( const wxPen &pen )
}
}
void wxGCDC::SetBrush( const wxBrush &brush )
void wxGCDCImpl::SetBrush( const wxBrush &brush )
{
if (m_brush == brush)
return;
@@ -409,17 +438,17 @@ void wxGCDC::SetBrush( const wxBrush &brush )
}
}
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;
@@ -431,21 +460,21 @@ void wxGCDC::SetLogicalFunction( int function )
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;
@@ -456,16 +485,16 @@ void wxGCDC::DoDrawLine( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2 )
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);
@@ -474,11 +503,11 @@ void wxGCDC::DoCrossHair( wxCoord x, wxCoord y )
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;
@@ -520,10 +549,10 @@ void wxGCDC::DoDrawArc( wxCoord x1, wxCoord y1,
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;
@@ -559,17 +588,17 @@ void wxGCDC::DoDrawEllipticArc( wxCoord x, wxCoord y, wxCoord w, wxCoord h,
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;
@@ -586,9 +615,9 @@ void wxGCDC::DoDrawLines(int n, wxPoint points[],
}
#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;
@@ -644,11 +673,11 @@ void wxGCDC::DoDrawSpline(const wxPointList *points)
}
#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;
@@ -672,7 +701,7 @@ void wxGCDC::DoDrawPolygon( int n, wxPoint points[],
delete[] pointsD;
}
void wxGCDC::DoDrawPolyPolygon(int n,
void wxGCDCImpl::DoDrawPolyPolygon(int n,
int count[],
wxPoint points[],
wxCoord xoffset,
@@ -701,9 +730,9 @@ void wxGCDC::DoDrawPolyPolygon(int n,
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;
@@ -722,11 +751,11 @@ void wxGCDC::DoDrawRectangle(wxCoord x, wxCoord y, wxCoord w, wxCoord h)
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;
@@ -748,9 +777,9 @@ void wxGCDC::DoDrawRoundedRectangle(wxCoord x, wxCoord y,
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;
@@ -765,12 +794,12 @@ void wxGCDC::DoDrawEllipse(wxCoord x, wxCoord y, wxCoord w, wxCoord h)
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 )
@@ -780,14 +809,14 @@ bool wxGCDC::DoBlit(
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;
@@ -821,7 +850,7 @@ bool wxGCDC::DoStretchBlit(
wxBitmap blit = source->GetAsBitmap( &subrect );
if ( blit.Ok() )
if ( blit.IsOk() )
{
m_graphicContext->DrawBitmap( blit, xdest, ydest,
dstWidth, dstHeight);
@@ -838,10 +867,10 @@ bool wxGCDC::DoStretchBlit(
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;
@@ -854,9 +883,9 @@ void wxGCDC::DoDrawRotatedText(const wxString& str, wxCoord x, wxCoord y,
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;
@@ -870,18 +899,18 @@ void wxGCDC::DoDrawText(const wxString& str, wxCoord x, wxCoord y)
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 )
{
@@ -907,9 +936,9 @@ void wxGCDC::DoGetTextExtent( const wxString &str, wxCoord *width, wxCoord *heig
}
}
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() )
@@ -924,7 +953,7 @@ bool wxGCDC::DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths) c
return true;
}
wxCoord wxGCDC::GetCharWidth(void) const
wxCoord wxGCDCImpl::GetCharWidth(void) const
{
wxCoord width;
DoGetTextExtent( wxT("g") , &width , NULL , NULL , NULL , NULL );
@@ -932,7 +961,7 @@ wxCoord wxGCDC::GetCharWidth(void) const
return width;
}
wxCoord wxGCDC::GetCharHeight(void) const
wxCoord wxGCDCImpl::GetCharHeight(void) const
{
wxCoord height;
DoGetTextExtent( wxT("g") , NULL , &height , NULL , NULL , NULL );
@@ -940,9 +969,9 @@ wxCoord wxGCDC::GetCharHeight(void) const
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;
@@ -952,13 +981,13 @@ void wxGCDC::Clear(void)
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 )
@@ -1001,7 +1030,7 @@ void wxGCDC::DoGradientFillLinear(const wxRect& rect,
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)
@@ -1029,10 +1058,10 @@ void wxGCDC::DoGradientFillConcentric(const wxRect& rect,
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

View File

@@ -74,12 +74,12 @@ wxString wxBrushString ( wxColour c, int style )
// 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 );
}
@@ -91,7 +91,7 @@ IMPLEMENT_ABSTRACT_CLASS(wxSVGFileImplDC, wxDC)
}
#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 ;
@@ -143,14 +143,14 @@ void wxSVGFileImplDC::Init (const wxString &filename, int Width, int Height, dou
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 );
@@ -159,12 +159,12 @@ void wxSVGFileImplDC::DoGetSizeMM( int *width, int *height ) const
*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 ;
@@ -179,7 +179,7 @@ void wxSVGFileImplDC::DoDrawLine (wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2
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++ )
{
@@ -189,7 +189,7 @@ void wxSVGFileImplDC::DoDrawLines(int n, wxPoint points[], wxCoord xoffset , wxC
}
void wxSVGFileImplDC::DoDrawPoint (wxCoord x1, wxCoord y1)
void wxSVGFileDCImpl::DoDrawPoint (wxCoord x1, wxCoord y1)
{
wxString s;
if (m_graphics_changed) NewGraphics ();
@@ -201,24 +201,24 @@ void wxSVGFileImplDC::DoDrawPoint (wxCoord x1, wxCoord y1)
}
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 ();
@@ -280,13 +280,13 @@ void wxSVGFileImplDC::DoDrawRotatedText(const wxString& sText, wxCoord x, wxCoor
}
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 ();
@@ -305,7 +305,7 @@ void wxSVGFileImplDC::DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width
}
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 ;
@@ -331,7 +331,7 @@ void wxSVGFileImplDC::DoDrawPolygon(int n, wxPoint points[], wxCoord xoffset, wx
}
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 ();
@@ -351,7 +351,7 @@ void wxSVGFileImplDC::DoDrawEllipse (wxCoord x, wxCoord y, wxCoord width, wxCoor
}
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
@@ -403,7 +403,7 @@ void wxSVGFileImplDC::DoDrawArc(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2,
}
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
@@ -467,7 +467,7 @@ void wxSVGFileImplDC::DoDrawEllipticArc(wxCoord x,wxCoord y,wxCoord w,wxCoord h,
}
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 ;
@@ -479,7 +479,7 @@ void wxSVGFileImplDC::DoGetTextExtent(const wxString& string, wxCoord *w, wxCoor
}
wxCoord wxSVGFileImplDC::GetCharHeight() const
wxCoord wxSVGFileDCImpl::GetCharHeight() const
{
wxScreenDC sDC ;
@@ -491,7 +491,7 @@ wxCoord wxSVGFileImplDC::GetCharHeight() const
}
wxCoord wxSVGFileImplDC::GetCharWidth() const
wxCoord wxSVGFileDCImpl::GetCharWidth() const
{
wxScreenDC sDC ;
sDC.SetFont (m_font);
@@ -503,7 +503,7 @@ wxCoord wxSVGFileImplDC::GetCharWidth() const
/// Set Functions /////////////////////////////////////////////////////////////////
void wxSVGFileImplDC::SetBackground( const wxBrush &brush )
void wxSVGFileDCImpl::SetBackground( const wxBrush &brush )
{
m_backgroundBrush = brush;
@@ -511,14 +511,14 @@ void wxSVGFileImplDC::SetBackground( const wxBrush &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 ;
@@ -528,7 +528,7 @@ void wxSVGFileImplDC::SetBrush(const wxBrush& brush)
}
void wxSVGFileImplDC::SetPen(const wxPen& pen)
void wxSVGFileDCImpl::SetPen(const wxPen& pen)
{
// width, color, ends, joins : currently implemented
// dashes, stipple : not implemented
@@ -538,7 +538,7 @@ void wxSVGFileImplDC::SetPen(const wxPen& pen)
wxASSERT_MSG(!wxSVG_DEBUG, wxT("wxSVGFileDC::SetPen Call executed")) ;
}
void wxSVGFileImplDC::NewGraphics ()
void wxSVGFileDCImpl::NewGraphics ()
{
int w = m_pen.GetWidth ();
@@ -597,7 +597,7 @@ void wxSVGFileImplDC::NewGraphics ()
}
void wxSVGFileImplDC::SetFont(const wxFont& font)
void wxSVGFileDCImpl::SetFont(const wxFont& font)
{
m_font = font ;
@@ -607,7 +607,7 @@ void wxSVGFileImplDC::SetFont(const wxFont& 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*/)
@@ -632,7 +632,7 @@ bool wxSVGFileImplDC::DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoor
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;
@@ -644,7 +644,7 @@ void wxSVGFileImplDC::DoDrawIcon(const class wxIcon & myIcon, wxCoord x, wxCoord
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 ();
@@ -685,7 +685,7 @@ void wxSVGFileImplDC::DoDrawBitmap(const class wxBitmap & bmp, wxCoord x, wxCoor
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));
@@ -698,32 +698,32 @@ void wxSVGFileImplDC::write(const wxString &s)
#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);
}

View File

@@ -774,12 +774,11 @@ wxGraphicsContext* wxGraphicsContext::Create( const wxWindowDC& dc)
{
return wxGraphicsRenderer::GetDefaultRenderer()->CreateContext(dc);
}
#ifdef __WXMSW__
wxGraphicsContext* wxGraphicsContext::Create( const wxMemoryDC& dc)
{
return wxGraphicsRenderer::GetDefaultRenderer()->CreateContext(dc);
}
#endif
wxGraphicsContext* wxGraphicsContext::CreateFromNative( void * context )
{

View File

@@ -146,20 +146,7 @@ bool wxOverlayImpl::IsOk()
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 );

View File

@@ -52,9 +52,11 @@
#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"
@@ -205,34 +207,15 @@ wxDialog *wxNativePrintFactory::CreatePrintSetupDialog( wxWindow *parent,
#endif
}
#if wxUSE_NEW_DC
wxImplDC* wxNativePrintFactory::CreatePrinterImplDC( wxPrinterDC *owner, const wxPrintData& data )
wxDCImpl* wxNativePrintFactory::CreatePrinterDCImpl( wxPrinterDC *owner, const wxPrintData& data )
{
#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__)
return new wxWindowsPrinterDCImpl( owner, data );
#elif defined(__WXMAC__)
return new wxMacPrinterDCImpl( owner, data );
#if defined(__WXGTK__) || defined(__WXUNIVERSAL__)
return new wxPostScriptDCImpl( owner, data );
#else
return new wxPostScriptImplDC( owner, data );
return new wxPrinterDCImpl( owner, data );
#endif
}
#else
wxDC* wxNativePrintFactory::CreatePrinterDC( const wxPrintData& data )
{
#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__)
return new wxPrinterDC(data);
#elif defined(__WXMAC__)
return new wxPrinterDC(data);
#else
return new wxPostScriptDC(data);
#endif
}
#endif
bool wxNativePrintFactory::HasOwnPrintToFile()
{
// Only relevant for PostScript and here the

View File

@@ -2276,7 +2276,8 @@ void wxDataViewMainWindow::ScrollTo( int rows, int column )
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());

View File

@@ -242,12 +242,12 @@ IMPLEMENT_DYNAMIC_CLASS(wxPostScriptDC, wxDC)
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
@@ -268,7 +268,7 @@ static const double DEV2PS = 72.0 / 600.0;
#if wxUSE_NEW_DC
IMPLEMENT_ABSTRACT_CLASS(wxPostScriptImplDC, wxImplDC)
IMPLEMENT_ABSTRACT_CLASS(wxPostScriptDCImpl, wxDCImpl)
#else
IMPLEMENT_ABSTRACT_CLASS(wxPostScriptDC, wxDC)
#endif
@@ -276,8 +276,8 @@ IMPLEMENT_ABSTRACT_CLASS(wxPostScriptDC, wxDC)
//-------------------------------------------------------------------------------
#if wxUSE_NEW_DC
wxPostScriptImplDC::wxPostScriptImplDC( wxPostScriptDC *owner ) :
wxImplDC( owner )
wxPostScriptDCImpl::wxPostScriptDCImpl( wxPostScriptDC *owner ) :
wxDCImpl( owner )
{
Init();
@@ -286,8 +286,8 @@ wxPostScriptImplDC::wxPostScriptImplDC( wxPostScriptDC *owner ) :
m_ok = true;
}
wxPostScriptImplDC::wxPostScriptImplDC( wxPostScriptDC *owner, const wxPrintData& data ) :
wxImplDC( owner )
wxPostScriptDCImpl::wxPostScriptDCImpl( wxPostScriptDC *owner, const wxPrintData& data ) :
wxDCImpl( owner )
{
Init();
@@ -301,8 +301,8 @@ wxPostScriptImplDC::wxPostScriptImplDC( wxPostScriptDC *owner, const wxPrintData
#if wxUSE_NEW_DC
wxPostScriptImplDC::wxPostScriptImplDC( wxPrinterDC *owner ) :
wxImplDC( owner )
wxPostScriptDCImpl::wxPostScriptDCImpl( wxPrinterDC *owner ) :
wxDCImpl( owner )
#else
wxPostScriptDC::wxPostScriptDC()
#endif
@@ -315,8 +315,8 @@ wxPostScriptDC::wxPostScriptDC()
}
#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
@@ -330,7 +330,7 @@ wxPostScriptDC::wxPostScriptDC( const wxPrintData& data )
m_ok = true;
}
void wxPostScriptImplDC::Init()
void wxPostScriptDCImpl::Init()
{
m_pstream = (FILE*) NULL;
@@ -347,7 +347,7 @@ void wxPostScriptImplDC::Init()
}
wxPostScriptImplDC::~wxPostScriptImplDC ()
wxPostScriptDCImpl::~wxPostScriptDCImpl ()
{
if (m_pstream)
{
@@ -356,12 +356,12 @@ wxPostScriptImplDC::~wxPostScriptImplDC ()
}
}
bool wxPostScriptImplDC::IsOk() const
bool wxPostScriptDCImpl::IsOk() const
{
return m_ok;
}
wxRect wxPostScriptImplDC::GetPaperRect()
wxRect wxPostScriptDCImpl::GetPaperRect()
{
int w = 0;
int h = 0;
@@ -369,12 +369,12 @@ wxRect wxPostScriptImplDC::GetPaperRect()
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") );
@@ -409,7 +409,7 @@ void wxPostScriptImplDC::DoSetClippingRegion (wxCoord x, wxCoord y, wxCoord w, w
}
void wxPostScriptImplDC::DestroyClippingRegion()
void wxPostScriptDCImpl::DestroyClippingRegion()
{
wxCHECK_RET( m_ok , wxT("invalid postscript dc") );
@@ -420,37 +420,37 @@ void wxPostScriptImplDC::DestroyClippingRegion()
}
#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") );
@@ -472,7 +472,7 @@ void wxPostScriptImplDC::DoDrawLine (wxCoord x1, wxCoord y1, wxCoord x2, wxCoord
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") );
@@ -550,7 +550,7 @@ void wxPostScriptImplDC::DoDrawArc (wxCoord x1, wxCoord y1, wxCoord x2, wxCoord
}
}
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") );
@@ -604,7 +604,7 @@ void wxPostScriptImplDC::DoDrawEllipticArc(wxCoord x,wxCoord y,wxCoord w,wxCoord
}
}
void wxPostScriptImplDC::DoDrawPoint (wxCoord x, wxCoord y)
void wxPostScriptDCImpl::DoDrawPoint (wxCoord x, wxCoord y)
{
wxCHECK_RET( m_ok, wxT("invalid postscript dc") );
@@ -625,7 +625,7 @@ void wxPostScriptImplDC::DoDrawPoint (wxCoord x, wxCoord y)
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") );
@@ -695,7 +695,7 @@ void wxPostScriptImplDC::DoDrawPolygon (int n, wxPoint points[], wxCoord xoffset
}
}
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") );
@@ -771,7 +771,7 @@ void wxPostScriptImplDC::DoDrawPolyPolygon (int n, int count[], wxPoint points[]
}
}
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") );
@@ -805,7 +805,7 @@ void wxPostScriptImplDC::DoDrawLines (int n, wxPoint points[], wxCoord xoffset,
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") );
@@ -859,7 +859,7 @@ void wxPostScriptImplDC::DoDrawRectangle (wxCoord x, wxCoord y, wxCoord width, w
}
}
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") );
@@ -941,7 +941,7 @@ void wxPostScriptImplDC::DoDrawRoundedRectangle (wxCoord x, wxCoord y, wxCoord w
}
}
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") );
@@ -983,7 +983,7 @@ void wxPostScriptImplDC::DoDrawEllipse (wxCoord x, wxCoord y, wxCoord width, wxC
}
}
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 );
}
@@ -991,7 +991,7 @@ void wxPostScriptImplDC::DoDrawIcon( const wxIcon& icon, wxCoord x, wxCoord y )
/* 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") );
@@ -1061,7 +1061,7 @@ void wxPostScriptImplDC::DoDrawBitmap( const wxBitmap& bitmap, wxCoord x, wxCoor
PsPrint( "origstate restore\n" );
}
void wxPostScriptImplDC::SetFont( const wxFont& font )
void wxPostScriptDCImpl::SetFont( const wxFont& font )
{
wxCHECK_RET( m_ok, wxT("invalid postscript dc") );
@@ -1155,7 +1155,7 @@ void wxPostScriptImplDC::SetFont( const wxFont& font )
PsPrint( buffer );
}
void wxPostScriptImplDC::SetPen( const wxPen& pen )
void wxPostScriptDCImpl::SetPen( const wxPen& pen )
{
wxCHECK_RET( m_ok, wxT("invalid postscript dc") );
@@ -1263,7 +1263,7 @@ void wxPostScriptImplDC::SetPen( const wxPen& pen )
}
}
void wxPostScriptImplDC::SetBrush( const wxBrush& brush )
void wxPostScriptDCImpl::SetBrush( const wxBrush& brush )
{
wxCHECK_RET( m_ok, wxT("invalid postscript dc") );
@@ -1307,7 +1307,7 @@ void wxPostScriptImplDC::SetBrush( const wxBrush& brush )
}
}
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") );
@@ -1415,7 +1415,7 @@ void wxPostScriptImplDC::DoDrawText( const wxString& text, wxCoord x, wxCoord y
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) )
{
@@ -1530,18 +1530,18 @@ void wxPostScriptImplDC::DoDrawRotatedText( const wxString& text, wxCoord x, wxC
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") );
@@ -1622,13 +1622,13 @@ void wxPostScriptImplDC::DoDrawSpline( const wxPointList *points )
}
#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;
@@ -1651,43 +1651,43 @@ void wxPostScriptImplDC::SetPrintData(const wxPrintData& 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
@@ -1701,7 +1701,7 @@ void wxPostScriptImplDC::ComputeScaleAndOrigin()
}
}
void wxPostScriptImplDC::DoGetSize(int* width, int* height) const
void wxPostScriptDCImpl::DoGetSize(int* width, int* height) const
{
wxPaperSize id = m_printData.GetPaperId();
@@ -1731,7 +1731,7 @@ void wxPostScriptImplDC::DoGetSize(int* width, int* height) const
*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();
@@ -1759,13 +1759,13 @@ void wxPostScriptImplDC::DoGetSizeMM(int *width, int *height) const
}
// 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") );
@@ -1854,7 +1854,7 @@ bool wxPostScriptImplDC::StartDoc( const wxString& message )
return true;
}
void wxPostScriptImplDC::EndDoc ()
void wxPostScriptDCImpl::EndDoc ()
{
wxCHECK_RET( m_ok, wxT("invalid postscript dc") );
@@ -1954,7 +1954,7 @@ void wxPostScriptImplDC::EndDoc ()
#endif
}
void wxPostScriptImplDC::StartPage()
void wxPostScriptDCImpl::StartPage()
{
wxCHECK_RET( m_ok, wxT("invalid postscript dc") );
@@ -1992,14 +1992,14 @@ void wxPostScriptImplDC::StartPage()
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,
@@ -2022,7 +2022,7 @@ bool wxPostScriptImplDC::DoBlit( wxCoord xdest, wxCoord ydest,
return true;
}
wxCoord wxPostScriptImplDC::GetCharHeight() const
wxCoord wxPostScriptDCImpl::GetCharHeight() const
{
if (m_font.Ok())
return m_font.GetPointSize();
@@ -2030,7 +2030,7 @@ wxCoord wxPostScriptImplDC::GetCharHeight() const
return 12;
}
void wxPostScriptImplDC::PsPrint( const wxString& str )
void wxPostScriptDCImpl::PsPrint( const wxString& str )
{
const wxCharBuffer psdata(str.utf8_str());
@@ -2057,7 +2057,7 @@ void wxPostScriptImplDC::PsPrint( const wxString& 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

View File

@@ -99,6 +99,7 @@ static inline double RadToDeg(double deg)
#ifdef __WXGTK__
#include <gtk/gtk.h>
#include "wx/fontutil.h"
#include "wx/gtk/dc.h"
#endif
#ifdef __WXMSW__
@@ -323,6 +324,7 @@ class WXDLLIMPEXP_CORE wxCairoContext : public wxGraphicsContext
public:
wxCairoContext( wxGraphicsRenderer* renderer, const wxWindowDC& dc );
wxCairoContext( wxGraphicsRenderer* renderer, const wxMemoryDC& dc );
#ifdef __WXGTK__
wxCairoContext( wxGraphicsRenderer* renderer, GdkDrawable *drawable );
#endif
@@ -1036,12 +1038,25 @@ wxCairoContext::wxCairoContext( wxGraphicsRenderer* renderer, const wxWindowDC&
: 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;
@@ -1465,10 +1480,7 @@ public :
// Context
virtual wxGraphicsContext * CreateContext( const wxWindowDC& dc);
#ifdef __WXMSW__
virtual wxGraphicsContext * CreateContext( const wxMemoryDC& dc);
#endif
virtual wxGraphicsContext * CreateContextFromNativeContext( void * context );
@@ -1531,12 +1543,10 @@ wxGraphicsContext * wxCairoRenderer::CreateContext( const wxWindowDC& dc)
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 )
{

View File

@@ -32,6 +32,8 @@
#include "wx/listimpl.cpp"
#include "wx/gtk/private.h"
#include "wx/gtk/dc.h"
#include "wx/gtk/dcclient.h"
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
@@ -939,20 +941,12 @@ gtk_wx_cell_renderer_render (GtkCellRenderer *renderer,
{
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)
@@ -1657,41 +1651,37 @@ bool wxDataViewToggleRenderer::GetValue( wxVariant &value ) const
// wxDataViewCustomRenderer
// ---------------------------------------------------------
class wxDataViewCtrlDC: public wxWindowDC
class wxDataViewCtrlDCImpl: public wxWindowDCImpl
{
public:
wxDataViewCtrlDC( wxDataViewCtrl *window )
wxDataViewCtrlDCImpl( wxDC *owner, wxDataViewCtrl *window ) :
wxWindowDCImpl( owner )
{
#if wxUSE_NEW_DC
wxGTKWindowDCImpl *impl = (wxGTKWindowDCImpl*) GetImpl();
GtkWidget *widget = window->m_treeview;
// Set later
impl->m_window = NULL;
m_gdkwindow = 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_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
// ---------------------------------------------------------

View File

@@ -11,24 +11,16 @@
#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;
@@ -37,11 +29,11 @@ wxDC::wxDC()
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;
@@ -54,7 +46,7 @@ void wxGTKImplDC::DoSetClippingRegion( wxCoord x, wxCoord y, wxCoord width, wxCo
// 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;
@@ -64,7 +56,7 @@ void wxGTKImplDC::DoGetSizeMM( int* width, int* height ) const
}
// Resolution in pixels per logical inch
wxSize wxGTKImplDC::GetPPI() const
wxSize wxGTKDCImpl::GetPPI() const
{
// TODO (should probably be pure virtual)
return wxSize(0, 0);

File diff suppressed because it is too large Load Diff

View File

@@ -11,64 +11,42 @@
#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 )
{
Init();
}
#else
wxMemoryDC::wxMemoryDC()
wxMemoryDCImpl::wxMemoryDCImpl( wxMemoryDC *owner, wxDC *WXUNUSED(dc) )
: wxWindowDCImpl( owner )
{
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;
@@ -82,14 +60,14 @@ void wxGTKMemoryImplDC::Init()
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);
@@ -98,11 +76,11 @@ void wxGTKMemoryImplDC::DoSelect( const wxBitmap& bitmap )
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() &&
@@ -112,10 +90,10 @@ void wxGTKMemoryImplDC::SetPen( const wxPen& penOrig )
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() &&
@@ -125,10 +103,10 @@ void wxGTKMemoryImplDC::SetBrush( const wxBrush& brushOrig )
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);
@@ -139,34 +117,26 @@ void wxGTKMemoryImplDC::SetBackground( const wxBrush& 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())
{
@@ -180,18 +150,18 @@ void wxGTKMemoryImplDC::DoGetSize( int *width, int *height ) const
}
}
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;
}

View File

@@ -11,6 +11,7 @@
#include "wx/wxprec.h"
#include "wx/dcscreen.h"
#include "wx/gtk/dcscreen.h"
#ifndef WX_PRECOMP
#include "wx/window.h"
@@ -20,36 +21,23 @@
#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
@@ -68,7 +56,7 @@ void wxGTKScreenImplDC::Init()
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 );
@@ -76,7 +64,7 @@ wxGTKScreenImplDC::~wxGTKScreenImplDC()
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);
}

View File

@@ -480,9 +480,9 @@ wxGnomePrintFactory::CreatePrintSetupDialog(wxWindow * WXUNUSED(parent),
#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
@@ -1006,14 +1006,14 @@ static const double DEV2PS = 72.0 / 600.0;
#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
@@ -1041,17 +1041,17 @@ wxGnomePrinterDC::wxGnomePrinterDC( const wxPrintData& data )
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))
@@ -1060,14 +1060,14 @@ wxGnomePrinterImplDC::DoFloodFill(wxCoord WXUNUSED(x1),
}
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;
@@ -1081,11 +1081,11 @@ void wxGnomePrinterImplDC::DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoor
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;
@@ -1141,7 +1141,7 @@ void wxGnomePrinterImplDC::DoDrawArc(wxCoord x1,wxCoord y1,wxCoord x2,wxCoord y2
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;
@@ -1186,11 +1186,11 @@ void wxGnomePrinterImplDC::DoDrawEllipticArc(wxCoord x,wxCoord y,wxCoord w,wxCoo
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;
@@ -1210,7 +1210,7 @@ void wxGnomePrinterImplDC::DoDrawLines(int n, wxPoint points[], wxCoord xoffset,
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))
{
@@ -1258,16 +1258,16 @@ void wxGnomePrinterImplDC::DoDrawPolygon(int n, wxPoint points[],
}
}
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--;
@@ -1305,7 +1305,7 @@ void wxGnomePrinterImplDC::DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width,
}
}
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--;
@@ -1377,7 +1377,7 @@ void wxGnomePrinterImplDC::DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord
}
}
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;
@@ -1423,7 +1423,7 @@ void wxGnomePrinterImplDC::makeEllipticalPath(wxCoord x, wxCoord y,
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--;
@@ -1448,7 +1448,7 @@ void wxGnomePrinterImplDC::DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wx
}
#if wxUSE_SPLINES
void wxGnomePrinterImplDC::DoDrawSpline(const wxPointList *points)
void wxGnomePrinterDCImpl::DoDrawSpline(const wxPointList *points)
{
SetPen (m_pen);
@@ -1508,7 +1508,7 @@ void wxGnomePrinterImplDC::DoDrawSpline(const wxPointList *points)
#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,
@@ -1531,13 +1531,13 @@ wxGnomePrinterImplDC::DoBlit(wxCoord xdest, wxCoord ydest,
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))
{
@@ -1589,12 +1589,12 @@ wxGnomePrinterImplDC::DoDrawBitmap(const wxBitmap& bitmap,
}
}
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);
@@ -1676,11 +1676,11 @@ void wxGnomePrinterImplDC::DoDrawRotatedText(const wxString& text, wxCoord x, wx
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;
@@ -1695,7 +1695,7 @@ void wxGnomePrinterImplDC::SetFont( const wxFont& font )
}
}
void wxGnomePrinterImplDC::SetPen( const wxPen& pen )
void wxGnomePrinterDCImpl::SetPen( const wxPen& pen )
{
if (!pen.Ok()) return;
@@ -1761,7 +1761,7 @@ void wxGnomePrinterImplDC::SetPen( const wxPen& pen )
}
}
void wxGnomePrinterImplDC::SetBrush( const wxBrush& brush )
void wxGnomePrinterDCImpl::SetBrush( const wxBrush& brush )
{
if (!brush.Ok()) return;
@@ -1800,15 +1800,15 @@ void wxGnomePrinterImplDC::SetBrush( const wxBrush& brush )
}
}
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
@@ -1831,10 +1831,10 @@ void wxGnomePrinterImplDC::DoSetClippingRegion(wxCoord x, wxCoord y, wxCoord wid
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
@@ -1850,27 +1850,27 @@ void wxGnomePrinterImplDC::DestroyClippingRegion()
#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 );
@@ -1880,7 +1880,7 @@ wxCoord wxGnomePrinterImplDC::GetCharHeight() const
return h;
}
wxCoord wxGnomePrinterImplDC::GetCharWidth() const
wxCoord wxGnomePrinterDCImpl::GetCharWidth() const
{
pango_layout_set_text( m_layout, "H", 1 );
@@ -1890,7 +1890,7 @@ wxCoord wxGnomePrinterImplDC::GetCharWidth() const
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
@@ -1954,7 +1954,7 @@ void wxGnomePrinterImplDC::DoGetTextExtent(const wxString& string, wxCoord *widt
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();
@@ -1970,7 +1970,7 @@ void wxGnomePrinterImplDC::DoGetSize(int* width, int* height) const
*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();
@@ -1993,12 +1993,12 @@ void wxGnomePrinterImplDC::DoGetSizeMM(int *width, int *height) const
*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;
@@ -2012,12 +2012,12 @@ void wxGnomePrinterImplDC::SetPrintData(const wxPrintData& 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;
@@ -2110,7 +2110,7 @@ void wxGnomePrintPreview::DetermineScaling()
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);

View File

@@ -13,6 +13,7 @@
#if wxUSE_MINIFRAME
#include "wx/minifram.h"
#include "wx/gtk/dcclient.h"
#ifndef WX_PRECOMP
#include "wx/settings.h"
@@ -73,15 +74,9 @@ static gboolean gtk_window_own_expose_callback(GtkWidget* widget, GdkEventExpose
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)
{

View File

@@ -145,9 +145,9 @@ wxGtkPrintFactory::CreatePrintSetupDialog(wxWindow * WXUNUSED(parent),
#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
@@ -1105,14 +1105,14 @@ bool wxGtkPrinter::Setup( wxWindow * WXUNUSED(parent) )
#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
@@ -1155,18 +1155,18 @@ wxGtkPrinterDC::wxGtkPrinterDC( const wxPrintData& data )
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))
@@ -1177,7 +1177,7 @@ bool wxGtkPrinterImplDC::DoFloodFill(wxCoord WXUNUSED(x1),
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;
@@ -1223,7 +1223,7 @@ void wxGtkPrinterImplDC::DoGradientFillConcentric(const wxRect& rect, const wxCo
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;
@@ -1273,7 +1273,7 @@ void wxGtkPrinterImplDC::DoGradientFillLinear(const wxRect& rect, const wxColour
CalcBoundingBox(x+w, y+h);
}
bool wxGtkPrinterImplDC::DoGetPixel(wxCoord WXUNUSED(x1),
bool wxGtkPrinterDCImpl::DoGetPixel(wxCoord WXUNUSED(x1),
wxCoord WXUNUSED(y1),
wxColour * WXUNUSED(col)) const
{
@@ -1281,7 +1281,7 @@ bool wxGtkPrinterImplDC::DoGetPixel(wxCoord WXUNUSED(x1),
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;
@@ -1294,7 +1294,7 @@ void wxGtkPrinterImplDC::DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord
CalcBoundingBox( x2, y2 );
}
void wxGtkPrinterImplDC::DoCrossHair(wxCoord x, wxCoord y)
void wxGtkPrinterDCImpl::DoCrossHair(wxCoord x, wxCoord y)
{
int w, h;
DoGetSize(&w, &h);
@@ -1311,7 +1311,7 @@ void wxGtkPrinterImplDC::DoCrossHair(wxCoord x, wxCoord y)
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;
@@ -1363,7 +1363,7 @@ void wxGtkPrinterImplDC::DoDrawArc(wxCoord x1,wxCoord y1,wxCoord x2,wxCoord y2,w
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 );
@@ -1389,7 +1389,7 @@ void wxGtkPrinterImplDC::DoDrawEllipticArc(wxCoord x,wxCoord y,wxCoord w,wxCoord
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;
@@ -1402,7 +1402,7 @@ void wxGtkPrinterImplDC::DoDrawPoint(wxCoord x, wxCoord y)
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;
@@ -1422,7 +1422,7 @@ void wxGtkPrinterImplDC::DoDrawLines(int n, wxPoint points[], wxCoord xoffset, w
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;
@@ -1456,16 +1456,16 @@ void wxGtkPrinterImplDC::DoDrawPolygon(int n, wxPoint points[], wxCoord xoffset,
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--;
@@ -1483,7 +1483,7 @@ void wxGtkPrinterImplDC::DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wx
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--;
@@ -1531,7 +1531,7 @@ void wxGtkPrinterImplDC::DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord wi
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--;
@@ -1557,7 +1557,7 @@ void wxGtkPrinterImplDC::DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCo
}
#if wxUSE_SPLINES
void wxGtkPrinterImplDC::DoDrawSpline(const wxPointList *points)
void wxGtkPrinterDCImpl::DoDrawSpline(const wxPointList *points)
{
SetPen (m_pen);
@@ -1616,7 +1616,7 @@ void wxGtkPrinterImplDC::DoDrawSpline(const wxPointList *points)
}
#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,
@@ -1641,14 +1641,14 @@ bool wxGtkPrinterImplDC::DoBlit(wxCoord xdest, wxCoord ydest,
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));
@@ -1759,12 +1759,12 @@ void wxGtkPrinterImplDC::DoDrawBitmap( const wxBitmap& bitmap, wxCoord x, wxCoor
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);
@@ -1876,7 +1876,7 @@ void wxGtkPrinterImplDC::DoDrawRotatedText(const wxString& text, wxCoord x, wxCo
CalcBoundingBox (x + w, y + h);
}
void wxGtkPrinterImplDC::Clear()
void wxGtkPrinterDCImpl::Clear()
{
// Clear does nothing for printing, but keep the code
// for later reuse
@@ -1889,7 +1889,7 @@ void wxGtkPrinterImplDC::Clear()
*/
}
void wxGtkPrinterImplDC::SetFont( const wxFont& font )
void wxGtkPrinterDCImpl::SetFont( const wxFont& font )
{
m_font = font;
@@ -1910,7 +1910,7 @@ void wxGtkPrinterImplDC::SetFont( const wxFont& font )
}
}
void wxGtkPrinterImplDC::SetPen( const wxPen& pen )
void wxGtkPrinterDCImpl::SetPen( const wxPen& pen )
{
if (!pen.Ok()) return;
@@ -1989,7 +1989,7 @@ void wxGtkPrinterImplDC::SetPen( const wxPen& pen )
}
}
void wxGtkPrinterImplDC::SetBrush( const wxBrush& brush )
void wxGtkPrinterDCImpl::SetBrush( const wxBrush& brush )
{
if (!brush.Ok()) return;
@@ -2082,7 +2082,7 @@ void wxGtkPrinterImplDC::SetBrush( const wxBrush& brush )
}
}
void wxGtkPrinterImplDC::SetLogicalFunction( int function )
void wxGtkPrinterDCImpl::SetLogicalFunction( int function )
{
if (function == wxCLEAR)
gs_cairo->cairo_set_operator (m_cairo, CAIRO_OPERATOR_CLEAR);
@@ -2100,7 +2100,7 @@ void wxGtkPrinterImplDC::SetLogicalFunction( int function )
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);
@@ -2111,7 +2111,7 @@ void wxGtkPrinterImplDC::SetBackground( const wxBrush& brush )
gs_cairo->cairo_restore(m_cairo);
}
void wxGtkPrinterImplDC::SetBackgroundMode(int mode)
void wxGtkPrinterDCImpl::SetBackgroundMode(int mode)
{
if (mode == wxSOLID)
m_backgroundMode = wxSOLID;
@@ -2119,38 +2119,38 @@ void wxGtkPrinterImplDC::SetBackgroundMode(int mode)
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 );
@@ -2160,7 +2160,7 @@ wxCoord wxGtkPrinterImplDC::GetCharHeight() const
return wxRound( h * m_PS2DEV );
}
wxCoord wxGtkPrinterImplDC::GetCharWidth() const
wxCoord wxGtkPrinterDCImpl::GetCharWidth() const
{
pango_layout_set_text( m_layout, "H", 1 );
@@ -2170,7 +2170,7 @@ wxCoord wxGtkPrinterImplDC::GetCharWidth() const
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
@@ -2228,7 +2228,7 @@ void wxGtkPrinterImplDC::DoGetTextExtent(const wxString& string, wxCoord *width,
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 );
@@ -2238,7 +2238,7 @@ void wxGtkPrinterImplDC::DoGetSize(int* width, int* height) const
*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 );
@@ -2248,19 +2248,19 @@ void wxGtkPrinterImplDC::DoGetSizeMM(int *width, int *height) const
*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;
@@ -2269,7 +2269,7 @@ wxRect wxGtkPrinterImplDC::GetPaperRect()
return wxRect( 0,0,w,h );
}
int wxGtkPrinterImplDC::GetResolution()
int wxGtkPrinterDCImpl::GetResolution()
{
return m_resolution;
}

View File

@@ -33,6 +33,8 @@
#include "wx/module.h"
#endif
#include "wx/gtk/dc.h"
#include <gtk/gtk.h>
// ----------------------------------------------------------------------------
@@ -282,8 +284,8 @@ wxRendererGTK::DrawHeaderButton(wxWindow *win,
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
@@ -329,8 +331,8 @@ wxRendererGTK::DrawTreeItemButton(wxWindow* win,
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
@@ -416,8 +418,8 @@ wxRendererGTK::DrawSplitterSash(wxWindow *win,
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
@@ -484,8 +486,8 @@ wxRendererGTK::DrawDropArrow(wxWindow *WXUNUSED(win),
// 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
@@ -554,8 +556,8 @@ wxRendererGTK::DrawCheckBox(wxWindow *WXUNUSED(win),
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
@@ -600,8 +602,8 @@ wxRendererGTK::DrawPushButton(wxWindow *WXUNUSED(win),
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
@@ -643,8 +645,8 @@ wxRendererGTK::DrawItemSelectionRect(wxWindow *win,
{
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
@@ -700,8 +702,8 @@ void wxRendererGTK::DrawFocusRect(wxWindow* win, wxDC& dc, const wxRect& rect, i
{
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

View File

@@ -629,6 +629,7 @@ bool wxToolBar::DoInsertTool(size_t pos, wxToolBarToolBase *toolBase)
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);
@@ -639,6 +640,15 @@ bool wxToolBar::DoInsertTool(size_t pos, wxToolBarToolBase *toolBase)
(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;

View File

@@ -701,6 +701,7 @@ bool wxTextCtrl::Create( wxWindow *parent,
if (style & wxNO_BORDER)
g_object_set (m_text, "has-frame", FALSE, NULL);
}
m_parent->DoAddChild( this );

View File

@@ -1,6 +1,6 @@
/////////////////////////////////////////////////////////////////////////////
// Name: src/mac/carbon/dcclient.cpp
// Purpose: wxClientDC class
// Purpose: wxClientDCImpl class
// Author: Stefan Csomor
// Modified by:
// Created: 01/02/97
@@ -28,36 +28,22 @@
#include "wx/mac/private.h"
//-----------------------------------------------------------------------------
// constants
// wxWindowDCImpl
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// wxPaintDC
//-----------------------------------------------------------------------------
IMPLEMENT_ABSTRACT_CLASS(wxWindowDCImpl, wxGCDCImpl)
IMPLEMENT_DYNAMIC_CLASS(wxWindowDC, wxDC)
IMPLEMENT_DYNAMIC_CLASS(wxClientDC, wxWindowDC)
IMPLEMENT_DYNAMIC_CLASS(wxPaintDC, wxWindowDC)
/*
* wxWindowDC
*/
#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;
@@ -82,14 +68,14 @@ wxWindowDC::wxWindowDC(wxWindow *window)
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 )
{
@@ -100,7 +86,7 @@ wxWindowDC::~wxWindowDC()
}
}
void wxWindowDC::DoGetSize( int* width, int* height ) const
void wxWindowDCImpl::DoGetSize( int* width, int* height ) const
{
if ( width )
*width = m_width;
@@ -108,7 +94,7 @@ void wxWindowDC::DoGetSize( int* width, int* height ) const
*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.
@@ -168,46 +154,50 @@ wxBitmap wxWindowDC::DoGetAsBitmap(const wxRect *subrect) const
}
/*
* 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()
{
}

View File

@@ -17,12 +17,32 @@
#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);
@@ -32,13 +52,7 @@ void wxMemoryDC::Init()
m_ok = false;
}
wxMemoryDC::wxMemoryDC( wxDC *WXUNUSED(dc) )
: m_selected()
{
Init();
}
wxMemoryDC::~wxMemoryDC()
wxMemoryDCImpl::~wxMemoryDCImpl()
{
if ( m_selected.Ok() )
{
@@ -48,7 +62,7 @@ wxMemoryDC::~wxMemoryDC()
}
}
void wxMemoryDC::DoSelect( const wxBitmap& bitmap )
void wxMemoryDCImpl::DoSelect( const wxBitmap& bitmap )
{
if ( m_selected.Ok() )
{
@@ -82,7 +96,7 @@ void wxMemoryDC::DoSelect( const wxBitmap& bitmap )
}
}
void wxMemoryDC::DoGetSize( int *width, int *height ) const
void wxMemoryDCImpl::DoGetSize( int *width, int *height ) const
{
if (m_selected.Ok())
{

View File

@@ -27,9 +27,10 @@
#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
{
@@ -107,7 +108,8 @@ bool wxMacCarbonPrinterDC::StartDoc( wxPrinterDC* dc , const wxString& WXUNUSED
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,
@@ -149,7 +151,8 @@ void wxMacCarbonPrinterDC::EndDoc( 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 = PMSessionEndDocumentNoDialog(native->m_macPrintSession);
}
@@ -159,7 +162,8 @@ void wxMacCarbonPrinterDC::StartPage( 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 = PMSessionBeginPageNoDialog(native->m_macPrintSession,
native->m_macPageFormat,
@@ -195,7 +199,7 @@ void wxMacCarbonPrinterDC::StartPage( wxPrinterDC* dc )
// 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 )
@@ -203,7 +207,8 @@ 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 )
@@ -211,7 +216,7 @@ void wxMacCarbonPrinterDC::EndPage( wxPrinterDC* dc )
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
@@ -231,7 +236,8 @@ wxSize wxMacCarbonPrinterDC::GetPPI() const
//
//
wxPrinterDC::wxPrinterDC(const wxPrintData& printdata)
wxPrinterDCImpl::wxPrinterDCImpl( wxPrinterDC *owner, const wxPrintData& printdata )
: wxGCDCImpl( owner )
{
m_ok = false ;
m_printData = printdata ;
@@ -259,24 +265,24 @@ wxPrinterDC::wxPrinterDC(const wxPrintData& 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
}
@@ -292,12 +298,12 @@ bool wxPrinterDC::StartDoc( const wxString& message )
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 )
@@ -309,10 +315,10 @@ void wxPrinterDC::EndDoc(void)
}
}
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 ;
@@ -324,7 +330,7 @@ wxRect wxPrinterDC::GetPaperRect()
wxCoord(rPaper.right - rPaper.left), wxCoord(rPaper.bottom - rPaper.top));
}
void wxPrinterDC::StartPage(void)
void wxPrinterDCImpl::StartPage()
{
if ( !m_ok )
return ;
@@ -340,21 +346,21 @@ void wxPrinterDC::StartPage(void)
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 ) ;

View File

@@ -12,18 +12,20 @@
#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;
@@ -46,7 +48,7 @@ wxScreenDC::wxScreenDC()
#endif
}
wxScreenDC::~wxScreenDC()
wxScreenDCImpl::~wxScreenDCImpl()
{
delete m_graphicContext;
m_graphicContext = NULL;

View File

@@ -2166,6 +2166,7 @@ public :
// Context
virtual wxGraphicsContext * CreateContext( const wxWindowDC& dc);
virtual wxGraphicsContext * CreateContext( const wxMemoryDC& dc);
virtual wxGraphicsContext * CreateContextFromNativeContext( void * context );
@@ -2218,18 +2219,26 @@ wxGraphicsRenderer* wxGraphicsRenderer::GetDefaultRenderer()
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 )

View File

@@ -26,12 +26,14 @@
#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())
@@ -226,15 +228,20 @@ bool wxMetaFile::Play(wxDC *dc)
if (!m_refData)
return false;
if (!dc->Ok())
if (!dc->IsOk())
return false;
{
CGContextRef cg = (CGContextRef) dc->GetGraphicsContext()->GetNativeContext();
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 );
}
@@ -260,10 +267,12 @@ wxSize wxMetaFile::GetSize() const
// 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"));
@@ -279,11 +288,11 @@ wxMetaFileDC::wxMetaFileDC(
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") );
@@ -294,7 +303,7 @@ void wxMetaFileDC::DoGetSize(int *width, int *height) const
(*height) = sz.y;
}
wxMetaFile *wxMetaFileDC::Close()
wxMetaFile *wxMetafileDCImpl::Close()
{
delete m_graphicContext;
m_graphicContext = NULL;

View File

@@ -134,14 +134,23 @@ void wxOverlayImpl::Init( wxWindowDC* dc, int x , int y , int width , int height
void wxOverlayImpl::BeginDrawing( wxWindowDC* dc)
{
dc->SetGraphicsContext( wxGraphicsContext::CreateFromNative( m_overlayContext ) );
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 );
}

View File

@@ -403,7 +403,7 @@ bool wxMacPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt)
}
// May have pressed cancel.
if (!dc || !dc->Ok())
if (!dc || !dc->IsOk())
{
if (dc)
delete dc;
@@ -606,7 +606,7 @@ void wxMacPrintPreview::DetermineScaling(void)
// 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 ) ;

View File

@@ -126,8 +126,9 @@ int wxRendererMac::DrawHeaderButton( wxWindow *win,
else
{
CGContextRef cgContext;
wxGCDCImpl *impl = (wxGCDCImpl*) dc.GetImpl();
cgContext = (CGContextRef) dc.GetGraphicsContext()->GetNativeContext();
cgContext = (CGContextRef) impl->GetGraphicsContext()->GetNativeContext();
{
HIThemeButtonDrawInfo drawInfo;
@@ -209,7 +210,8 @@ void wxRendererMac::DrawTreeItemButton( wxWindow *win,
{
CGContextRef cgContext;
cgContext = (CGContextRef) dc.GetGraphicsContext()->GetNativeContext();
wxGCDCImpl *impl = (wxGCDCImpl*) dc.GetImpl();
cgContext = (CGContextRef) impl->GetGraphicsContext()->GetNativeContext();
HIThemeButtonDrawInfo drawInfo;
HIRect labelRect;
@@ -255,8 +257,8 @@ void wxRendererMac::DrawSplitterSash( wxWindow *win,
else
{
CGContextRef cgContext;
cgContext = (CGContextRef) dc.GetGraphicsContext()->GetNativeContext();
wxGCDCImpl *impl = (wxGCDCImpl*) dc.GetImpl();
cgContext = (CGContextRef) impl->GetGraphicsContext()->GetNativeContext();
HIThemeSplitterDrawInfo drawInfo;
drawInfo.version = 0;
@@ -309,8 +311,9 @@ wxRendererMac::DrawMacThemeButton(wxWindow *win,
}
else
{
wxGCDCImpl *impl = (wxGCDCImpl*) dc.GetImpl();
CGContextRef cgContext;
cgContext = (CGContextRef) dc.GetGraphicsContext()->GetNativeContext();
cgContext = (CGContextRef) impl->GetGraphicsContext()->GetNativeContext();
HIThemeButtonDrawInfo drawInfo;
HIRect labelRect;

View File

@@ -559,7 +559,7 @@ void wxApp::OnIdle(wxIdleEvent& WXUNUSED(event))
// 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
}

View File

@@ -535,9 +535,14 @@ bool wxBitmap::Create(int width, int height, int depth)
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)
@@ -805,10 +810,15 @@ bool wxBitmap::CreateFromImage(const wxImage& image, int depth)
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

View File

@@ -174,8 +174,9 @@ bool wxCheckListBoxItem::OnDrawItem(wxDC& dc, const wxRect& rc,
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);

View File

@@ -41,6 +41,7 @@
#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.
@@ -479,7 +480,8 @@ void wxComboCtrl::OnPaintEvent( wxPaintEvent& WXUNUSED(event) )
#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;

View File

@@ -76,7 +76,7 @@
#define WXMICROWIN_CHECK_HDC_RET(x)
#endif
IMPLEMENT_ABSTRACT_CLASS(wxDC, wxDCBase)
IMPLEMENT_ABSTRACT_CLASS(wxMSWDCImpl, wxDCImpl)
// ---------------------------------------------------------------------------
// constants
@@ -161,11 +161,11 @@ wxAlphaBlend(HDC hdcDst, int xDst, int yDst,
class wxColourChanger
{
public:
wxColourChanger(wxDC& dc);
wxColourChanger(wxMSWDCImpl& dc);
~wxColourChanger();
private:
wxDC& m_dc;
wxMSWDCImpl& m_dc;
COLORREF m_colFgOld, m_colBgOld;
@@ -279,7 +279,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxGDIDLLsCleanupModule, wxModule)
// 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 )
@@ -330,10 +330,17 @@ wxColourChanger::~wxColourChanger()
}
// ---------------------------------------------------------------------------
// wxDC
// wxMSWDCImpl
// ---------------------------------------------------------------------------
wxDC::~wxDC()
wxMSWDCImpl::wxMSWDCImpl( wxDC *owner, WXHDC hDC ) :
wxDCImpl( owner )
{
Init();
m_hDC = hDC;
}
wxMSWDCImpl::~wxMSWDCImpl()
{
if ( m_hDC != 0 )
{
@@ -347,9 +354,9 @@ wxDC::~wxDC()
}
else // we don't own our HDC
{
if (m_canvas)
if (m_window)
{
::ReleaseDC(GetHwndOf(m_canvas), GetHdc());
::ReleaseDC(GetHwndOf(m_window), GetHdc());
}
else
{
@@ -363,7 +370,7 @@ wxDC::~wxDC()
// 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)
{
@@ -417,7 +424,7 @@ void wxDC::SelectOldObjects(WXHDC dc)
// clipping
// ---------------------------------------------------------------------------
void wxDC::UpdateClipBox()
void wxMSWDCImpl::UpdateClipBox()
{
WXMICROWIN_CHECK_HDC
@@ -431,25 +438,25 @@ void wxDC::UpdateClipBox()
}
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") );
@@ -494,7 +501,7 @@ void wxDC::SetClippingHrgn(WXHRGN hrgn)
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
@@ -516,12 +523,12 @@ void wxDC::DoSetClippingRegion(wxCoord x, wxCoord y, wxCoord w, wxCoord h)
}
}
void wxDC::DoSetClippingRegionAsRegion(const wxRegion& region)
void wxMSWDCImpl::DoSetClippingRegionAsRegion(const wxRegion& region)
{
SetClippingHrgn(region.GetHRGN());
}
void wxDC::DestroyClippingRegion()
void wxMSWDCImpl::DestroyClippingRegion()
{
WXMICROWIN_CHECK_HDC
@@ -545,19 +552,19 @@ void wxDC::DestroyClippingRegion()
#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
@@ -570,7 +577,7 @@ bool wxDC::CanGetTextExtent() const
#endif
}
int wxDC::GetDepth() const
int wxMSWDCImpl::GetDepth() const
{
WXMICROWIN_CHECK_HDC_RET(16)
@@ -581,14 +588,14 @@ int wxDC::GetDepth() const
// 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
{
@@ -615,7 +622,7 @@ void wxDC::Clear()
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))
@@ -652,11 +659,11 @@ bool wxDC::DoFloodFill(wxCoord WXUNUSED_IN_WINCE(x),
#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));
@@ -666,7 +673,7 @@ bool wxDC::DoGetPixel(wxCoord x, wxCoord y, wxColour *col) const
return true;
}
void wxDC::DoCrossHair(wxCoord x, wxCoord y)
void wxMSWDCImpl::DoCrossHair(wxCoord x, wxCoord y)
{
WXMICROWIN_CHECK_HDC
@@ -682,7 +689,7 @@ void wxDC::DoCrossHair(wxCoord x, wxCoord y)
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
@@ -694,7 +701,7 @@ void wxDC::DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2)
// 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)
{
@@ -719,7 +726,7 @@ void wxDC::DoDrawArc(wxCoord x1, wxCoord y1,
// 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;
}
@@ -755,7 +762,7 @@ void wxDC::DoDrawArc(wxCoord x1, wxCoord y1,
#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()
@@ -782,7 +789,7 @@ void wxDC::DoDrawCheckMark(wxCoord x1, wxCoord y1,
#endif // Microwin/Normal
}
void wxDC::DoDrawPoint(wxCoord x, wxCoord y)
void wxMSWDCImpl::DoDrawPoint(wxCoord x, wxCoord y)
{
WXMICROWIN_CHECK_HDC
@@ -797,7 +804,7 @@ void wxDC::DoDrawPoint(wxCoord x, wxCoord y)
CalcBoundingBox(x, y);
}
void wxDC::DoDrawPolygon(int n,
void wxMSWDCImpl::DoDrawPolygon(int n,
wxPoint points[],
wxCoord xoffset,
wxCoord yoffset,
@@ -845,7 +852,7 @@ void wxDC::DoDrawPolygon(int n,
}
void
wxDC::DoDrawPolyPolygon(int n,
wxMSWDCImpl::DoDrawPolyPolygon(int n,
int count[],
wxPoint points[],
wxCoord xoffset,
@@ -899,7 +906,7 @@ wxDC::DoDrawPolyPolygon(int n,
// __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
@@ -928,7 +935,7 @@ void wxDC::DoDrawLines(int n, wxPoint points[], wxCoord xoffset, wxCoord yoffset
}
}
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
@@ -970,7 +977,7 @@ void wxDC::DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
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
@@ -1004,7 +1011,7 @@ void wxDC::DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord h
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
@@ -1020,7 +1027,7 @@ void wxDC::DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
}
#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
@@ -1119,7 +1126,7 @@ void wxDC::DoDrawSpline(const wxPointList *points)
#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 );
@@ -1180,7 +1187,7 @@ void wxDC::DoDrawEllipticArc(wxCoord x,wxCoord y,wxCoord w,wxCoord h,double sa,d
#endif
}
void wxDC::DoDrawIcon(const wxIcon& icon, wxCoord x, wxCoord y)
void wxMSWDCImpl::DoDrawIcon(const wxIcon& icon, wxCoord x, wxCoord y)
{
WXMICROWIN_CHECK_HDC
@@ -1196,11 +1203,11 @@ void wxDC::DoDrawIcon(const wxIcon& icon, wxCoord x, wxCoord y)
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();
@@ -1275,13 +1282,13 @@ void wxDC::DoDrawBitmap( const wxBitmap &bmp, wxCoord x, wxCoord y, bool useMask
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);
}
@@ -1330,7 +1337,7 @@ void wxDC::DoDrawBitmap( const wxBitmap &bmp, wxCoord x, wxCoord y, bool useMask
}
}
void wxDC::DoDrawText(const wxString& text, wxCoord x, wxCoord y)
void wxMSWDCImpl::DoDrawText(const wxString& text, wxCoord x, wxCoord y)
{
WXMICROWIN_CHECK_HDC
@@ -1340,11 +1347,11 @@ void wxDC::DoDrawText(const wxString& text, wxCoord x, wxCoord y)
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
@@ -1384,7 +1391,7 @@ void wxDC::DrawAnyText(const wxString& text, wxCoord x, wxCoord y)
SetBkMode(GetHdc(), TRANSPARENT);
}
void wxDC::DoDrawRotatedText(const wxString& text,
void wxMSWDCImpl::DoDrawRotatedText(const wxString& text,
wxCoord x, wxCoord y,
double angle)
{
@@ -1436,7 +1443,7 @@ void wxDC::DoDrawRotatedText(const wxString& text,
// 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);
@@ -1459,7 +1466,7 @@ void wxDC::DoDrawRotatedText(const wxString& text,
#if wxUSE_PALETTE
void wxDC::DoSelectPalette(bool realize)
void wxMSWDCImpl::DoSelectPalette(bool realize)
{
WXMICROWIN_CHECK_HDC
@@ -1484,7 +1491,7 @@ void wxDC::DoSelectPalette(bool realize)
}
}
void wxDC::SetPalette(const wxPalette& palette)
void wxMSWDCImpl::SetPalette(const wxPalette& palette)
{
if ( palette.Ok() )
{
@@ -1493,13 +1500,13 @@ void wxDC::SetPalette(const wxPalette& palette)
}
}
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 )
@@ -1517,7 +1524,7 @@ void wxDC::InitializePalette()
// 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
@@ -1555,7 +1562,7 @@ void wxDC::SetFont(const wxFont& font)
}
}
void wxDC::SetPen(const wxPen& pen)
void wxMSWDCImpl::SetPen(const wxPen& pen)
{
WXMICROWIN_CHECK_HDC
@@ -1593,7 +1600,7 @@ void wxDC::SetPen(const wxPen& pen)
}
}
void wxDC::SetBrush(const wxBrush& brush)
void wxMSWDCImpl::SetBrush(const wxBrush& brush)
{
WXMICROWIN_CHECK_HDC
@@ -1648,7 +1655,7 @@ void wxDC::SetBrush(const wxBrush& brush)
}
}
void wxDC::SetBackground(const wxBrush& brush)
void wxMSWDCImpl::SetBackground(const wxBrush& brush)
{
WXMICROWIN_CHECK_HDC
@@ -1660,7 +1667,7 @@ void wxDC::SetBackground(const wxBrush& brush)
}
}
void wxDC::SetBackgroundMode(int mode)
void wxMSWDCImpl::SetBackgroundMode(int mode)
{
WXMICROWIN_CHECK_HDC
@@ -1670,7 +1677,7 @@ void wxDC::SetBackgroundMode(int mode)
// and m_backgroundMode is used there
}
void wxDC::SetLogicalFunction(int function)
void wxMSWDCImpl::SetLogicalFunction(int function)
{
WXMICROWIN_CHECK_HDC
@@ -1679,7 +1686,7 @@ void wxDC::SetLogicalFunction(int function)
SetRop(m_hDC);
}
void wxDC::SetRop(WXHDC dc)
void wxMSWDCImpl::SetRop(WXHDC dc)
{
if ( !dc || m_logicalFunction < 0 )
return;
@@ -1713,21 +1720,21 @@ void wxDC::SetRop(WXHDC dc)
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()
{
}
@@ -1735,7 +1742,7 @@ void wxDC::EndPage()
// text metrics
// ---------------------------------------------------------------------------
wxCoord wxDC::GetCharHeight() const
wxCoord wxMSWDCImpl::GetCharHeight() const
{
WXMICROWIN_CHECK_HDC_RET(0)
@@ -1746,7 +1753,7 @@ wxCoord wxDC::GetCharHeight() const
return lpTextMetric.tmHeight;
}
wxCoord wxDC::GetCharWidth() const
wxCoord wxMSWDCImpl::GetCharWidth() const
{
WXMICROWIN_CHECK_HDC_RET(0)
@@ -1757,7 +1764,7 @@ wxCoord wxDC::GetCharWidth() const
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
{
@@ -1775,7 +1782,7 @@ void wxDC::DoGetTextExtent(const wxString& string, wxCoord *x, wxCoord *y,
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));
}
@@ -1841,7 +1848,7 @@ void wxDC::DoGetTextExtent(const wxString& string, wxCoord *x, wxCoord *y,
// 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;
@@ -1879,7 +1886,7 @@ bool wxDC::DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths) con
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
@@ -1899,7 +1906,7 @@ void wxDC::RealizeScaleAndOrigin()
}
void wxDC::SetMapMode(int mode)
void wxMSWDCImpl::SetMapMode(int mode)
{
WXMICROWIN_CHECK_HDC
@@ -1958,19 +1965,19 @@ void wxDC::SetMapMode(int mode)
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
@@ -1981,33 +1988,33 @@ void wxDC::SetAxisOrientation(bool xLeftRight,
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);
}
@@ -2016,7 +2023,7 @@ void wxDC::SetDeviceOrigin(wxCoord x, wxCoord y)
// 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,
@@ -2026,7 +2033,7 @@ bool wxDC::DoBlit(wxCoord dstX, wxCoord dstY,
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,
@@ -2034,18 +2041,27 @@ bool wxDC::DoStretchBlit(wxCoord xdest, wxCoord ydest,
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;
}
@@ -2125,7 +2141,7 @@ bool wxDC::DoStretchBlit(wxCoord xdest, wxCoord ydest,
(
GetHdc(),
xdest, ydest, dstWidth, dstHeight,
GetHdcOf(*source),
GetHdcOf(*msw_impl),
xsrc, ysrc,
(HBITMAP)mask->GetMaskBitmap(),
xsrcMask, ysrcMask,
@@ -2144,7 +2160,7 @@ bool wxDC::DoStretchBlit(wxCoord xdest, wxCoord ydest,
#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());
@@ -2176,7 +2192,7 @@ bool wxDC::DoStretchBlit(wxCoord xdest, wxCoord ydest,
// 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"));
}
@@ -2287,7 +2303,7 @@ bool wxDC::DoStretchBlit(wxCoord xdest, wxCoord ydest,
(
GetHdc(),
xdest, ydest, dstWidth, dstHeight,
GetHdcOf(*source),
GetHdcOf(*msw_impl),
xsrc, ysrc, srcWidth, srcHeight,
dwRop
) )
@@ -2307,7 +2323,7 @@ bool wxDC::DoStretchBlit(wxCoord xdest, wxCoord ydest,
GetHdc(),
xdest, ydest,
(int)dstWidth, (int)dstHeight,
GetHdcOf(*source),
GetHdcOf(*msw_impl),
xsrc, ysrc,
dwRop
) )
@@ -2327,7 +2343,7 @@ bool wxDC::DoStretchBlit(wxCoord xdest, wxCoord ydest,
return success;
}
void wxDC::GetDeviceSize(int *width, int *height) const
void wxMSWDCImpl::GetDeviceSize(int *width, int *height) const
{
WXMICROWIN_CHECK_HDC
@@ -2337,7 +2353,7 @@ void wxDC::GetDeviceSize(int *width, int *height) const
*height = ::GetDeviceCaps(GetHdc(), VERTRES);
}
void wxDC::DoGetSizeMM(int *w, int *h) const
void wxMSWDCImpl::DoGetSizeMM(int *w, int *h) const
{
WXMICROWIN_CHECK_HDC
@@ -2367,7 +2383,7 @@ void wxDC::DoGetSizeMM(int *w, int *h) const
}
}
wxSize wxDC::GetPPI() const
wxSize wxMSWDCImpl::GetPPI() const
{
WXMICROWIN_CHECK_HDC_RET(wxSize(0,0))
@@ -2378,11 +2394,11 @@ wxSize wxDC::GetPPI() const
}
// 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);
}
// ----------------------------------------------------------------------------
@@ -2397,8 +2413,8 @@ void wxDC::SetLogicalScale(double x, double 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)
{
@@ -2426,7 +2442,7 @@ wxDCCacheEntry::~wxDCCacheEntry()
::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();
@@ -2462,7 +2478,7 @@ wxDCCacheEntry* wxDC::FindBitmapInCache(WXHDC dc, int w, int h)
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();
@@ -2491,17 +2507,17 @@ wxDCCacheEntry* wxDC::FindDCInCache(wxDCCacheEntry* notThis, WXHDC dc)
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);
@@ -2512,7 +2528,7 @@ class wxDCModule : public wxModule
{
public:
virtual bool OnInit() { return true; }
virtual void OnExit() { wxDC::ClearCache(); }
virtual void OnExit() { wxMSWDCImpl::ClearCache(); }
private:
DECLARE_DYNAMIC_CLASS(wxDCModule)
@@ -2647,7 +2663,7 @@ wxAlphaBlend(HDC hdcDst, int xDst, int yDst,
#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)
@@ -2708,7 +2724,7 @@ void wxDC::DoGradientFillLinear (const wxRect& rect,
}
#endif // wxUSE_DYNLIB_CLASS
wxDCBase::DoGradientFillLinear(rect, initialColour, destColour, nDirection);
wxDCImpl::DoGradientFillLinear(rect, initialColour, destColour, nDirection);
}
#if wxUSE_DYNLIB_CLASS
@@ -2722,7 +2738,7 @@ static DWORD wxGetDCLayout(HDC hdc)
return s_pfnGetLayout ? s_pfnGetLayout(hdc) : (DWORD)-1;
}
wxLayoutDirection wxDC::GetLayoutDirection() const
wxLayoutDirection wxMSWDCImpl::GetLayoutDirection() const
{
DWORD layout = wxGetDCLayout(GetHdc());
@@ -2732,7 +2748,7 @@ wxLayoutDirection wxDC::GetLayoutDirection() const
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
@@ -2759,12 +2775,12 @@ void wxDC::SetLayoutDirection(wxLayoutDirection dir)
#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))
{
}

View File

@@ -25,6 +25,7 @@
#endif
#include "wx/dcclient.h"
#include "wx/msw/dcclient.h"
#ifndef WX_PRECOMP
#include "wx/string.h"
@@ -40,7 +41,7 @@
struct WXDLLEXPORT wxPaintDCInfo
{
wxPaintDCInfo(wxWindow *win, wxDC *dc)
wxPaintDCInfo(wxWindow *win, wxPaintDCImpl *dc)
{
hwnd = win->GetHWND();
hdc = dc->GetHDC();
@@ -60,11 +61,6 @@ WX_DEFINE_OBJARRAY(wxArrayDCInfo)
// macros
// ----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxWindowDC, wxDC)
IMPLEMENT_DYNAMIC_CLASS(wxClientDC, wxWindowDC)
IMPLEMENT_DYNAMIC_CLASS(wxPaintDC, wxClientDC)
IMPLEMENT_CLASS(wxPaintDCEx, wxPaintDC)
// ----------------------------------------------------------------------------
// global variables
// ----------------------------------------------------------------------------
@@ -84,34 +80,37 @@ static PAINTSTRUCT g_paintStruct;
// ===========================================================================
// ----------------------------------------------------------------------------
// 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
@@ -119,28 +118,31 @@ void wxWindowDC::InitDC()
#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
@@ -148,9 +150,9 @@ wxClientDC::wxClientDC(wxWindow *canvas)
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
@@ -159,7 +161,7 @@ void wxClientDC::InitDC()
// 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
@@ -167,23 +169,23 @@ void wxClientDC::InitDC()
}
// 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
@@ -202,27 +204,30 @@ void wxClientDC::DoGetSize(int *width, int *height) const
// "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();
@@ -233,9 +238,9 @@ wxPaintDC::wxPaintDC(wxWindow *canvas)
}
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.
@@ -250,7 +255,7 @@ wxPaintDC::wxPaintDC(wxWindow *canvas)
m_clipping = true;
}
wxPaintDC::~wxPaintDC()
wxPaintDCImpl::~wxPaintDCImpl()
{
if ( m_hDC )
{
@@ -263,7 +268,7 @@ wxPaintDC::~wxPaintDC()
if ( --info->count == 0 )
{
::EndPaint(GetHwndOf(m_canvas), &g_paintStruct);
::EndPaint(GetHwndOf(m_window), &g_paintStruct);
ms_cache.RemoveAt(index);
@@ -279,14 +284,14 @@ wxPaintDC::~wxPaintDC()
}
}
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 )
@@ -299,7 +304,7 @@ wxPaintDCInfo *wxPaintDC::FindInCache(size_t *index) const
}
// 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++ )
@@ -317,13 +322,35 @@ WXHDC wxPaintDC::FindDCInCache(wxWindow* win)
* 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
{
public:
wxPaintDCExImpl( wxDC *owner, wxWindow *window, WXHDC dc );
~wxPaintDCExImpl();
int m_saveState;
};
IMPLEMENT_ABSTRACT_CLASS(wxPaintDCEx,wxPaintDC)
wxPaintDCEx::wxPaintDCEx( wxWindow *window, WXHDC dc )
{
m_pimpl = new wxPaintDCExImpl( this, window, dc );
}
wxPaintDCExImpl::wxPaintDCExImpl( wxDC *owner, wxWindow *window, WXHDC dc ) :
wxPaintDCImpl( owner )
{
wxCHECK_RET( dc, wxT("wxPaintDCEx requires an existing device context") );
m_canvas = canvas;
m_saveState = 0;
m_window = window;
wxPaintDCInfo *info = FindInCache();
if ( info )
@@ -334,12 +361,12 @@ wxPaintDCEx::wxPaintDCEx(wxWindow *canvas, WXHDC dc) : saveState(0)
else // not in cache, create a new one
{
m_hDC = dc;
ms_cache.Add(new wxPaintDCInfo(m_canvas, this));
saveState = SaveDC((HDC) dc);
ms_cache.Add(new wxPaintDCInfo(m_window, this));
m_saveState = SaveDC((HDC) dc);
}
}
wxPaintDCEx::~wxPaintDCEx()
wxPaintDCExImpl::~wxPaintDCExImpl()
{
size_t index;
wxPaintDCInfo *info = FindInCache(&index);
@@ -348,7 +375,7 @@ wxPaintDCEx::~wxPaintDCEx()
if ( --info->count == 0 )
{
RestoreDC((HDC) m_hDC, saveState);
RestoreDC((HDC) m_hDC, m_saveState);
ms_cache.RemoveAt(index);
// Reduce the number of bogus reports of non-freed memory
@@ -361,3 +388,5 @@ wxPaintDCEx::~wxPaintDCEx()
// prevent the base class dtor from ReleaseDC()ing it again
m_hDC = 0;
}

View File

@@ -25,6 +25,7 @@
#endif
#include "wx/dcmemory.h"
#include "wx/msw/dcmemory.h"
#ifndef WX_PRECOMP
#include "wx/utils.h"
@@ -34,20 +35,28 @@
#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") );
@@ -56,7 +65,7 @@ wxMemoryDC::wxMemoryDC(wxDC *dc)
Init();
}
void wxMemoryDC::Init()
void wxMemoryDCImpl::Init()
{
if ( m_ok )
{
@@ -69,9 +78,17 @@ void wxMemoryDC::Init()
}
}
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;
@@ -81,7 +98,7 @@ bool wxMemoryDC::CreateCompatible(wxDC *dc)
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 )
@@ -123,7 +140,7 @@ void wxMemoryDC::DoSelect( const wxBitmap& bitmap)
}
}
void wxMemoryDC::DoGetSize(int *width, int *height) const
void wxMemoryDCImpl::DoGetSize(int *width, int *height) const
{
if ( m_selectedBitmap.Ok() )
{
@@ -174,7 +191,7 @@ static void wxDrawRectangle(wxDC& dc, wxCoord x, wxCoord y, wxCoord width, wxCoo
#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)
@@ -189,6 +206,6 @@ void wxMemoryDC::DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord he
else
#endif // wxUSE_MEMORY_DC_DRAW_RECTANGLE
{
wxDC::DoDrawRectangle(x, y, width, height);
wxMSWDCImpl::DoDrawRectangle(x, y, width, height);
}
}

View File

@@ -27,6 +27,7 @@
#if wxUSE_PRINTING_ARCHITECTURE
#include "wx/dcprint.h"
#include "wx/msw/dcprint.h"
#ifndef WX_PRECOMP
#include "wx/msw/wrapcdlg.h"
@@ -66,7 +67,7 @@
// wxWin macros
// ----------------------------------------------------------------------------
IMPLEMENT_CLASS(wxPrinterDC, wxDC)
IMPLEMENT_ABSTRACT_CLASS(wxPrinterDCImpl, wxMSWDCImpl)
// ============================================================================
// implementation
@@ -76,6 +77,7 @@ IMPLEMENT_CLASS(wxPrinterDC, wxDC)
// wxPrinterDC construction
// ----------------------------------------------------------------------------
#if 0
// This form is deprecated
wxPrinterDC::wxPrinterDC(const wxString& driver_name,
const wxString& device_name,
@@ -136,8 +138,10 @@ wxPrinterDC::wxPrinterDC(const wxString& driver_name,
Init();
}
#endif
wxPrinterDC::wxPrinterDC(const wxPrintData& printData)
wxPrinterDCImpl::wxPrinterDCImpl( wxPrinterDC *owner, const wxPrintData& printData ) :
wxMSWDCImpl( owner )
{
m_printData = printData;
@@ -151,7 +155,8 @@ wxPrinterDC::wxPrinterDC(const wxPrintData& printData)
}
wxPrinterDC::wxPrinterDC(WXHDC dc)
wxPrinterDCImpl::wxPrinterDCImpl( wxPrinterDC *owner, WXHDC dc ) :
wxMSWDCImpl( owner )
{
m_isInteractive = false;
@@ -160,7 +165,7 @@ wxPrinterDC::wxPrinterDC(WXHDC dc)
m_ok = true;
}
void wxPrinterDC::Init()
void wxPrinterDCImpl::Init()
{
if ( m_hDC )
{
@@ -174,10 +179,10 @@ void wxPrinterDC::Init()
}
// ----------------------------------------------------------------------------
// 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);
@@ -205,28 +210,28 @@ bool wxPrinterDC::StartDoc(const wxString& message)
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);
@@ -338,7 +343,7 @@ WXHDC WXDLLEXPORT wxGetPrinterDC(const wxPrintData& printDataConst)
}
// ----------------------------------------------------------------------------
// wxPrinterDC bit blitting/bitmap drawing
// wxPrinterDCImpl bit blitting/bitmap drawing
// ----------------------------------------------------------------------------
// helper of DoDrawBitmap() and DoBlit()
@@ -386,7 +391,7 @@ bool DrawBitmapUsingStretchDIBits(HDC hdc,
#endif
}
void wxPrinterDC::DoDrawBitmap(const wxBitmap& bmp,
void wxPrinterDCImpl::DoDrawBitmap(const wxBitmap& bmp,
wxCoord x, wxCoord y,
bool useMask)
{
@@ -403,27 +408,32 @@ void wxPrinterDC::DoDrawBitmap(const wxBitmap& bmp,
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());
@@ -454,7 +464,7 @@ bool wxPrinterDC::DoBlit(wxCoord xdest, wxCoord ydest,
// 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++)
{

View File

@@ -16,7 +16,7 @@
#pragma hdrstop
#endif
#include "wx/dcscreen.h"
#include "wx/msw/dcscreen.h"
#ifndef WX_PRECOMP
#include "wx/string.h"
@@ -25,10 +25,11 @@
#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);
@@ -36,3 +37,4 @@ wxScreenDC::wxScreenDC()
// DrawText() to OPAQUE as required, otherwise always TRANSPARENT
::SetBkMode( GetHdc(), TRANSPARENT );
}

View File

@@ -32,6 +32,9 @@
#include "wx/intl.h"
#endif //WX_PRECOMP
#include "wx/dc.h"
#include "wx/msw/dc.h"
#include "wx/metafile.h"
#include "wx/clipbrd.h"
@@ -42,7 +45,6 @@
// ----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxEnhMetaFile, wxObject)
IMPLEMENT_ABSTRACT_CLASS(wxEnhMetaFileDC, wxDC)
// ----------------------------------------------------------------------------
// macros
@@ -136,7 +138,12 @@ bool wxEnhMetaFile::Play(wxDC *dc, wxRect *rectBound)
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"));
@@ -190,9 +197,42 @@ bool wxEnhMetaFile::SetClipboard(int WXUNUSED(width), int WXUNUSED(height))
// 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;
@@ -226,7 +266,7 @@ wxEnhMetaFileDC::wxEnhMetaFileDC(const wxString& filename,
}
}
void wxEnhMetaFileDC::DoGetSize(int *width, int *height) const
void wxEnhMetaFileDCImpl::DoGetSize(int *width, int *height) const
{
if ( width )
*width = m_width;
@@ -234,9 +274,9 @@ void wxEnhMetaFileDC::DoGetSize(int *width, int *height) const
*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 )
@@ -251,7 +291,7 @@ wxEnhMetaFile *wxEnhMetaFileDC::Close()
return mf;
}
wxEnhMetaFileDC::~wxEnhMetaFileDC()
wxEnhMetaFileDCImpl::~wxEnhMetaFileDCImpl()
{
// avoid freeing it in the base class dtor
m_hDC = 0;

View File

@@ -38,6 +38,8 @@
#endif
#include "wx/imaglist.h"
#include "wx/dc.h"
#include "wx/msw/dc.h"
#include "wx/msw/private.h"
// ----------------------------------------------------------------------------
@@ -241,7 +243,12 @@ bool wxImageList::Draw(int index,
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

View File

@@ -945,9 +945,11 @@ void wxNotebook::OnPaint(wxPaintEvent& WXUNUSED(event))
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.

View File

@@ -312,7 +312,8 @@ bool wxOwnerDrawn::OnDrawItem(wxDC& dc,
}
HDC hdc = GetHdcOf(dc);
wxMSWDCImpl *impl = (wxMSWDCImpl*) dc.GetImpl();
HDC hdc = GetHdcOf(*impl);
COLORREF colOldText = ::SetTextColor(hdc, colText),
colOldBack = ::SetBkColor(hdc, colBack);

View File

@@ -37,6 +37,7 @@
#include "wx/printdlg.h"
#include "wx/msw/printdlg.h"
#include "wx/msw/dcprint.h"
#include "wx/paper.h"
#include <stdlib.h>
@@ -638,7 +639,7 @@ int wxWindowsPrintDialog::ShowModal()
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;

View File

@@ -44,6 +44,7 @@
#include "wx/msw/printwin.h"
#include "wx/msw/printdlg.h"
#include "wx/msw/private.h"
#include "wx/msw/dcprint.h"
#include <stdlib.h>
@@ -119,19 +120,21 @@ bool wxWindowsPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt
}
// 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;
@@ -179,12 +182,12 @@ bool wxWindowsPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt
#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
@@ -370,9 +373,10 @@ void wxWindowsPrintPreview::DetermineScaling()
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);

View File

@@ -227,7 +227,7 @@ wxRendererMSW::DrawComboBoxDropButton(wxWindow * WXUNUSED(win),
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
@@ -251,7 +251,7 @@ wxRendererMSW::DrawCheckBox(wxWindow * WXUNUSED(win),
if ( flags & wxCONTROL_CURRENT )
style |= DFCS_HOT;
::DrawFrameControl(GetHdcOf(dc), &r, DFC_BUTTON, style);
::DrawFrameControl(GetHdcOf(*((wxMSWDCImpl*)dc.GetImpl())), &r, DFC_BUTTON, style);
}
void
@@ -280,7 +280,7 @@ wxRendererMSW::DrawPushButton(wxWindow * WXUNUSED(win),
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),
@@ -291,7 +291,7 @@ 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))
@@ -363,7 +363,7 @@ wxRendererXP::DrawComboBoxDropButton(wxWindow * win,
wxUxThemeEngine::Get()->DrawThemeBackground
(
hTheme,
GetHdcOf(dc),
GetHdcOf(*((wxMSWDCImpl*)dc.GetImpl())),
CP_DROPDOWNBUTTON,
state,
&r,
@@ -399,7 +399,7 @@ wxRendererXP::DrawHeaderButton(wxWindow *win,
wxUxThemeEngine::Get()->DrawThemeBackground
(
hTheme,
GetHdcOf(dc),
GetHdcOf(*((wxMSWDCImpl*)dc.GetImpl())),
HP_HEADERITEM,
state,
&r,
@@ -435,7 +435,7 @@ wxRendererXP::DrawTreeItemButton(wxWindow *win,
wxUxThemeEngine::Get()->DrawThemeBackground
(
hTheme,
GetHdcOf(dc),
GetHdcOf(*((wxMSWDCImpl*)dc.GetImpl())),
TVP_GLYPH,
state,
&r,
@@ -485,7 +485,7 @@ wxRendererXP::DrawCheckBox(wxWindow *win,
wxUxThemeEngine::Get()->DrawThemeBackground
(
hTheme,
GetHdcOf(dc),
GetHdcOf(*((wxMSWDCImpl*)dc.GetImpl())),
BP_CHECKBOX,
state,
&r,
@@ -524,7 +524,7 @@ wxRendererXP::DrawPushButton(wxWindow * win,
wxUxThemeEngine::Get()->DrawThemeBackground
(
hTheme,
GetHdcOf(dc),
GetHdcOf(*((wxMSWDCImpl*)dc.GetImpl())),
BP_PUSHBUTTON,
state,
&r,

View File

@@ -363,7 +363,8 @@ void wxStaticBox::PaintBackground(wxDC& dc, const RECT& rc)
// 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
@@ -374,12 +375,13 @@ void wxStaticBox::PaintBackground(wxDC& dc, const RECT& rc)
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
@@ -388,7 +390,7 @@ void wxStaticBox::PaintForeground(wxDC& dc, const RECT& rc)
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;
@@ -484,7 +486,8 @@ void wxStaticBox::PaintForeground(wxDC& dc, const RECT& rc)
// 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
{
@@ -552,7 +555,8 @@ void wxStaticBox::OnPaint(wxPaintEvent& WXUNUSED(event))
// 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);

View File

@@ -44,6 +44,7 @@
#endif
#include "wx/sysopt.h"
#include "wx/dcclient.h"
#include "wx/msw/private.h"
@@ -1543,7 +1544,11 @@ void wxToolBar::OnMouseEvent(wxMouseEvent& event)
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);
@@ -1776,7 +1781,8 @@ bool wxToolBar::HandlePaint(WXWPARAM wParam, WXLPARAM lParam)
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;
}

View File

@@ -79,6 +79,7 @@
#endif
#include "wx/msw/private.h"
#include "wx/msw/dcclient.h"
#if wxUSE_TOOLTIPS
#include "wx/tooltip.h"
@@ -3430,9 +3431,10 @@ WXLRESULT wxWindowMSW::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM l
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);
@@ -3458,6 +3460,7 @@ WXLRESULT wxWindowMSW::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM l
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;
@@ -3465,16 +3468,16 @@ WXLRESULT wxWindowMSW::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM l
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
@@ -3486,7 +3489,7 @@ WXLRESULT wxWindowMSW::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM l
// 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;
@@ -4685,7 +4688,7 @@ void wxWindowMSW::OnPaint(wxPaintEvent& event)
#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);
@@ -4696,16 +4699,17 @@ void wxWindowMSW::OnPaint(wxPaintEvent& event)
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;
}
@@ -4729,9 +4733,12 @@ void wxWindowMSW::OnEraseBackground(wxEraseEvent& event)
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();