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