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