Converted wxGTK's basic DC classes to new DC code
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@48910 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -137,6 +137,8 @@ private:
|
||||
bool CreateFromImageAsPixbuf(const wxImage& image);
|
||||
#endif // wxUSE_IMAGE
|
||||
|
||||
public:
|
||||
// implementation only
|
||||
enum Representation
|
||||
{
|
||||
Pixmap,
|
||||
@@ -146,9 +148,6 @@ private:
|
||||
// (wxBitmap may keep same bitmap e.g. as both pixmap and pixbuf):
|
||||
void PurgeOtherRepresentations(Representation keep);
|
||||
|
||||
friend class wxMemoryDC;
|
||||
friend class wxBitmapHandler;
|
||||
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS(wxBitmap)
|
||||
};
|
||||
|
@@ -16,16 +16,21 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#if wxUSE_NEW_DC
|
||||
class WXDLLIMPEXP_CORE wxGTKImplDC : public wxDC
|
||||
class WXDLLIMPEXP_CORE wxGTKImplDC : public wxImplDC
|
||||
#else
|
||||
#define wxGTKImplDC wxDC
|
||||
class WXDLLIMPEXP_CORE wxGTKImplDC : public wxDCBase
|
||||
class WXDLLIMPEXP_CORE wxDC : public wxDCBase
|
||||
#endif
|
||||
|
||||
{
|
||||
public:
|
||||
wxGTKImplDC();
|
||||
virtual ~wxGTKImplDC() { }
|
||||
#if wxUSE_NEW_DC
|
||||
wxGTKImplDC( wxDC *owner );
|
||||
#else
|
||||
wxDC();
|
||||
#endif
|
||||
|
||||
virtual ~wxGTKImplDC();
|
||||
|
||||
#if wxUSE_PALETTE
|
||||
void SetColourMap( const wxPalette& palette ) { SetPalette(palette); };
|
||||
|
@@ -27,8 +27,15 @@ class WXDLLIMPEXP_CORE wxWindowDC : public wxDC
|
||||
#endif
|
||||
{
|
||||
public:
|
||||
wxGTKWindowImplDC();
|
||||
wxGTKWindowImplDC( wxWindow *win );
|
||||
|
||||
|
||||
#if wxUSE_NEW_DC
|
||||
wxGTKWindowImplDC( wxDC *owner );
|
||||
wxGTKWindowImplDC( wxDC *owner, wxWindow *win );
|
||||
#else
|
||||
wxWindowDC();
|
||||
wxWindowDC( wxWindow *win );
|
||||
#endif
|
||||
|
||||
virtual ~wxGTKWindowImplDC();
|
||||
|
||||
@@ -115,9 +122,8 @@ public:
|
||||
GdkGC *m_textGC;
|
||||
GdkGC *m_bgGC;
|
||||
GdkColormap *m_cmap;
|
||||
bool m_isMemDC;
|
||||
bool m_isScreenDC;
|
||||
wxWindow *m_owner;
|
||||
wxWindow *m_owningWindow;
|
||||
wxRegion m_currentClippingRegion;
|
||||
wxRegion m_paintClippingRegion;
|
||||
|
||||
@@ -126,7 +132,7 @@ public:
|
||||
PangoLayout *m_layout;
|
||||
PangoFontDescription *m_fontdesc;
|
||||
|
||||
void SetUpDC();
|
||||
void SetUpDC( bool ismem = false );
|
||||
void Destroy();
|
||||
|
||||
virtual void ComputeScaleAndOrigin();
|
||||
@@ -134,7 +140,7 @@ public:
|
||||
virtual GdkWindow *GetGDKWindow() const { return m_window; }
|
||||
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS(wxGTKWindowImplDC)
|
||||
DECLARE_ABSTRACT_CLASS(wxGTKWindowImplDC)
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -149,14 +155,20 @@ class WXDLLIMPEXP_CORE wxClientDC : public wxWindowDC
|
||||
#endif
|
||||
{
|
||||
public:
|
||||
wxGTKClientImplDC() { }
|
||||
wxGTKClientImplDC( wxWindow *win );
|
||||
|
||||
#if wxUSE_NEW_DC
|
||||
wxGTKClientImplDC( wxDC *owner );
|
||||
wxGTKClientImplDC( wxDC *owner, wxWindow *win );
|
||||
#else
|
||||
wxClientDC();
|
||||
wxClientDC( wxWindow *win );
|
||||
#endif
|
||||
|
||||
protected:
|
||||
virtual void DoGetSize(int *width, int *height) const;
|
||||
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS(wxGTKClientImplDC)
|
||||
DECLARE_ABSTRACT_CLASS(wxGTKClientImplDC)
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -171,11 +183,17 @@ class WXDLLIMPEXP_CORE wxPaintDC : public wxClientDC
|
||||
#endif
|
||||
{
|
||||
public:
|
||||
wxGTKPaintImplDC() { }
|
||||
wxGTKPaintImplDC( wxWindow *win );
|
||||
|
||||
#if wxUSE_NEW_DC
|
||||
wxGTKPaintImplDC( wxDC *owner );
|
||||
wxGTKPaintImplDC( wxDC *owner, wxWindow *win );
|
||||
#else
|
||||
wxPaintDC();
|
||||
wxPaintDC( wxWindow *win );
|
||||
#endif
|
||||
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS(wxGTKPaintImplDC)
|
||||
DECLARE_ABSTRACT_CLASS(wxGTKPaintImplDC)
|
||||
};
|
||||
|
||||
#endif // __GTKDCCLIENTH__
|
||||
|
@@ -16,13 +16,27 @@
|
||||
// wxMemoryDC
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
||||
#if wxUSE_NEW_DC
|
||||
class WXDLLIMPEXP_CORE wxGTKMemoryImplDC : public wxGTKWindowImplDC, public wxMemoryImplDCBase
|
||||
#else
|
||||
#define wxGTKMemoryImplDC wxMemoryDC
|
||||
class WXDLLIMPEXP_CORE wxMemoryDC : public wxWindowDC, public wxMemoryDCBase
|
||||
#endif
|
||||
{
|
||||
public:
|
||||
wxMemoryDC() : wxWindowDC() { Init(); }
|
||||
wxMemoryDC(wxBitmap& bitmap) : wxWindowDC() { Init(); SelectObject(bitmap); }
|
||||
wxMemoryDC( wxDC *dc ); // Create compatible DC
|
||||
virtual ~wxMemoryDC();
|
||||
|
||||
#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();
|
||||
|
||||
// these get reimplemented for mono-bitmaps to behave
|
||||
// more like their Win32 couterparts. They now interpret
|
||||
@@ -36,21 +50,24 @@ public:
|
||||
|
||||
// implementation
|
||||
wxBitmap GetSelectedBitmap() const { return m_selected; }
|
||||
wxBitmap m_selected;
|
||||
|
||||
protected:
|
||||
void DoGetSize( int *width, int *height ) const;
|
||||
virtual void DoSelect(const wxBitmap& bitmap);
|
||||
virtual wxBitmap DoGetAsBitmap(const wxRect *subrect) const
|
||||
{
|
||||
wxBitmap bmp = GetSelectedBitmap();
|
||||
return subrect ? bmp.GetSubBitmap(*subrect) : bmp;
|
||||
}
|
||||
// overridden from wxImplDC
|
||||
virtual void DoGetSize( int *width, int *height ) const;
|
||||
virtual wxBitmap DoGetAsBitmap(const wxRect *subrect) const;
|
||||
|
||||
public:
|
||||
// overridden from wxMemoryImplDCBase
|
||||
virtual void DoSelect(const wxBitmap& bitmap);
|
||||
virtual const wxBitmap& DoGetSelectedBitmap() const;
|
||||
virtual wxBitmap& DoGetSelectedBitmap();
|
||||
|
||||
wxBitmap m_selected;
|
||||
|
||||
private:
|
||||
void Init();
|
||||
|
||||
DECLARE_DYNAMIC_CLASS(wxMemoryDC)
|
||||
DECLARE_ABSTRACT_CLASS(wxGTKMemoryImplDC)
|
||||
};
|
||||
|
||||
#endif // _WX_GTK_DCMEMORY_H_
|
||||
|
@@ -12,37 +12,39 @@
|
||||
|
||||
#include "wx/dcclient.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// classes
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_FWD_CORE wxScreenDC;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxScreenDC
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_CORE wxScreenDC : public wxPaintDC
|
||||
#if wxUSE_NEW_DC
|
||||
class WXDLLIMPEXP_CORE wxGTKScreenImplDC : public wxGTKWindowImplDC
|
||||
#else
|
||||
#define wxGTKScreenImplDC wxScreenDC
|
||||
class WXDLLIMPEXP_CORE wxScreenDC : public wxWindowDC
|
||||
#endif
|
||||
{
|
||||
public:
|
||||
|
||||
#if wxUSE_NEW_DC
|
||||
wxGTKScreenImplDC( wxScreenDC *owner );
|
||||
#else
|
||||
wxScreenDC();
|
||||
virtual ~wxScreenDC();
|
||||
#endif
|
||||
|
||||
static bool StartDrawingOnTop( wxWindow *window );
|
||||
static bool StartDrawingOnTop( wxRect *rect = (wxRect *) NULL );
|
||||
static bool EndDrawingOnTop();
|
||||
~wxGTKScreenImplDC();
|
||||
|
||||
// implementation
|
||||
static bool StartDrawingOnTop( wxWindow *window ) { return true; }
|
||||
static bool StartDrawingOnTop( wxRect *rect = (wxRect *) NULL ) { return true; }
|
||||
static bool EndDrawingOnTop() { return true; }
|
||||
|
||||
static GdkWindow *sm_overlayWindow;
|
||||
static int sm_overlayWindowX;
|
||||
static int sm_overlayWindowY;
|
||||
|
||||
protected:
|
||||
virtual void DoGetSize(int *width, int *height) const;
|
||||
|
||||
void Init();
|
||||
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS(wxScreenDC)
|
||||
DECLARE_ABSTRACT_CLASS(wxGTKScreenImplDC)
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user