]> git.saurik.com Git - wxWidgets.git/blob - include/wx/gtk/dcclient.h
[ 1823588 ] gtk filedlg - droping support for gtk 2.2
[wxWidgets.git] / include / wx / gtk / dcclient.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: dcclient.h
3 // Purpose:
4 // Author: Robert Roebling
5 // Id: $Id$
6 // Copyright: (c) 1998 Robert Roebling
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
9
10 #ifndef __GTKDCCLIENTH__
11 #define __GTKDCCLIENTH__
12
13 #include "wx/dc.h"
14 #include "wx/region.h"
15
16 class WXDLLIMPEXP_FWD_CORE wxWindow;
17
18 //-----------------------------------------------------------------------------
19 // wxWindowDC
20 //-----------------------------------------------------------------------------
21
22 #if wxUSE_NEW_DC
23 class WXDLLIMPEXP_CORE wxGTKWindowImplDC : public wxGTKImplDC
24 #else
25 #define wxGTKWindowImplDC wxWindowDC
26 class WXDLLIMPEXP_CORE wxWindowDC : public wxDC
27 #endif
28 {
29 public:
30
31
32 #if wxUSE_NEW_DC
33 wxGTKWindowImplDC( wxDC *owner );
34 wxGTKWindowImplDC( wxDC *owner, wxWindow *win );
35 #else
36 wxWindowDC();
37 wxWindowDC( wxWindow *win );
38 #endif
39
40 virtual ~wxGTKWindowImplDC();
41
42 virtual bool CanDrawBitmap() const { return true; }
43 virtual bool CanGetTextExtent() const { return true; }
44
45 protected:
46 virtual void DoGetSize(int *width, int *height) const;
47 virtual bool DoFloodFill( wxCoord x, wxCoord y, const wxColour& col, int style=wxFLOOD_SURFACE );
48 virtual bool DoGetPixel( wxCoord x1, wxCoord y1, wxColour *col ) const;
49
50 virtual void DoDrawLine( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2 );
51 virtual void DoCrossHair( wxCoord x, wxCoord y );
52 virtual void DoDrawArc( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2,
53 wxCoord xc, wxCoord yc );
54 virtual void DoDrawEllipticArc( wxCoord x, wxCoord y, wxCoord width, wxCoord height,
55 double sa, double ea );
56 virtual void DoDrawPoint( wxCoord x, wxCoord y );
57
58 virtual void DoDrawLines(int n, wxPoint points[],
59 wxCoord xoffset, wxCoord yoffset);
60 virtual void DoDrawPolygon(int n, wxPoint points[],
61 wxCoord xoffset, wxCoord yoffset,
62 int fillStyle = wxODDEVEN_RULE);
63
64 virtual void DoDrawRectangle( wxCoord x, wxCoord y, wxCoord width, wxCoord height );
65 virtual void DoDrawRoundedRectangle( wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius = 20.0 );
66 virtual void DoDrawEllipse( wxCoord x, wxCoord y, wxCoord width, wxCoord height );
67
68 virtual void DoDrawIcon( const wxIcon &icon, wxCoord x, wxCoord y );
69 virtual void DoDrawBitmap( const wxBitmap &bitmap, wxCoord x, wxCoord y,
70 bool useMask = false );
71
72 virtual bool DoBlit( wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
73 wxDC *source, wxCoord xsrc, wxCoord ysrc,
74 int logical_func = wxCOPY, bool useMask = false, wxCoord xsrcMask = -1, wxCoord ysrcMask = -1 );
75
76 virtual void DoDrawText( const wxString &text, wxCoord x, wxCoord y );
77 virtual void DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y,
78 double angle);
79 virtual void DoGetTextExtent( const wxString &string,
80 wxCoord *width, wxCoord *height,
81 wxCoord *descent = (wxCoord *) NULL,
82 wxCoord *externalLeading = (wxCoord *) NULL,
83 const wxFont *theFont = (wxFont *) NULL) const;
84 virtual bool DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths) const;
85 virtual void DoSetClippingRegion( wxCoord x, wxCoord y, wxCoord width, wxCoord height );
86 virtual void DoSetClippingRegionAsRegion( const wxRegion &region );
87
88
89 public:
90 virtual wxCoord GetCharWidth() const;
91 virtual wxCoord GetCharHeight() const;
92
93 virtual void Clear();
94
95 virtual void SetFont( const wxFont &font );
96 virtual void SetPen( const wxPen &pen );
97 virtual void SetBrush( const wxBrush &brush );
98 virtual void SetBackground( const wxBrush &brush );
99 virtual void SetLogicalFunction( int function );
100 virtual void SetTextForeground( const wxColour &col );
101 virtual void SetTextBackground( const wxColour &col );
102 virtual void SetBackgroundMode( int mode );
103 virtual void SetPalette( const wxPalette& palette );
104
105 virtual void DestroyClippingRegion();
106
107 // Resolution in pixels per logical inch
108 virtual wxSize GetPPI() const;
109 virtual int GetDepth() const;
110
111 // overrriden here for RTL
112 virtual void SetDeviceOrigin( wxCoord x, wxCoord y );
113 virtual void SetAxisOrientation( bool xLeftRight, bool yBottomUp );
114
115 // protected:
116 // implementation
117 // --------------
118
119 GdkWindow *m_window;
120 GdkGC *m_penGC;
121 GdkGC *m_brushGC;
122 GdkGC *m_textGC;
123 GdkGC *m_bgGC;
124 GdkColormap *m_cmap;
125 bool m_isScreenDC;
126 wxWindow *m_owningWindow;
127 wxRegion m_currentClippingRegion;
128 wxRegion m_paintClippingRegion;
129
130 // PangoContext stuff for GTK 2.0
131 PangoContext *m_context;
132 PangoLayout *m_layout;
133 PangoFontDescription *m_fontdesc;
134
135 void SetUpDC( bool ismem = false );
136 void Destroy();
137
138 virtual void ComputeScaleAndOrigin();
139
140 virtual GdkWindow *GetGDKWindow() const { return m_window; }
141
142 private:
143 DECLARE_ABSTRACT_CLASS(wxGTKWindowImplDC)
144 };
145
146 //-----------------------------------------------------------------------------
147 // wxClientDC
148 //-----------------------------------------------------------------------------
149
150 #if wxUSE_NEW_DC
151 class WXDLLIMPEXP_CORE wxGTKClientImplDC : public wxGTKWindowImplDC
152 #else
153 #define wxGTKClientImplDC wxClientDC
154 class WXDLLIMPEXP_CORE wxClientDC : public wxWindowDC
155 #endif
156 {
157 public:
158
159 #if wxUSE_NEW_DC
160 wxGTKClientImplDC( wxDC *owner );
161 wxGTKClientImplDC( wxDC *owner, wxWindow *win );
162 #else
163 wxClientDC();
164 wxClientDC( wxWindow *win );
165 #endif
166
167 protected:
168 virtual void DoGetSize(int *width, int *height) const;
169
170 private:
171 DECLARE_ABSTRACT_CLASS(wxGTKClientImplDC)
172 };
173
174 //-----------------------------------------------------------------------------
175 // wxPaintDC
176 //-----------------------------------------------------------------------------
177
178 #if wxUSE_NEW_DC
179 class WXDLLIMPEXP_CORE wxGTKPaintImplDC : public wxGTKClientImplDC
180 #else
181 #define wxGTKPaintImplDC wxPaintDC
182 class WXDLLIMPEXP_CORE wxPaintDC : public wxClientDC
183 #endif
184 {
185 public:
186
187 #if wxUSE_NEW_DC
188 wxGTKPaintImplDC( wxDC *owner );
189 wxGTKPaintImplDC( wxDC *owner, wxWindow *win );
190 #else
191 wxPaintDC();
192 wxPaintDC( wxWindow *win );
193 #endif
194
195 private:
196 DECLARE_ABSTRACT_CLASS(wxGTKPaintImplDC)
197 };
198
199 #endif // __GTKDCCLIENTH__