]>
Commit | Line | Data |
---|---|---|
006162a9 VZ |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: dc.h | |
3 | // Purpose: wxDC class | |
4 | // Author: Vadim Zeitlin | |
5 | // Modified by: | |
6 | // Created: 05/25/99 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) wxWindows team | |
9 | // Licence: wxWindows licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
34138703 JS |
12 | #ifndef _WX_DC_H_BASE_ |
13 | #define _WX_DC_H_BASE_ | |
c801d85f | 14 | |
a23fd0e1 VZ |
15 | #ifdef __GNUG__ |
16 | #pragma interface "dcbase.h" | |
17 | #endif | |
18 | ||
19 | // ---------------------------------------------------------------------------- | |
20 | // headers which we must include here | |
21 | // ---------------------------------------------------------------------------- | |
22 | ||
23 | #include "wx/object.h" // the base class | |
24 | ||
25 | #include "wx/cursor.h" // we have member variables of these classes | |
26 | #include "wx/font.h" // so we can't do without them | |
27 | #include "wx/colour.h" | |
28 | #include "wx/brush.h" | |
29 | #include "wx/pen.h" | |
30 | #include "wx/palette.h" | |
31 | ||
32 | #include "wx/list.h" // we use wxList in inline functions | |
33 | ||
a23fd0e1 VZ |
34 | // --------------------------------------------------------------------------- |
35 | // global variables | |
36 | // --------------------------------------------------------------------------- | |
37 | ||
38 | WXDLLEXPORT_DATA(extern int) wxPageNumber; | |
39 | ||
40 | // --------------------------------------------------------------------------- | |
41 | // wxDC is the device context - object on which any drawing is done | |
42 | // --------------------------------------------------------------------------- | |
43 | ||
44 | class WXDLLEXPORT wxDCBase : public wxObject | |
45 | { | |
46 | DECLARE_ABSTRACT_CLASS(wxDCBase) | |
47 | ||
48 | public: | |
49 | wxDCBase() | |
50 | { | |
51 | m_clipping = FALSE; | |
52 | m_ok = TRUE; | |
53 | ||
54 | m_minX = m_minY = m_maxX = m_maxY = 0; | |
55 | ||
56 | m_signX = m_signY = 1; | |
57 | ||
58 | m_logicalOriginX = m_logicalOriginY = | |
59 | m_deviceOriginX = m_deviceOriginY = 0; | |
60 | ||
61 | m_logicalScaleX = m_logicalScaleY = | |
220af862 | 62 | m_userScaleX = m_userScaleY = |
a23fd0e1 VZ |
63 | m_scaleX = m_scaleY = 1.0; |
64 | ||
65 | m_logicalFunction = -1; | |
66 | ||
67 | m_backgroundMode = wxTRANSPARENT; | |
68 | ||
69 | m_mappingMode = wxMM_TEXT; | |
70 | ||
af0bb3b1 | 71 | m_backgroundBrush = *wxTRANSPARENT_BRUSH; |
a23fd0e1 VZ |
72 | |
73 | m_textForegroundColour = *wxBLACK; | |
74 | m_textBackgroundColour = *wxWHITE; | |
75 | ||
76 | m_colour = wxColourDisplay(); | |
77 | } | |
78 | ||
79 | ~wxDCBase() { } | |
80 | ||
81 | virtual void BeginDrawing() { } | |
82 | virtual void EndDrawing() { } | |
83 | ||
84 | // graphic primitives | |
85 | // ------------------ | |
86 | ||
72cdf4c9 VZ |
87 | void FloodFill(wxCoord x, wxCoord y, const wxColour& col, |
88 | int style = wxFLOOD_SURFACE) | |
a23fd0e1 VZ |
89 | { DoFloodFill(x, y, col, style); } |
90 | void FloodFill(const wxPoint& pt, const wxColour& col, | |
72cdf4c9 | 91 | int style = wxFLOOD_SURFACE) |
a23fd0e1 VZ |
92 | { DoFloodFill(pt.x, pt.y, col, style); } |
93 | ||
72cdf4c9 | 94 | bool GetPixel(wxCoord x, wxCoord y, wxColour *col) const |
a23fd0e1 VZ |
95 | { return DoGetPixel(x, y, col); } |
96 | bool GetPixel(const wxPoint& pt, wxColour *col) const | |
97 | { return DoGetPixel(pt.x, pt.y, col); } | |
98 | ||
72cdf4c9 | 99 | void DrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2) |
a23fd0e1 VZ |
100 | { DoDrawLine(x1, y1, x2, y2); } |
101 | void DrawLine(const wxPoint& pt1, const wxPoint& pt2) | |
102 | { DoDrawLine(pt1.x, pt1.y, pt2.x, pt2.y); } | |
103 | ||
72cdf4c9 | 104 | void CrossHair(wxCoord x, wxCoord y) |
a23fd0e1 VZ |
105 | { DoCrossHair(x, y); } |
106 | void CrossHair(const wxPoint& pt) | |
107 | { DoCrossHair(pt.x, pt.y); } | |
108 | ||
72cdf4c9 VZ |
109 | void DrawArc(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2, |
110 | wxCoord xc, wxCoord yc) | |
a23fd0e1 VZ |
111 | { DoDrawArc(x1, y1, x2, y2, xc, yc); } |
112 | void DrawArc(const wxPoint& pt1, const wxPoint& pt2, const wxPoint& centre) | |
113 | { DoDrawArc(pt1.x, pt1.y, pt2.x, pt2.y, centre.x, centre.y); } | |
114 | ||
72cdf4c9 VZ |
115 | void DrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h, |
116 | double sa, double ea) | |
7b90a8f2 | 117 | { DoDrawEllipticArc(x, y, w, h, sa, ea); } |
a23fd0e1 VZ |
118 | void DrawEllipticArc(const wxPoint& pt, const wxSize& sz, |
119 | double sa, double ea) | |
120 | { DoDrawEllipticArc(pt.x, pt.y, sz.x, sz.y, sa, ea); } | |
121 | ||
72cdf4c9 | 122 | void DrawPoint(wxCoord x, wxCoord y) |
a23fd0e1 VZ |
123 | { DoDrawPoint(x, y); } |
124 | void DrawPoint(const wxPoint& pt) | |
125 | { DoDrawPoint(pt.x, pt.y); } | |
126 | ||
72cdf4c9 VZ |
127 | void DrawLines(int n, wxPoint points[], |
128 | wxCoord xoffset = 0, wxCoord yoffset = 0) | |
a23fd0e1 | 129 | { DoDrawLines(n, points, xoffset, yoffset); } |
72cdf4c9 VZ |
130 | void DrawLines(const wxList *list, |
131 | wxCoord xoffset = 0, wxCoord yoffset = 0); | |
a23fd0e1 VZ |
132 | |
133 | void DrawPolygon(int n, wxPoint points[], | |
72cdf4c9 | 134 | wxCoord xoffset = 0, wxCoord yoffset = 0, |
a23fd0e1 VZ |
135 | int fillStyle = wxODDEVEN_RULE) |
136 | { DoDrawPolygon(n, points, xoffset, yoffset, fillStyle); } | |
137 | ||
138 | void DrawPolygon(const wxList *list, | |
72cdf4c9 | 139 | wxCoord xoffset = 0, wxCoord yoffset = 0, |
bd5dd957 | 140 | int fillStyle = wxODDEVEN_RULE); |
a23fd0e1 | 141 | |
72cdf4c9 | 142 | void DrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height) |
a23fd0e1 VZ |
143 | { DoDrawRectangle(x, y, width, height); } |
144 | void DrawRectangle(const wxPoint& pt, const wxSize& sz) | |
145 | { DoDrawRectangle(pt.x, pt.y, sz.x, sz.y); } | |
146 | void DrawRectangle(const wxRect& rect) | |
147 | { DoDrawRectangle(rect.x, rect.y, rect.width, rect.height); } | |
148 | ||
72cdf4c9 | 149 | void DrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, |
a23fd0e1 VZ |
150 | double radius) |
151 | { DoDrawRoundedRectangle(x, y, width, height, radius); } | |
152 | void DrawRoundedRectangle(const wxPoint& pt, const wxSize& sz, | |
153 | double radius) | |
154 | { DoDrawRoundedRectangle(pt.x, pt.y, sz.x, sz.y, radius); } | |
155 | void DrawRoundedRectangle(const wxRect& r, double radius) | |
156 | { DoDrawRoundedRectangle(r.x, r.y, r.width, r.height, radius); } | |
157 | ||
72cdf4c9 | 158 | void DrawCircle(wxCoord x, wxCoord y, wxCoord radius) |
220af862 | 159 | { DoDrawEllipse(x - radius, y - radius, 2*radius, 2*radius); } |
72cdf4c9 | 160 | void DrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height) |
a23fd0e1 VZ |
161 | { DoDrawEllipse(x, y, width, height); } |
162 | void DrawEllipse(const wxPoint& pt, const wxSize& sz) | |
163 | { DoDrawEllipse(pt.x, pt.y, sz.x, sz.y); } | |
164 | void DrawEllipse(const wxRect& rect) | |
165 | { DoDrawEllipse(rect.x, rect.y, rect.width, rect.height); } | |
166 | ||
72cdf4c9 | 167 | void DrawIcon(const wxIcon& icon, wxCoord x, wxCoord y) |
a23fd0e1 VZ |
168 | { DoDrawIcon(icon, x, y); } |
169 | void DrawIcon(const wxIcon& icon, const wxPoint& pt) | |
170 | { DoDrawIcon(icon, pt.x, pt.y); } | |
171 | ||
72cdf4c9 VZ |
172 | void DrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y, |
173 | bool useMask = FALSE) | |
a23fd0e1 VZ |
174 | { DoDrawBitmap(bmp, x, y, useMask); } |
175 | void DrawBitmap(const wxBitmap &bmp, const wxPoint& pt, | |
176 | bool useMask = FALSE) | |
177 | { DoDrawBitmap(bmp, pt.x, pt.y, useMask); } | |
178 | ||
72cdf4c9 | 179 | void DrawText(const wxString& text, wxCoord x, wxCoord y) |
a23fd0e1 VZ |
180 | { DoDrawText(text, x, y); } |
181 | void DrawText(const wxString& text, const wxPoint& pt) | |
182 | { DoDrawText(text, pt.x, pt.y); } | |
183 | ||
72cdf4c9 VZ |
184 | bool Blit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height, |
185 | wxDC *source, wxCoord xsrc, wxCoord ysrc, | |
a23fd0e1 VZ |
186 | int rop = wxCOPY, bool useMask = FALSE) |
187 | { | |
188 | return DoBlit(xdest, ydest, width, height, | |
189 | source, xsrc, ysrc, rop, useMask); | |
190 | } | |
191 | bool Blit(const wxPoint& destPt, const wxSize& sz, | |
192 | wxDC *source, const wxPoint& srcPt, | |
193 | int rop = wxCOPY, bool useMask = FALSE) | |
194 | { | |
195 | return DoBlit(destPt.x, destPt.y, sz.x, sz.y, | |
196 | source, srcPt.x, srcPt.y, rop, useMask); | |
197 | } | |
198 | ||
199 | #if wxUSE_SPLINES | |
72cdf4c9 VZ |
200 | // TODO: this API needs fixing (wxPointList, why (!const) "wxList *"?) |
201 | void DrawSpline(wxCoord x1, wxCoord y1, | |
202 | wxCoord x2, wxCoord y2, | |
203 | wxCoord x3, wxCoord y3); | |
bd5dd957 | 204 | void DrawSpline(int n, wxPoint points[]); |
a23fd0e1 VZ |
205 | |
206 | void DrawSpline(wxList *points) { DoDrawSpline(points); } | |
207 | #endif // wxUSE_SPLINES | |
208 | ||
209 | // global DC operations | |
210 | // -------------------- | |
211 | ||
212 | virtual void Clear() = 0; | |
213 | ||
af0bb3b1 VZ |
214 | virtual bool StartDoc(const wxString& WXUNUSED(message)) { return TRUE; } |
215 | virtual void EndDoc() { } | |
a23fd0e1 | 216 | |
af0bb3b1 VZ |
217 | virtual void StartPage() { } |
218 | virtual void EndPage() { } | |
a23fd0e1 VZ |
219 | |
220 | // set objects to use for drawing | |
221 | // ------------------------------ | |
222 | ||
223 | virtual void SetFont(const wxFont& font) = 0; | |
224 | virtual void SetPen(const wxPen& pen) = 0; | |
225 | virtual void SetBrush(const wxBrush& brush) = 0; | |
226 | virtual void SetBackground(const wxBrush& brush) = 0; | |
227 | virtual void SetBackgroundMode(int mode) = 0; | |
228 | virtual void SetPalette(const wxPalette& palette) = 0; | |
229 | ||
230 | // clipping region | |
231 | // --------------- | |
232 | ||
72cdf4c9 | 233 | void SetClippingRegion(wxCoord x, wxCoord y, wxCoord width, wxCoord height) |
a23fd0e1 VZ |
234 | { DoSetClippingRegion(x, y, width, height); } |
235 | void SetClippingRegion(const wxPoint& pt, const wxSize& sz) | |
236 | { DoSetClippingRegion(pt.x, pt.y, sz.x, sz.y); } | |
237 | void SetClippingRegion(const wxRect& rect) | |
238 | { DoSetClippingRegion(rect.x, rect.y, rect.width, rect.height); } | |
239 | void SetClippingRegion(const wxRegion& region) | |
240 | { DoSetClippingRegionAsRegion(region); } | |
241 | ||
242 | virtual void DestroyClippingRegion() = 0; | |
243 | ||
72cdf4c9 | 244 | void GetClippingBox(wxCoord *x, wxCoord *y, wxCoord *w, wxCoord *h) const |
a23fd0e1 VZ |
245 | { DoGetClippingBox(x, y, w, h); } |
246 | void GetClippingBox(wxRect& rect) const | |
247 | { DoGetClippingBox(&rect.x, &rect.y, &rect.width, &rect.height); } | |
248 | ||
249 | // text extent | |
250 | // ----------- | |
251 | ||
72cdf4c9 VZ |
252 | virtual wxCoord GetCharHeight() const = 0; |
253 | virtual wxCoord GetCharWidth() const = 0; | |
1dd989e1 | 254 | |
72cdf4c9 VZ |
255 | void GetTextExtent(const wxString& string, |
256 | wxCoord *x, wxCoord *y, | |
257 | wxCoord *descent = NULL, | |
258 | wxCoord *externalLeading = NULL, | |
259 | wxFont *theFont = NULL) const | |
260 | { DoGetTextExtent(string, x, y, descent, externalLeading, theFont); } | |
a23fd0e1 VZ |
261 | |
262 | // size and resolution | |
263 | // ------------------- | |
264 | ||
265 | // in device units | |
266 | void GetSize(int *width, int *height) const | |
267 | { DoGetSize(width, height); } | |
268 | wxSize GetSize() const | |
269 | { | |
270 | int w, h; | |
271 | DoGetSize(&w, &h); | |
272 | ||
273 | return wxSize(w, h); | |
274 | } | |
275 | ||
276 | // in mm | |
277 | void GetSizeMM(int* width, int* height) const | |
278 | { DoGetSizeMM(width, height); } | |
279 | wxSize GetSizeMM() const | |
280 | { | |
281 | int w, h; | |
282 | DoGetSizeMM(&w, &h); | |
283 | ||
284 | return wxSize(w, h); | |
285 | } | |
286 | ||
287 | // coordinates conversions | |
288 | // ----------------------- | |
289 | ||
290 | // This group of functions does actual conversion of the input, as you'd | |
291 | // expect. | |
72cdf4c9 VZ |
292 | wxCoord DeviceToLogicalX(wxCoord x) const; |
293 | wxCoord DeviceToLogicalY(wxCoord y) const; | |
294 | wxCoord DeviceToLogicalXRel(wxCoord x) const; | |
295 | wxCoord DeviceToLogicalYRel(wxCoord y) const; | |
296 | wxCoord LogicalToDeviceX(wxCoord x) const; | |
297 | wxCoord LogicalToDeviceY(wxCoord y) const; | |
298 | wxCoord LogicalToDeviceXRel(wxCoord x) const; | |
299 | wxCoord LogicalToDeviceYRel(wxCoord y) const; | |
a23fd0e1 VZ |
300 | |
301 | // query DC capabilities | |
302 | // --------------------- | |
303 | ||
304 | virtual bool CanDrawBitmap() const = 0; | |
305 | virtual bool CanGetTextExtent() const = 0; | |
306 | ||
307 | // colour depth | |
308 | virtual int GetDepth() const = 0; | |
309 | ||
310 | // Resolution in Pixels per inch | |
311 | virtual wxSize GetPPI() const = 0; | |
312 | ||
313 | virtual bool Ok() const { return m_ok; } | |
314 | ||
315 | // accessors | |
316 | // --------- | |
317 | ||
318 | // const... | |
319 | const wxBrush& GetBackground() const { return m_backgroundBrush; } | |
320 | const wxBrush& GetBrush() const { return m_brush; } | |
321 | const wxFont& GetFont() const { return m_font; } | |
322 | const wxPen& GetPen() const { return m_pen; } | |
323 | const wxColour& GetTextBackground() const { return m_textBackgroundColour; } | |
324 | const wxColour& GetTextForeground() const { return m_textForegroundColour; } | |
325 | ||
326 | // ... and non const | |
327 | wxBrush& GetBackground() { return m_backgroundBrush; } | |
328 | wxBrush& GetBrush() { return m_brush; } | |
329 | wxFont& GetFont() { return m_font; } | |
330 | wxPen& GetPen() { return m_pen; } | |
331 | wxColour& GetTextBackground() { return m_textBackgroundColour; } | |
332 | wxColour& GetTextForeground() { return m_textForegroundColour; } | |
333 | ||
334 | virtual void SetTextForeground(const wxColour& colour) | |
335 | { m_textForegroundColour = colour; } | |
336 | virtual void SetTextBackground(const wxColour& colour) | |
337 | { m_textBackgroundColour = colour; } | |
338 | ||
339 | int GetMapMode() const { return m_mappingMode; } | |
340 | virtual void SetMapMode(int mode) = 0; | |
341 | ||
342 | virtual void GetUserScale(double *x, double *y) const | |
343 | { | |
344 | if ( x ) *x = m_userScaleX; | |
345 | if ( y ) *y = m_userScaleY; | |
346 | } | |
347 | virtual void SetUserScale(double x, double y) = 0; | |
348 | ||
a23fd0e1 VZ |
349 | virtual void GetLogicalScale(double *x, double *y) |
350 | { | |
351 | if ( x ) *x = m_logicalScaleX; | |
352 | if ( y ) *y = m_logicalScaleY; | |
353 | } | |
354 | virtual void SetLogicalScale(double x, double y) | |
355 | { | |
356 | m_logicalScaleX = x; | |
357 | m_logicalScaleY = y; | |
358 | } | |
359 | ||
72cdf4c9 | 360 | void GetLogicalOrigin(wxCoord *x, wxCoord *y) const |
a23fd0e1 VZ |
361 | { DoGetLogicalOrigin(x, y); } |
362 | wxPoint GetLogicalOrigin() const | |
72cdf4c9 VZ |
363 | { wxCoord x, y; DoGetLogicalOrigin(&x, &y); return wxPoint(x, y); } |
364 | virtual void SetLogicalOrigin(wxCoord x, wxCoord y) = 0; | |
a23fd0e1 | 365 | |
72cdf4c9 | 366 | void GetDeviceOrigin(wxCoord *x, wxCoord *y) const |
a23fd0e1 VZ |
367 | { DoGetDeviceOrigin(x, y); } |
368 | wxPoint GetDeviceOrigin() const | |
72cdf4c9 VZ |
369 | { wxCoord x, y; DoGetDeviceOrigin(&x, &y); return wxPoint(x, y); } |
370 | virtual void SetDeviceOrigin(wxCoord x, wxCoord y) = 0; | |
a23fd0e1 VZ |
371 | |
372 | virtual void SetAxisOrientation(bool xLeftRight, bool yBottomUp) = 0; | |
373 | ||
374 | int GetLogicalFunction() const { return m_logicalFunction; } | |
375 | virtual void SetLogicalFunction(int function) = 0; | |
376 | ||
377 | // Sometimes we need to override optimization, e.g. if other software is | |
378 | // drawing onto our surface and we can't be sure of who's done what. | |
379 | // | |
380 | // FIXME: is this (still) used? | |
381 | virtual void SetOptimization(bool WXUNUSED(opt)) { } | |
382 | virtual bool GetOptimization() { return FALSE; } | |
383 | ||
384 | // bounding box | |
385 | // ------------ | |
386 | ||
72cdf4c9 | 387 | virtual void CalcBoundingBox(wxCoord x, wxCoord y) |
a23fd0e1 | 388 | { |
72cdf4c9 VZ |
389 | if ( x < m_minX ) m_minX = x; |
390 | if ( y < m_minY ) m_minY = y; | |
391 | if ( x > m_maxX ) m_maxX = x; | |
392 | if ( y > m_maxY ) m_maxY = y; | |
a23fd0e1 VZ |
393 | } |
394 | ||
395 | // Get the final bounding box of the PostScript or Metafile picture. | |
72cdf4c9 VZ |
396 | wxCoord MinX() const { return m_minX; } |
397 | wxCoord MaxX() const { return m_maxX; } | |
398 | wxCoord MinY() const { return m_minY; } | |
399 | wxCoord MaxY() const { return m_maxY; } | |
a23fd0e1 VZ |
400 | |
401 | // misc old functions | |
402 | // ------------------ | |
403 | ||
72cdf4c9 VZ |
404 | // for compatibility with the old code when wxCoord was long everywhere |
405 | #ifndef __WIN16__ | |
406 | void GetTextExtent(const wxString& string, | |
407 | long *x, long *y, | |
408 | long *descent = NULL, | |
409 | long *externalLeading = NULL, | |
410 | wxFont *theFont = NULL) const | |
411 | { | |
412 | wxCoord x2, y2, descent2, externalLeading2; | |
413 | DoGetTextExtent(string, &x2, &y2, | |
414 | &descent2, &externalLeading2, | |
415 | theFont); | |
416 | if ( x ) | |
417 | *x = x2; | |
418 | if ( y ) | |
419 | *y = y2; | |
420 | if ( descent ) | |
421 | *descent = descent2; | |
422 | if ( externalLeading ) | |
423 | *externalLeading = externalLeading2; | |
424 | } | |
425 | ||
426 | void GetLogicalOrigin(long *x, long *y) const | |
427 | { | |
428 | wxCoord x2, y2; | |
429 | DoGetLogicalOrigin(&x2, &y2); | |
430 | if ( x ) | |
431 | *x = x2; | |
432 | if ( y ) | |
433 | *y = y2; | |
434 | } | |
435 | ||
436 | void GetDeviceOrigin(long *x, long *y) const | |
437 | { | |
438 | wxCoord x2, y2; | |
439 | DoGetDeviceOrigin(&x2, &y2); | |
440 | if ( x ) | |
441 | *x = x2; | |
442 | if ( y ) | |
443 | *y = y2; | |
444 | } | |
1dd989e1 RR |
445 | void GetClippingBox(long *x, long *y, long *w, long *h) const |
446 | { | |
447 | wxCoord xx,yy,ww,hh; | |
448 | DoGetClippingBox(&xx, &yy, &ww, &hh); | |
449 | if (x) *x = xx; | |
450 | if (y) *y = yy; | |
451 | if (w) *w = ww; | |
452 | if (h) *h = hh; | |
453 | } | |
72cdf4c9 VZ |
454 | #endif // !Win16 |
455 | ||
a23fd0e1 VZ |
456 | #if WXWIN_COMPATIBILITY |
457 | virtual void SetColourMap(const wxPalette& palette) { SetPalette(palette); } | |
458 | void GetTextExtent(const wxString& string, float *x, float *y, | |
459 | float *descent = NULL, float *externalLeading = NULL, | |
460 | wxFont *theFont = NULL, bool use16bit = FALSE) const ; | |
461 | void GetSize(float* width, float* height) const { int w, h; GetSize(& w, & h); *width = w; *height = h; } | |
462 | void GetSizeMM(float *width, float *height) const { long w, h; GetSizeMM(& w, & h); *width = (float) w; *height = (float) h; } | |
463 | #endif // WXWIN_COMPATIBILITY | |
464 | ||
465 | protected: | |
466 | // the pure virtual functions which should be implemented by wxDC | |
72cdf4c9 | 467 | virtual void DoFloodFill(wxCoord x, wxCoord y, const wxColour& col, |
a23fd0e1 VZ |
468 | int style = wxFLOOD_SURFACE) = 0; |
469 | ||
72cdf4c9 | 470 | virtual bool DoGetPixel(wxCoord x, wxCoord y, wxColour *col) const = 0; |
a23fd0e1 | 471 | |
72cdf4c9 VZ |
472 | virtual void DoDrawPoint(wxCoord x, wxCoord y) = 0; |
473 | virtual void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2) = 0; | |
a23fd0e1 | 474 | |
72cdf4c9 VZ |
475 | virtual void DoDrawArc(wxCoord x1, wxCoord y1, |
476 | wxCoord x2, wxCoord y2, | |
477 | wxCoord xc, wxCoord yc) = 0; | |
478 | virtual void DoDrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h, | |
a23fd0e1 VZ |
479 | double sa, double ea) = 0; |
480 | ||
72cdf4c9 VZ |
481 | virtual void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height) = 0; |
482 | virtual void DoDrawRoundedRectangle(wxCoord x, wxCoord y, | |
483 | wxCoord width, wxCoord height, | |
a23fd0e1 | 484 | double radius) = 0; |
72cdf4c9 VZ |
485 | virtual void DoDrawEllipse(wxCoord x, wxCoord y, |
486 | wxCoord width, wxCoord height) = 0; | |
a23fd0e1 | 487 | |
72cdf4c9 | 488 | virtual void DoCrossHair(wxCoord x, wxCoord y) = 0; |
a23fd0e1 | 489 | |
72cdf4c9 VZ |
490 | virtual void DoDrawIcon(const wxIcon& icon, wxCoord x, wxCoord y) = 0; |
491 | virtual void DoDrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y, | |
a23fd0e1 VZ |
492 | bool useMask = FALSE) = 0; |
493 | ||
72cdf4c9 | 494 | virtual void DoDrawText(const wxString& text, wxCoord x, wxCoord y) = 0; |
a23fd0e1 | 495 | |
72cdf4c9 VZ |
496 | virtual bool DoBlit(wxCoord xdest, wxCoord ydest, |
497 | wxCoord width, wxCoord height, | |
498 | wxDC *source, wxCoord xsrc, wxCoord ysrc, | |
a23fd0e1 VZ |
499 | int rop = wxCOPY, bool useMask = FALSE) = 0; |
500 | ||
501 | virtual void DoGetSize(int *width, int *height) const = 0; | |
502 | virtual void DoGetSizeMM(int* width, int* height) const = 0; | |
503 | ||
504 | virtual void DoDrawLines(int n, wxPoint points[], | |
72cdf4c9 | 505 | wxCoord xoffset, wxCoord yoffset) = 0; |
a23fd0e1 | 506 | virtual void DoDrawPolygon(int n, wxPoint points[], |
72cdf4c9 | 507 | wxCoord xoffset, wxCoord yoffset, |
a23fd0e1 VZ |
508 | int fillStyle = wxODDEVEN_RULE) = 0; |
509 | ||
510 | virtual void DoSetClippingRegionAsRegion(const wxRegion& region) = 0; | |
72cdf4c9 VZ |
511 | virtual void DoSetClippingRegion(wxCoord x, wxCoord y, |
512 | wxCoord width, wxCoord height) = 0; | |
b0e0d661 VZ |
513 | |
514 | // FIXME are these functions really different? | |
72cdf4c9 VZ |
515 | virtual void DoGetClippingRegion(wxCoord *x, wxCoord *y, |
516 | wxCoord *w, wxCoord *h) | |
b0e0d661 | 517 | { DoGetClippingBox(x, y, w, h); } |
72cdf4c9 VZ |
518 | virtual void DoGetClippingBox(wxCoord *x, wxCoord *y, |
519 | wxCoord *w, wxCoord *h) const | |
a23fd0e1 VZ |
520 | { |
521 | if ( m_clipping ) | |
522 | { | |
523 | if ( x ) *x = m_clipX1; | |
524 | if ( y ) *y = m_clipY1; | |
525 | if ( w ) *w = m_clipX2 - m_clipX1; | |
526 | if ( h ) *h = m_clipY2 - m_clipY1; | |
527 | } | |
528 | else | |
529 | { | |
530 | *x = *y = *w = *h = 0; | |
531 | } | |
532 | } | |
533 | ||
72cdf4c9 | 534 | virtual void DoGetLogicalOrigin(wxCoord *x, wxCoord *y) const |
a23fd0e1 VZ |
535 | { |
536 | if ( x ) *x = m_logicalOriginX; | |
537 | if ( y ) *y = m_logicalOriginY; | |
538 | } | |
539 | ||
72cdf4c9 | 540 | virtual void DoGetDeviceOrigin(wxCoord *x, wxCoord *y) const |
a23fd0e1 VZ |
541 | { |
542 | if ( x ) *x = m_deviceOriginX; | |
543 | if ( y ) *y = m_deviceOriginY; | |
544 | } | |
545 | ||
72cdf4c9 VZ |
546 | virtual void DoGetTextExtent(const wxString& string, |
547 | wxCoord *x, wxCoord *y, | |
548 | wxCoord *descent = NULL, | |
549 | wxCoord *externalLeading = NULL, | |
550 | wxFont *theFont = NULL) const = 0; | |
551 | ||
64698f9a | 552 | #if wxUSE_SPLINES |
a23fd0e1 | 553 | virtual void DoDrawSpline(wxList *points) = 0; |
64698f9a | 554 | #endif |
a23fd0e1 VZ |
555 | |
556 | protected: | |
557 | // flags | |
558 | bool m_colour:1; | |
559 | bool m_ok:1; | |
560 | bool m_clipping:1; | |
561 | bool m_isInteractive:1; | |
562 | ||
563 | // coordinate system variables | |
564 | ||
565 | // TODO short descriptions of what exactly they are would be nice... | |
566 | ||
72cdf4c9 VZ |
567 | wxCoord m_logicalOriginX, m_logicalOriginY; |
568 | wxCoord m_deviceOriginX, m_deviceOriginY; | |
a23fd0e1 VZ |
569 | |
570 | double m_logicalScaleX, m_logicalScaleY; | |
571 | double m_userScaleX, m_userScaleY; | |
572 | double m_scaleX, m_scaleY; | |
573 | ||
574 | // Used by SetAxisOrientation() to invert the axes | |
575 | int m_signX, m_signY; | |
576 | ||
577 | // bounding and clipping boxes | |
72cdf4c9 VZ |
578 | wxCoord m_minX, m_minY, m_maxX, m_maxY; |
579 | wxCoord m_clipX1, m_clipY1, m_clipX2, m_clipY2; | |
a23fd0e1 VZ |
580 | |
581 | int m_logicalFunction; | |
582 | int m_backgroundMode; | |
583 | int m_mappingMode; | |
584 | ||
585 | // GDI objects | |
586 | wxPen m_pen; | |
587 | wxBrush m_brush; | |
588 | wxBrush m_backgroundBrush; | |
589 | wxColour m_textForegroundColour; | |
590 | wxColour m_textBackgroundColour; | |
591 | wxFont m_font; | |
592 | wxPalette m_palette; | |
593 | ||
594 | private: | |
595 | DECLARE_NO_COPY_CLASS(wxDCBase); | |
596 | }; | |
597 | ||
598 | // ---------------------------------------------------------------------------- | |
599 | // now include the declaration of wxDC class | |
600 | // ---------------------------------------------------------------------------- | |
601 | ||
2049ba38 | 602 | #if defined(__WXMSW__) |
a23fd0e1 | 603 | #include "wx/msw/dc.h" |
2049ba38 | 604 | #elif defined(__WXMOTIF__) |
a23fd0e1 | 605 | #include "wx/motif/dc.h" |
2049ba38 | 606 | #elif defined(__WXGTK__) |
a23fd0e1 | 607 | #include "wx/gtk/dc.h" |
b4e76e0d | 608 | #elif defined(__WXQT__) |
a23fd0e1 | 609 | #include "wx/qt/dc.h" |
34138703 | 610 | #elif defined(__WXMAC__) |
a23fd0e1 | 611 | #include "wx/mac/dc.h" |
1777b9bb DW |
612 | #elif defined(__WXPM__) |
613 | #include "wx/os2/dc.h" | |
34138703 | 614 | #elif defined(__WXSTUBS__) |
a23fd0e1 | 615 | #include "wx/stubs/dc.h" |
c801d85f KB |
616 | #endif |
617 | ||
618 | #endif | |
34138703 | 619 | // _WX_DC_H_BASE_ |