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