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