]>
Commit | Line | Data |
---|---|---|
83df96d6 JS |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: dcclient.h | |
3 | // Purpose: wxClientDC, wxPaintDC and wxWindowDC classes | |
4 | // Author: Julian Smart | |
5 | // Modified by: | |
6 | // Created: 17/09/98 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) Julian Smart | |
65571936 | 9 | // Licence: wxWindows licence |
83df96d6 JS |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
12 | #ifndef _WX_DCCLIENT_H_ | |
13 | #define _WX_DCCLIENT_H_ | |
14 | ||
83df96d6 | 15 | #include "wx/dc.h" |
2b77c3fc RR |
16 | #include "wx/dcclient.h" |
17 | #include "wx/x11/dc.h" | |
3cd0b8c5 | 18 | #include "wx/region.h" |
83df96d6 JS |
19 | |
20 | // ----------------------------------------------------------------------------- | |
21 | // fwd declarations | |
22 | // ----------------------------------------------------------------------------- | |
23 | ||
b5dbe15d | 24 | class WXDLLIMPEXP_FWD_CORE wxWindow; |
83df96d6 | 25 | |
83df96d6 | 26 | //----------------------------------------------------------------------------- |
2b77c3fc | 27 | // wxWindowDCImpl |
83df96d6 JS |
28 | //----------------------------------------------------------------------------- |
29 | ||
2b77c3fc | 30 | class WXDLLIMPEXP_CORE wxWindowDCImpl : public wxX11DCImpl |
83df96d6 | 31 | { |
83df96d6 | 32 | public: |
2b77c3fc RR |
33 | wxWindowDCImpl( wxDC *owner ); |
34 | wxWindowDCImpl( wxDC *owner, wxWindow *win ); | |
03647350 | 35 | |
2b77c3fc | 36 | virtual ~wxWindowDCImpl(); |
b1263dcf WS |
37 | |
38 | virtual bool CanDrawBitmap() const { return true; } | |
39 | virtual bool CanGetTextExtent() const { return true; } | |
3cd0b8c5 | 40 | |
83df96d6 | 41 | protected: |
3cd0b8c5 | 42 | virtual void DoGetSize(int *width, int *height) const; |
03647350 | 43 | virtual bool DoFloodFill( wxCoord x, wxCoord y, const wxColour& col, |
89efaf2b | 44 | wxFloodFillStyle style = wxFLOOD_SURFACE ); |
3cd0b8c5 | 45 | virtual bool DoGetPixel( wxCoord x, wxCoord y, wxColour *col ) const; |
b1263dcf | 46 | |
83df96d6 JS |
47 | virtual void DoDrawPoint(wxCoord x, wxCoord y); |
48 | virtual void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2); | |
b1263dcf | 49 | |
3cd0b8c5 RR |
50 | virtual void DoDrawIcon( const wxIcon &icon, wxCoord x, wxCoord y ); |
51 | virtual void DoDrawBitmap( const wxBitmap &bitmap, wxCoord x, wxCoord y, | |
b1263dcf | 52 | bool useMask = false ); |
3cd0b8c5 | 53 | |
83df96d6 JS |
54 | virtual void DoDrawArc(wxCoord x1, wxCoord y1, |
55 | wxCoord x2, wxCoord y2, | |
56 | wxCoord xc, wxCoord yc); | |
57 | virtual void DoDrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h, | |
58 | double sa, double ea); | |
b1263dcf | 59 | |
83df96d6 JS |
60 | virtual void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height); |
61 | virtual void DoDrawRoundedRectangle(wxCoord x, wxCoord y, | |
62 | wxCoord width, wxCoord height, | |
63 | double radius); | |
64 | virtual void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height); | |
b1263dcf | 65 | |
83df96d6 | 66 | virtual void DoCrossHair(wxCoord x, wxCoord y); |
b1263dcf | 67 | |
83df96d6 JS |
68 | virtual void DoDrawText(const wxString& text, wxCoord x, wxCoord y); |
69 | virtual void DoDrawRotatedText(const wxString &text, wxCoord x, wxCoord y, double angle); | |
b1263dcf | 70 | |
83df96d6 JS |
71 | virtual bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height, |
72 | wxDC *source, wxCoord xsrc, wxCoord ysrc, | |
03647350 | 73 | wxRasterOperationMode rop = wxCOPY, bool useMask = false, |
89efaf2b | 74 | wxCoord xsrcMask = -1, wxCoord ysrcMask = -1); |
b1263dcf | 75 | |
83df96d6 JS |
76 | virtual void DoSetClippingRegion(wxCoord x, wxCoord y, |
77 | wxCoord width, wxCoord height); | |
fdaad94e | 78 | virtual void DoSetDeviceClippingRegion(const wxRegion& region); |
b1263dcf | 79 | |
83df96d6 JS |
80 | virtual void DoDrawLines(int n, wxPoint points[], |
81 | wxCoord xoffset, wxCoord yoffset); | |
82 | virtual void DoDrawPolygon(int n, wxPoint points[], | |
83 | wxCoord xoffset, wxCoord yoffset, | |
89efaf2b | 84 | wxPolygonFillMode fillStyle = wxODDEVEN_RULE); |
3cd0b8c5 RR |
85 | |
86 | ||
87 | public: | |
88 | virtual void Clear(); | |
b1263dcf | 89 | |
3cd0b8c5 RR |
90 | virtual void SetFont(const wxFont& font); |
91 | virtual void SetPen(const wxPen& pen); | |
92 | virtual void SetBrush(const wxBrush& brush); | |
93 | virtual void SetBackground(const wxBrush& brush); | |
94 | virtual void SetBackgroundMode(int mode); | |
95 | virtual void SetPalette(const wxPalette& palette); | |
89efaf2b | 96 | virtual void SetLogicalFunction( wxRasterOperationMode function ); |
b1263dcf | 97 | |
3cd0b8c5 RR |
98 | virtual void SetTextForeground(const wxColour& colour); |
99 | virtual void SetTextBackground(const wxColour& colour); | |
b1263dcf | 100 | |
3cd0b8c5 RR |
101 | virtual wxCoord GetCharHeight() const; |
102 | virtual wxCoord GetCharWidth() const; | |
b1263dcf | 103 | |
3cd0b8c5 RR |
104 | virtual int GetDepth() const; |
105 | virtual wxSize GetPPI() const; | |
b1263dcf | 106 | |
3cd0b8c5 | 107 | virtual void DestroyClippingRegion(); |
73f46291 | 108 | WXWindow GetX11Window() const { return m_x11window; } |
3cd0b8c5 | 109 | |
6f02a879 VZ |
110 | virtual void ComputeScaleAndOrigin(); |
111 | ||
b1263dcf | 112 | protected: |
3cd0b8c5 RR |
113 | // implementation |
114 | // -------------- | |
6f02a879 VZ |
115 | virtual void DoGetTextExtent(const wxString& string, |
116 | wxCoord *x, wxCoord *y, | |
117 | wxCoord *descent = NULL, | |
118 | wxCoord *externalLeading = NULL, | |
c94f845b | 119 | const wxFont *theFont = NULL) const; |
3cd0b8c5 | 120 | |
5c9d9745 VZ |
121 | void Init(); |
122 | ||
3cd0b8c5 | 123 | WXDisplay *m_display; |
2b77c3fc | 124 | WXWindow m_x11window; |
3cd0b8c5 RR |
125 | WXGC m_penGC; |
126 | WXGC m_brushGC; | |
127 | WXGC m_textGC; | |
128 | WXGC m_bgGC; | |
129 | WXColormap m_cmap; | |
130 | bool m_isMemDC; | |
131 | bool m_isScreenDC; | |
3cd0b8c5 RR |
132 | wxRegion m_currentClippingRegion; |
133 | wxRegion m_paintClippingRegion; | |
134 | ||
2b5f62a0 VZ |
135 | #if wxUSE_UNICODE |
136 | PangoContext *m_context; | |
137 | PangoFontDescription *m_fontdesc; | |
138 | #endif | |
139 | ||
3cd0b8c5 RR |
140 | void SetUpDC(); |
141 | void Destroy(); | |
3cd0b8c5 RR |
142 | |
143 | private: | |
2b77c3fc | 144 | DECLARE_CLASS(wxWindowDCImpl) |
83df96d6 JS |
145 | }; |
146 | ||
3cd0b8c5 RR |
147 | //----------------------------------------------------------------------------- |
148 | // wxClientDC | |
149 | //----------------------------------------------------------------------------- | |
150 | ||
2b77c3fc | 151 | class WXDLLIMPEXP_CORE wxClientDCImpl : public wxWindowDCImpl |
83df96d6 | 152 | { |
83df96d6 | 153 | public: |
2b77c3fc RR |
154 | wxClientDCImpl( wxDC *owner ) : wxWindowDCImpl( owner ) { } |
155 | wxClientDCImpl( wxDC *owner, wxWindow *win ); | |
3cd0b8c5 RR |
156 | |
157 | protected: | |
158 | virtual void DoGetSize(int *width, int *height) const; | |
159 | ||
160 | private: | |
2b77c3fc | 161 | DECLARE_CLASS(wxClientDCImpl) |
83df96d6 JS |
162 | }; |
163 | ||
3cd0b8c5 RR |
164 | //----------------------------------------------------------------------------- |
165 | // wxPaintDC | |
166 | //----------------------------------------------------------------------------- | |
167 | ||
2b77c3fc | 168 | class WXDLLIMPEXP_CORE wxPaintDCImpl : public wxClientDCImpl |
83df96d6 | 169 | { |
83df96d6 | 170 | public: |
2b77c3fc RR |
171 | wxPaintDCImpl( wxDC *owner ) : wxClientDCImpl( owner ) { } |
172 | wxPaintDCImpl( wxDC *owner, wxWindow *win ); | |
3cd0b8c5 RR |
173 | |
174 | private: | |
2b77c3fc | 175 | DECLARE_CLASS(wxPaintDCImpl) |
83df96d6 JS |
176 | }; |
177 | ||
178 | #endif | |
179 | // _WX_DCCLIENT_H_ |