]>
Commit | Line | Data |
---|---|---|
c801d85f KB |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: dcclient.h | |
3 | // Purpose: | |
4 | // Author: Robert Roebling | |
dbf858b5 RR |
5 | // Id: $Id$ |
6 | // Copyright: (c) 1998 Robert Roebling | |
65571936 | 7 | // Licence: wxWindows licence |
c801d85f KB |
8 | ///////////////////////////////////////////////////////////////////////////// |
9 | ||
c801d85f KB |
10 | #ifndef __GTKDCCLIENTH__ |
11 | #define __GTKDCCLIENTH__ | |
12 | ||
c801d85f | 13 | #include "wx/dc.h" |
772b3767 | 14 | #include "wx/region.h" |
c801d85f | 15 | |
b5dbe15d | 16 | class WXDLLIMPEXP_FWD_CORE wxWindow; |
c801d85f KB |
17 | |
18 | //----------------------------------------------------------------------------- | |
ec758a20 | 19 | // wxWindowDC |
c801d85f KB |
20 | //----------------------------------------------------------------------------- |
21 | ||
2970ae54 RR |
22 | #if wxUSE_NEW_DC |
23 | class WXDLLIMPEXP_CORE wxGTKWindowImplDC : public wxGTKImplDC | |
24 | #else | |
25 | #define wxGTKWindowImplDC wxWindowDC | |
20123d49 | 26 | class WXDLLIMPEXP_CORE wxWindowDC : public wxDC |
2970ae54 | 27 | #endif |
c801d85f | 28 | { |
ec758a20 | 29 | public: |
ab171e95 RR |
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 | |
b0e0d661 | 39 | |
2970ae54 | 40 | virtual ~wxGTKWindowImplDC(); |
b0e0d661 | 41 | |
b1263dcf WS |
42 | virtual bool CanDrawBitmap() const { return true; } |
43 | virtual bool CanGetTextExtent() const { return true; } | |
b0e0d661 | 44 | |
376aa62a VZ |
45 | protected: |
46 | virtual void DoGetSize(int *width, int *height) const; | |
387ebd3e | 47 | virtual bool DoFloodFill( wxCoord x, wxCoord y, const wxColour& col, int style=wxFLOOD_SURFACE ); |
72cdf4c9 VZ |
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, | |
b0e0d661 | 55 | double sa, double ea ); |
72cdf4c9 | 56 | virtual void DoDrawPoint( wxCoord x, wxCoord y ); |
b0e0d661 VZ |
57 | |
58 | virtual void DoDrawLines(int n, wxPoint points[], | |
72cdf4c9 | 59 | wxCoord xoffset, wxCoord yoffset); |
b0e0d661 | 60 | virtual void DoDrawPolygon(int n, wxPoint points[], |
72cdf4c9 | 61 | wxCoord xoffset, wxCoord yoffset, |
b0e0d661 VZ |
62 | int fillStyle = wxODDEVEN_RULE); |
63 | ||
72cdf4c9 VZ |
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 ); | |
b0e0d661 | 67 | |
72cdf4c9 VZ |
68 | virtual void DoDrawIcon( const wxIcon &icon, wxCoord x, wxCoord y ); |
69 | virtual void DoDrawBitmap( const wxBitmap &bitmap, wxCoord x, wxCoord y, | |
b1263dcf | 70 | bool useMask = false ); |
b0e0d661 | 71 | |
72cdf4c9 VZ |
72 | virtual bool DoBlit( wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height, |
73 | wxDC *source, wxCoord xsrc, wxCoord ysrc, | |
b1263dcf | 74 | int logical_func = wxCOPY, bool useMask = false, wxCoord xsrcMask = -1, wxCoord ysrcMask = -1 ); |
b0e0d661 | 75 | |
72cdf4c9 | 76 | virtual void DoDrawText( const wxString &text, wxCoord x, wxCoord y ); |
95724b1a VZ |
77 | virtual void DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y, |
78 | double angle); | |
72cdf4c9 VZ |
79 | virtual void DoGetTextExtent( const wxString &string, |
80 | wxCoord *width, wxCoord *height, | |
81 | wxCoord *descent = (wxCoord *) NULL, | |
82 | wxCoord *externalLeading = (wxCoord *) NULL, | |
c94f845b | 83 | const wxFont *theFont = (wxFont *) NULL) const; |
1f91072f | 84 | virtual bool DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths) const; |
6f02a879 VZ |
85 | virtual void DoSetClippingRegion( wxCoord x, wxCoord y, wxCoord width, wxCoord height ); |
86 | virtual void DoSetClippingRegionAsRegion( const wxRegion ®ion ); | |
376aa62a | 87 | |
847dfdb4 | 88 | |
376aa62a | 89 | public: |
72cdf4c9 VZ |
90 | virtual wxCoord GetCharWidth() const; |
91 | virtual wxCoord GetCharHeight() const; | |
b0e0d661 VZ |
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 | ||
b0e0d661 | 105 | virtual void DestroyClippingRegion(); |
b0e0d661 | 106 | |
b0e0d661 VZ |
107 | // Resolution in pixels per logical inch |
108 | virtual wxSize GetPPI() const; | |
109 | virtual int GetDepth() const; | |
110 | ||
847dfdb4 RR |
111 | // overrriden here for RTL |
112 | virtual void SetDeviceOrigin( wxCoord x, wxCoord y ); | |
113 | virtual void SetAxisOrientation( bool xLeftRight, bool yBottomUp ); | |
114 | ||
f6f1f4ad | 115 | // protected: |
b0e0d661 VZ |
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; | |
e1208c31 | 125 | bool m_isScreenDC; |
ab171e95 | 126 | wxWindow *m_owningWindow; |
3d2d8da1 RR |
127 | wxRegion m_currentClippingRegion; |
128 | wxRegion m_paintClippingRegion; | |
b1263dcf | 129 | |
2b5f62a0 | 130 | // PangoContext stuff for GTK 2.0 |
8943b403 | 131 | PangoContext *m_context; |
138618ac | 132 | PangoLayout *m_layout; |
8943b403 | 133 | PangoFontDescription *m_fontdesc; |
b0e0d661 | 134 | |
ab171e95 | 135 | void SetUpDC( bool ismem = false ); |
b0e0d661 | 136 | void Destroy(); |
f6f1f4ad | 137 | |
b1263dcf | 138 | virtual void ComputeScaleAndOrigin(); |
238d735d | 139 | |
eda276b0 | 140 | virtual GdkWindow *GetGDKWindow() const { return m_window; } |
cd9da200 | 141 | |
20e05ffb | 142 | private: |
ab171e95 | 143 | DECLARE_ABSTRACT_CLASS(wxGTKWindowImplDC) |
ec758a20 RR |
144 | }; |
145 | ||
146 | //----------------------------------------------------------------------------- | |
376aa62a | 147 | // wxClientDC |
ec758a20 RR |
148 | //----------------------------------------------------------------------------- |
149 | ||
2970ae54 RR |
150 | #if wxUSE_NEW_DC |
151 | class WXDLLIMPEXP_CORE wxGTKClientImplDC : public wxGTKWindowImplDC | |
152 | #else | |
153 | #define wxGTKClientImplDC wxClientDC | |
20123d49 | 154 | class WXDLLIMPEXP_CORE wxClientDC : public wxWindowDC |
2970ae54 | 155 | #endif |
ec758a20 | 156 | { |
ec758a20 | 157 | public: |
ab171e95 RR |
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 | |
cd9da200 | 166 | |
7b30ac82 VZ |
167 | protected: |
168 | virtual void DoGetSize(int *width, int *height) const; | |
169 | ||
20e05ffb | 170 | private: |
ab171e95 | 171 | DECLARE_ABSTRACT_CLASS(wxGTKClientImplDC) |
c801d85f KB |
172 | }; |
173 | ||
ec758a20 | 174 | //----------------------------------------------------------------------------- |
376aa62a | 175 | // wxPaintDC |
ec758a20 RR |
176 | //----------------------------------------------------------------------------- |
177 | ||
2970ae54 RR |
178 | #if wxUSE_NEW_DC |
179 | class WXDLLIMPEXP_CORE wxGTKPaintImplDC : public wxGTKClientImplDC | |
180 | #else | |
181 | #define wxGTKPaintImplDC wxPaintDC | |
20123d49 | 182 | class WXDLLIMPEXP_CORE wxPaintDC : public wxClientDC |
2970ae54 | 183 | #endif |
ec758a20 | 184 | { |
ec758a20 | 185 | public: |
ab171e95 RR |
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 | |
cd9da200 | 194 | |
20e05ffb | 195 | private: |
ab171e95 | 196 | DECLARE_ABSTRACT_CLASS(wxGTKPaintImplDC) |
ec758a20 RR |
197 | }; |
198 | ||
c801d85f | 199 | #endif // __GTKDCCLIENTH__ |