1998-05-20 10:01:55 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
2005-11-30 02:58:37 -05:00
|
|
|
// Name: wx/gtk/dc.h
|
1998-05-20 10:01:55 -04:00
|
|
|
// Purpose:
|
|
|
|
// Author: Robert Roebling
|
1998-10-26 05:56:58 -05:00
|
|
|
// Copyright: (c) 1998 Robert Roebling
|
2004-05-23 16:53:33 -04:00
|
|
|
// Licence: wxWindows licence
|
1998-05-20 10:01:55 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2007-12-01 13:37:08 -05:00
|
|
|
#ifndef _WX_GTKDC_H_
|
|
|
|
#define _WX_GTKDC_H_
|
1998-05-20 10:01:55 -04:00
|
|
|
|
2012-06-30 16:39:06 -04:00
|
|
|
#ifdef __WXGTK3__
|
|
|
|
|
|
|
|
#include "wx/dcgraph.h"
|
|
|
|
|
|
|
|
class wxGTKCairoDCImpl: public wxGCDCImpl
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
wxGTKCairoDCImpl(wxDC* owner);
|
2016-02-22 12:52:26 -05:00
|
|
|
wxGTKCairoDCImpl(wxDC* owner, double scaleFactor);
|
2012-06-30 16:39:06 -04:00
|
|
|
wxGTKCairoDCImpl(wxDC* owner, wxWindow* window);
|
2012-07-13 12:58:37 -04:00
|
|
|
|
2014-03-29 20:02:23 -04:00
|
|
|
virtual void DoDrawBitmap(const wxBitmap& bitmap, int x, int y, bool useMask) wxOVERRIDE;
|
|
|
|
virtual void DoDrawIcon(const wxIcon& icon, int x, int y) wxOVERRIDE;
|
2012-06-30 16:39:06 -04:00
|
|
|
#if wxUSE_IMAGE
|
2014-03-29 20:02:23 -04:00
|
|
|
virtual bool DoFloodFill(int x, int y, const wxColour& col, wxFloodFillStyle style) wxOVERRIDE;
|
2012-06-30 16:39:06 -04:00
|
|
|
#endif
|
2014-03-29 20:02:23 -04:00
|
|
|
virtual wxBitmap DoGetAsBitmap(const wxRect* subrect) const wxOVERRIDE;
|
|
|
|
virtual bool DoGetPixel(int x, int y, wxColour* col) const wxOVERRIDE;
|
|
|
|
virtual void DoGetSize(int* width, int* height) const wxOVERRIDE;
|
|
|
|
virtual bool DoStretchBlit(int xdest, int ydest, int dstWidth, int dstHeight, wxDC* source, int xsrc, int ysrc, int srcWidth, int srcHeight, wxRasterOperationMode rop, bool useMask, int xsrcMask, int ysrcMask) wxOVERRIDE;
|
|
|
|
virtual void* GetCairoContext() const wxOVERRIDE;
|
2012-06-30 16:39:06 -04:00
|
|
|
|
2018-01-20 08:58:08 -05:00
|
|
|
virtual wxSize GetPPI() const wxOVERRIDE;
|
|
|
|
|
2012-06-30 16:39:06 -04:00
|
|
|
protected:
|
2018-01-25 08:52:29 -05:00
|
|
|
// Set m_size from the given (valid) GdkWindow.
|
2018-01-25 08:40:10 -05:00
|
|
|
void InitSize(GdkWindow* window);
|
2012-06-30 16:39:06 -04:00
|
|
|
|
2018-01-25 08:52:29 -05:00
|
|
|
wxSize m_size;
|
2018-01-20 08:58:08 -05:00
|
|
|
|
2012-06-30 16:39:06 -04:00
|
|
|
wxDECLARE_NO_COPY_CLASS(wxGTKCairoDCImpl);
|
|
|
|
};
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
class wxWindowDCImpl: public wxGTKCairoDCImpl
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
wxWindowDCImpl(wxWindowDC* owner, wxWindow* window);
|
|
|
|
|
|
|
|
wxDECLARE_NO_COPY_CLASS(wxWindowDCImpl);
|
|
|
|
};
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
class wxClientDCImpl: public wxGTKCairoDCImpl
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
wxClientDCImpl(wxClientDC* owner, wxWindow* window);
|
|
|
|
|
|
|
|
wxDECLARE_NO_COPY_CLASS(wxClientDCImpl);
|
|
|
|
};
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
class wxPaintDCImpl: public wxGTKCairoDCImpl
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
wxPaintDCImpl(wxPaintDC* owner, wxWindow* window);
|
|
|
|
|
|
|
|
wxDECLARE_NO_COPY_CLASS(wxPaintDCImpl);
|
|
|
|
};
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
class wxScreenDCImpl: public wxGTKCairoDCImpl
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
wxScreenDCImpl(wxScreenDC* owner);
|
|
|
|
|
2018-01-25 08:55:31 -05:00
|
|
|
virtual wxSize GetPPI() const wxOVERRIDE;
|
|
|
|
|
2012-06-30 16:39:06 -04:00
|
|
|
wxDECLARE_NO_COPY_CLASS(wxScreenDCImpl);
|
|
|
|
};
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
class wxMemoryDCImpl: public wxGTKCairoDCImpl
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
wxMemoryDCImpl(wxMemoryDC* owner);
|
|
|
|
wxMemoryDCImpl(wxMemoryDC* owner, wxBitmap& bitmap);
|
|
|
|
wxMemoryDCImpl(wxMemoryDC* owner, wxDC* dc);
|
2014-03-29 20:02:23 -04:00
|
|
|
virtual wxBitmap DoGetAsBitmap(const wxRect* subrect) const wxOVERRIDE;
|
|
|
|
virtual void DoSelect(const wxBitmap& bitmap) wxOVERRIDE;
|
|
|
|
virtual const wxBitmap& GetSelectedBitmap() const wxOVERRIDE;
|
|
|
|
virtual wxBitmap& GetSelectedBitmap() wxOVERRIDE;
|
2012-06-30 16:39:06 -04:00
|
|
|
|
|
|
|
private:
|
|
|
|
void Setup();
|
|
|
|
wxBitmap m_bitmap;
|
|
|
|
|
|
|
|
wxDECLARE_NO_COPY_CLASS(wxMemoryDCImpl);
|
|
|
|
};
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
class WXDLLIMPEXP_CORE wxGTKCairoDC: public wxDC
|
|
|
|
{
|
|
|
|
public:
|
2016-02-22 12:52:26 -05:00
|
|
|
wxGTKCairoDC(cairo_t* cr, wxWindow* window);
|
2012-06-30 16:39:06 -04:00
|
|
|
|
|
|
|
wxDECLARE_NO_COPY_CLASS(wxGTKCairoDC);
|
|
|
|
};
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
2007-12-01 13:37:08 -05:00
|
|
|
#include "wx/dc.h"
|
2007-05-06 16:14:55 -04:00
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
2007-05-08 19:47:43 -04:00
|
|
|
// wxDC
|
2007-05-03 18:29:01 -04:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2007-11-30 08:48:22 -05:00
|
|
|
class WXDLLIMPEXP_CORE wxGTKDCImpl : public wxDCImpl
|
1998-05-20 10:01:55 -04:00
|
|
|
{
|
1998-12-03 10:14:45 -05:00
|
|
|
public:
|
2007-11-30 08:48:22 -05:00
|
|
|
wxGTKDCImpl( wxDC *owner );
|
|
|
|
virtual ~wxGTKDCImpl();
|
1998-05-20 10:01:55 -04:00
|
|
|
|
2005-11-30 02:58:37 -05:00
|
|
|
#if wxUSE_PALETTE
|
2011-12-29 09:42:13 -05:00
|
|
|
void SetColourMap( const wxPalette& palette ) { SetPalette(palette); }
|
2005-11-30 02:58:37 -05:00
|
|
|
#endif // wxUSE_PALETTE
|
1998-12-09 12:30:17 -05:00
|
|
|
|
1999-05-13 17:21:04 -04:00
|
|
|
// Resolution in pixels per logical inch
|
2014-03-29 20:02:23 -04:00
|
|
|
virtual wxSize GetPPI() const wxOVERRIDE;
|
1998-05-20 10:01:55 -04:00
|
|
|
|
2014-03-29 20:02:23 -04:00
|
|
|
virtual bool StartDoc( const wxString& WXUNUSED(message) ) wxOVERRIDE { return true; }
|
|
|
|
virtual void EndDoc() wxOVERRIDE { }
|
|
|
|
virtual void StartPage() wxOVERRIDE { }
|
|
|
|
virtual void EndPage() wxOVERRIDE { }
|
1998-12-09 12:30:17 -05:00
|
|
|
|
2006-10-09 12:39:34 -04:00
|
|
|
virtual GdkWindow* GetGDKWindow() const { return NULL; }
|
2014-03-29 20:02:23 -04:00
|
|
|
virtual void* GetHandle() const wxOVERRIDE { return GetGDKWindow(); }
|
2012-07-28 15:31:18 -04:00
|
|
|
|
1999-05-13 17:21:04 -04:00
|
|
|
// base class pure virtuals implemented here
|
2014-03-29 20:02:23 -04:00
|
|
|
virtual void DoSetClippingRegion(wxCoord x, wxCoord y, wxCoord width, wxCoord height) wxOVERRIDE;
|
|
|
|
virtual void DoGetSizeMM(int* width, int* height) const wxOVERRIDE;
|
1998-12-09 12:30:17 -05:00
|
|
|
|
2015-04-23 07:49:01 -04:00
|
|
|
wxDECLARE_ABSTRACT_CLASS(wxGTKDCImpl);
|
1998-05-20 10:01:55 -04:00
|
|
|
};
|
|
|
|
|
2007-11-30 08:48:22 -05:00
|
|
|
// this must be defined when wxDC::Blit() honours the DC origin and needed to
|
2002-02-10 11:09:49 -05:00
|
|
|
// allow wxUniv code in univ/winuniv.cpp to work with versions of wxGTK
|
|
|
|
// 2.3.[23]
|
|
|
|
#ifndef wxHAS_WORKING_GTK_DC_BLIT
|
|
|
|
#define wxHAS_WORKING_GTK_DC_BLIT
|
|
|
|
#endif
|
|
|
|
|
2012-06-30 16:39:06 -04:00
|
|
|
#endif
|
2007-12-01 13:37:08 -05:00
|
|
|
#endif // _WX_GTKDC_H_
|