]> git.saurik.com Git - wxWidgets.git/blob - include/wx/gtk/dc.h
aa97ecb326658bfb825d55d5dbe4470f5f9ea2ee
[wxWidgets.git] / include / wx / gtk / dc.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/gtk/dc.h
3 // Purpose:
4 // Author: Robert Roebling
5 // Id: $Id$
6 // Copyright: (c) 1998 Robert Roebling
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
9
10 #ifndef _WX_GTKDC_H_
11 #define _WX_GTKDC_H_
12
13 #ifdef __WXGTK3__
14
15 #include "wx/dcgraph.h"
16
17 class wxGTKCairoDCImpl: public wxGCDCImpl
18 {
19 typedef wxGCDCImpl base_type;
20 public:
21 wxGTKCairoDCImpl(wxDC* owner);
22 wxGTKCairoDCImpl(wxDC* owner, int);
23 wxGTKCairoDCImpl(wxDC* owner, wxWindow* window);
24
25 virtual void DoDrawBitmap(const wxBitmap& bitmap, int x, int y, bool useMask);
26 virtual void DoDrawIcon(const wxIcon& icon, int x, int y);
27 #if wxUSE_IMAGE
28 virtual bool DoFloodFill(int x, int y, const wxColour& col, wxFloodFillStyle style);
29 #endif
30 virtual wxBitmap DoGetAsBitmap(const wxRect* subrect) const;
31 virtual bool DoGetPixel(int x, int y, wxColour* col) const;
32 virtual void DoGetSize(int* width, int* height) const;
33 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);
34 virtual void* GetCairoContext() const;
35
36 protected:
37 int m_width, m_height;
38
39 wxDECLARE_NO_COPY_CLASS(wxGTKCairoDCImpl);
40 };
41 //-----------------------------------------------------------------------------
42
43 class wxWindowDCImpl: public wxGTKCairoDCImpl
44 {
45 typedef wxGTKCairoDCImpl base_type;
46 public:
47 wxWindowDCImpl(wxWindowDC* owner, wxWindow* window);
48
49 wxDECLARE_NO_COPY_CLASS(wxWindowDCImpl);
50 };
51 //-----------------------------------------------------------------------------
52
53 class wxClientDCImpl: public wxGTKCairoDCImpl
54 {
55 typedef wxGTKCairoDCImpl base_type;
56 public:
57 wxClientDCImpl(wxClientDC* owner, wxWindow* window);
58
59 wxDECLARE_NO_COPY_CLASS(wxClientDCImpl);
60 };
61 //-----------------------------------------------------------------------------
62
63 class wxPaintDCImpl: public wxGTKCairoDCImpl
64 {
65 typedef wxGTKCairoDCImpl base_type;
66 public:
67 wxPaintDCImpl(wxPaintDC* owner, wxWindow* window);
68
69 wxDECLARE_NO_COPY_CLASS(wxPaintDCImpl);
70 };
71 //-----------------------------------------------------------------------------
72
73 class wxScreenDCImpl: public wxGTKCairoDCImpl
74 {
75 typedef wxGTKCairoDCImpl base_type;
76 public:
77 wxScreenDCImpl(wxScreenDC* owner);
78
79 wxDECLARE_NO_COPY_CLASS(wxScreenDCImpl);
80 };
81 //-----------------------------------------------------------------------------
82
83 class wxMemoryDCImpl: public wxGTKCairoDCImpl
84 {
85 typedef wxGTKCairoDCImpl base_type;
86 public:
87 wxMemoryDCImpl(wxMemoryDC* owner);
88 wxMemoryDCImpl(wxMemoryDC* owner, wxBitmap& bitmap);
89 wxMemoryDCImpl(wxMemoryDC* owner, wxDC* dc);
90 virtual wxBitmap DoGetAsBitmap(const wxRect* subrect) const;
91 virtual void DoSelect(const wxBitmap& bitmap);
92 virtual const wxBitmap& GetSelectedBitmap() const;
93 virtual wxBitmap& GetSelectedBitmap();
94
95 private:
96 void Setup();
97 wxBitmap m_bitmap;
98
99 wxDECLARE_NO_COPY_CLASS(wxMemoryDCImpl);
100 };
101 //-----------------------------------------------------------------------------
102
103 class WXDLLIMPEXP_CORE wxGTKCairoDC: public wxDC
104 {
105 typedef wxDC base_type;
106 public:
107 wxGTKCairoDC(cairo_t* cr);
108
109 wxDECLARE_NO_COPY_CLASS(wxGTKCairoDC);
110 };
111
112 #else
113
114 #include "wx/dc.h"
115
116 //-----------------------------------------------------------------------------
117 // wxDC
118 //-----------------------------------------------------------------------------
119
120 class WXDLLIMPEXP_CORE wxGTKDCImpl : public wxDCImpl
121 {
122 public:
123 wxGTKDCImpl( wxDC *owner );
124 virtual ~wxGTKDCImpl();
125
126 #if wxUSE_PALETTE
127 void SetColourMap( const wxPalette& palette ) { SetPalette(palette); }
128 #endif // wxUSE_PALETTE
129
130 // Resolution in pixels per logical inch
131 virtual wxSize GetPPI() const;
132
133 virtual bool StartDoc( const wxString& WXUNUSED(message) ) { return true; }
134 virtual void EndDoc() { }
135 virtual void StartPage() { }
136 virtual void EndPage() { }
137
138 virtual GdkWindow* GetGDKWindow() const { return NULL; }
139
140 // base class pure virtuals implemented here
141 virtual void DoSetClippingRegion(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
142 virtual void DoGetSizeMM(int* width, int* height) const;
143
144 DECLARE_ABSTRACT_CLASS(wxGTKDCImpl)
145 };
146
147 // this must be defined when wxDC::Blit() honours the DC origin and needed to
148 // allow wxUniv code in univ/winuniv.cpp to work with versions of wxGTK
149 // 2.3.[23]
150 #ifndef wxHAS_WORKING_GTK_DC_BLIT
151 #define wxHAS_WORKING_GTK_DC_BLIT
152 #endif
153
154 #endif
155 #endif // _WX_GTKDC_H_