]> git.saurik.com Git - wxWidgets.git/blame - include/wx/dc.h
Added wxGenericDirCtrl, wxGenericDirDialog and associated icons.
[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
f6bcfd97 52 ResetBoundingBox();
a23fd0e1
VZ
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...
f6bcfd97 333 int GetBackgroundMode() const { return m_backgroundMode; }
a23fd0e1
VZ
334 const wxBrush& GetBackground() const { return m_backgroundBrush; }
335 const wxBrush& GetBrush() const { return m_brush; }
336 const wxFont& GetFont() const { return m_font; }
337 const wxPen& GetPen() const { return m_pen; }
338 const wxColour& GetTextBackground() const { return m_textBackgroundColour; }
339 const wxColour& GetTextForeground() const { return m_textForegroundColour; }
340
341 // ... and non const
342 wxBrush& GetBackground() { return m_backgroundBrush; }
343 wxBrush& GetBrush() { return m_brush; }
344 wxFont& GetFont() { return m_font; }
345 wxPen& GetPen() { return m_pen; }
346 wxColour& GetTextBackground() { return m_textBackgroundColour; }
347 wxColour& GetTextForeground() { return m_textForegroundColour; }
348
349 virtual void SetTextForeground(const wxColour& colour)
350 { m_textForegroundColour = colour; }
351 virtual void SetTextBackground(const wxColour& colour)
352 { m_textBackgroundColour = colour; }
353
354 int GetMapMode() const { return m_mappingMode; }
355 virtual void SetMapMode(int mode) = 0;
356
357 virtual void GetUserScale(double *x, double *y) const
358 {
359 if ( x ) *x = m_userScaleX;
360 if ( y ) *y = m_userScaleY;
361 }
362 virtual void SetUserScale(double x, double y) = 0;
363
a23fd0e1
VZ
364 virtual void GetLogicalScale(double *x, double *y)
365 {
366 if ( x ) *x = m_logicalScaleX;
367 if ( y ) *y = m_logicalScaleY;
368 }
369 virtual void SetLogicalScale(double x, double y)
370 {
371 m_logicalScaleX = x;
372 m_logicalScaleY = y;
373 }
374
72cdf4c9 375 void GetLogicalOrigin(wxCoord *x, wxCoord *y) const
a23fd0e1
VZ
376 { DoGetLogicalOrigin(x, y); }
377 wxPoint GetLogicalOrigin() const
72cdf4c9
VZ
378 { wxCoord x, y; DoGetLogicalOrigin(&x, &y); return wxPoint(x, y); }
379 virtual void SetLogicalOrigin(wxCoord x, wxCoord y) = 0;
a23fd0e1 380
72cdf4c9 381 void GetDeviceOrigin(wxCoord *x, wxCoord *y) const
a23fd0e1
VZ
382 { DoGetDeviceOrigin(x, y); }
383 wxPoint GetDeviceOrigin() const
72cdf4c9
VZ
384 { wxCoord x, y; DoGetDeviceOrigin(&x, &y); return wxPoint(x, y); }
385 virtual void SetDeviceOrigin(wxCoord x, wxCoord y) = 0;
a23fd0e1
VZ
386
387 virtual void SetAxisOrientation(bool xLeftRight, bool yBottomUp) = 0;
388
389 int GetLogicalFunction() const { return m_logicalFunction; }
390 virtual void SetLogicalFunction(int function) = 0;
391
392 // Sometimes we need to override optimization, e.g. if other software is
393 // drawing onto our surface and we can't be sure of who's done what.
394 //
395 // FIXME: is this (still) used?
396 virtual void SetOptimization(bool WXUNUSED(opt)) { }
397 virtual bool GetOptimization() { return FALSE; }
398
399 // bounding box
400 // ------------
401
72cdf4c9 402 virtual void CalcBoundingBox(wxCoord x, wxCoord y)
a23fd0e1 403 {
f6bcfd97
BP
404 if ( m_isBBoxValid )
405 {
406 if ( x < m_minX ) m_minX = x;
407 if ( y < m_minY ) m_minY = y;
408 if ( x > m_maxX ) m_maxX = x;
409 if ( y > m_maxY ) m_maxY = y;
410 }
411 else
412 {
413 m_isBBoxValid = TRUE;
414
415 m_minX = x;
416 m_minY = y;
417 m_maxX = x;
418 m_maxY = y;
419 }
420 }
421
422 void ResetBoundingBox()
423 {
424 m_isBBoxValid = FALSE;
425
426 m_minX = m_maxX = m_minY = m_maxY = 0;
a23fd0e1
VZ
427 }
428
429 // Get the final bounding box of the PostScript or Metafile picture.
72cdf4c9
VZ
430 wxCoord MinX() const { return m_minX; }
431 wxCoord MaxX() const { return m_maxX; }
432 wxCoord MinY() const { return m_minY; }
433 wxCoord MaxY() const { return m_maxY; }
a23fd0e1
VZ
434
435 // misc old functions
436 // ------------------
437
72cdf4c9
VZ
438 // for compatibility with the old code when wxCoord was long everywhere
439#ifndef __WIN16__
440 void GetTextExtent(const wxString& string,
441 long *x, long *y,
442 long *descent = NULL,
443 long *externalLeading = NULL,
444 wxFont *theFont = NULL) const
445 {
446 wxCoord x2, y2, descent2, externalLeading2;
447 DoGetTextExtent(string, &x2, &y2,
448 &descent2, &externalLeading2,
449 theFont);
450 if ( x )
451 *x = x2;
452 if ( y )
453 *y = y2;
454 if ( descent )
455 *descent = descent2;
456 if ( externalLeading )
457 *externalLeading = externalLeading2;
458 }
459
460 void GetLogicalOrigin(long *x, long *y) const
461 {
462 wxCoord x2, y2;
463 DoGetLogicalOrigin(&x2, &y2);
464 if ( x )
465 *x = x2;
466 if ( y )
467 *y = y2;
468 }
469
470 void GetDeviceOrigin(long *x, long *y) const
471 {
472 wxCoord x2, y2;
473 DoGetDeviceOrigin(&x2, &y2);
474 if ( x )
475 *x = x2;
476 if ( y )
477 *y = y2;
478 }
1dd989e1 479 void GetClippingBox(long *x, long *y, long *w, long *h) const
cd9da200
VZ
480 {
481 wxCoord xx,yy,ww,hh;
482 DoGetClippingBox(&xx, &yy, &ww, &hh);
483 if (x) *x = xx;
484 if (y) *y = yy;
485 if (w) *w = ww;
486 if (h) *h = hh;
1dd989e1 487 }
72cdf4c9
VZ
488#endif // !Win16
489
a23fd0e1
VZ
490#if WXWIN_COMPATIBILITY
491 virtual void SetColourMap(const wxPalette& palette) { SetPalette(palette); }
492 void GetTextExtent(const wxString& string, float *x, float *y,
493 float *descent = NULL, float *externalLeading = NULL,
494 wxFont *theFont = NULL, bool use16bit = FALSE) const ;
495 void GetSize(float* width, float* height) const { int w, h; GetSize(& w, & h); *width = w; *height = h; }
496 void GetSizeMM(float *width, float *height) const { long w, h; GetSizeMM(& w, & h); *width = (float) w; *height = (float) h; }
497#endif // WXWIN_COMPATIBILITY
498
499protected:
500 // the pure virtual functions which should be implemented by wxDC
72cdf4c9 501 virtual void DoFloodFill(wxCoord x, wxCoord y, const wxColour& col,
a23fd0e1
VZ
502 int style = wxFLOOD_SURFACE) = 0;
503
72cdf4c9 504 virtual bool DoGetPixel(wxCoord x, wxCoord y, wxColour *col) const = 0;
a23fd0e1 505
72cdf4c9
VZ
506 virtual void DoDrawPoint(wxCoord x, wxCoord y) = 0;
507 virtual void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2) = 0;
a23fd0e1 508
72cdf4c9
VZ
509 virtual void DoDrawArc(wxCoord x1, wxCoord y1,
510 wxCoord x2, wxCoord y2,
511 wxCoord xc, wxCoord yc) = 0;
cd9da200
VZ
512 virtual void DoDrawCheckMark(wxCoord x, wxCoord y,
513 wxCoord width, wxCoord height);
72cdf4c9 514 virtual void DoDrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h,
a23fd0e1
VZ
515 double sa, double ea) = 0;
516
72cdf4c9
VZ
517 virtual void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height) = 0;
518 virtual void DoDrawRoundedRectangle(wxCoord x, wxCoord y,
519 wxCoord width, wxCoord height,
a23fd0e1 520 double radius) = 0;
72cdf4c9
VZ
521 virtual void DoDrawEllipse(wxCoord x, wxCoord y,
522 wxCoord width, wxCoord height) = 0;
a23fd0e1 523
72cdf4c9 524 virtual void DoCrossHair(wxCoord x, wxCoord y) = 0;
a23fd0e1 525
72cdf4c9
VZ
526 virtual void DoDrawIcon(const wxIcon& icon, wxCoord x, wxCoord y) = 0;
527 virtual void DoDrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y,
a23fd0e1
VZ
528 bool useMask = FALSE) = 0;
529
72cdf4c9 530 virtual void DoDrawText(const wxString& text, wxCoord x, wxCoord y) = 0;
95724b1a
VZ
531 virtual void DoDrawRotatedText(const wxString& text,
532 wxCoord x, wxCoord y, double angle) = 0;
a23fd0e1 533
72cdf4c9
VZ
534 virtual bool DoBlit(wxCoord xdest, wxCoord ydest,
535 wxCoord width, wxCoord height,
536 wxDC *source, wxCoord xsrc, wxCoord ysrc,
a23fd0e1
VZ
537 int rop = wxCOPY, bool useMask = FALSE) = 0;
538
539 virtual void DoGetSize(int *width, int *height) const = 0;
540 virtual void DoGetSizeMM(int* width, int* height) const = 0;
541
542 virtual void DoDrawLines(int n, wxPoint points[],
72cdf4c9 543 wxCoord xoffset, wxCoord yoffset) = 0;
a23fd0e1 544 virtual void DoDrawPolygon(int n, wxPoint points[],
72cdf4c9 545 wxCoord xoffset, wxCoord yoffset,
a23fd0e1
VZ
546 int fillStyle = wxODDEVEN_RULE) = 0;
547
548 virtual void DoSetClippingRegionAsRegion(const wxRegion& region) = 0;
72cdf4c9
VZ
549 virtual void DoSetClippingRegion(wxCoord x, wxCoord y,
550 wxCoord width, wxCoord height) = 0;
b0e0d661
VZ
551
552 // FIXME are these functions really different?
72cdf4c9
VZ
553 virtual void DoGetClippingRegion(wxCoord *x, wxCoord *y,
554 wxCoord *w, wxCoord *h)
b0e0d661 555 { DoGetClippingBox(x, y, w, h); }
72cdf4c9
VZ
556 virtual void DoGetClippingBox(wxCoord *x, wxCoord *y,
557 wxCoord *w, wxCoord *h) const
a23fd0e1
VZ
558 {
559 if ( m_clipping )
560 {
561 if ( x ) *x = m_clipX1;
562 if ( y ) *y = m_clipY1;
563 if ( w ) *w = m_clipX2 - m_clipX1;
564 if ( h ) *h = m_clipY2 - m_clipY1;
565 }
566 else
567 {
568 *x = *y = *w = *h = 0;
569 }
570 }
571
72cdf4c9 572 virtual void DoGetLogicalOrigin(wxCoord *x, wxCoord *y) const
a23fd0e1
VZ
573 {
574 if ( x ) *x = m_logicalOriginX;
575 if ( y ) *y = m_logicalOriginY;
576 }
577
72cdf4c9 578 virtual void DoGetDeviceOrigin(wxCoord *x, wxCoord *y) const
a23fd0e1
VZ
579 {
580 if ( x ) *x = m_deviceOriginX;
581 if ( y ) *y = m_deviceOriginY;
582 }
583
72cdf4c9
VZ
584 virtual void DoGetTextExtent(const wxString& string,
585 wxCoord *x, wxCoord *y,
586 wxCoord *descent = NULL,
587 wxCoord *externalLeading = NULL,
588 wxFont *theFont = NULL) const = 0;
589
64698f9a 590#if wxUSE_SPLINES
a23fd0e1 591 virtual void DoDrawSpline(wxList *points) = 0;
64698f9a 592#endif
a23fd0e1
VZ
593
594protected:
595 // flags
596 bool m_colour:1;
597 bool m_ok:1;
598 bool m_clipping:1;
599 bool m_isInteractive:1;
f6bcfd97 600 bool m_isBBoxValid:1;
a23fd0e1
VZ
601
602 // coordinate system variables
603
604 // TODO short descriptions of what exactly they are would be nice...
605
72cdf4c9
VZ
606 wxCoord m_logicalOriginX, m_logicalOriginY;
607 wxCoord m_deviceOriginX, m_deviceOriginY;
a23fd0e1
VZ
608
609 double m_logicalScaleX, m_logicalScaleY;
610 double m_userScaleX, m_userScaleY;
611 double m_scaleX, m_scaleY;
612
613 // Used by SetAxisOrientation() to invert the axes
614 int m_signX, m_signY;
615
616 // bounding and clipping boxes
72cdf4c9
VZ
617 wxCoord m_minX, m_minY, m_maxX, m_maxY;
618 wxCoord m_clipX1, m_clipY1, m_clipX2, m_clipY2;
a23fd0e1
VZ
619
620 int m_logicalFunction;
621 int m_backgroundMode;
622 int m_mappingMode;
623
624 // GDI objects
625 wxPen m_pen;
626 wxBrush m_brush;
627 wxBrush m_backgroundBrush;
628 wxColour m_textForegroundColour;
629 wxColour m_textBackgroundColour;
630 wxFont m_font;
631 wxPalette m_palette;
632
633private:
634 DECLARE_NO_COPY_CLASS(wxDCBase);
cd9da200 635 DECLARE_ABSTRACT_CLASS(wxDCBase)
a23fd0e1
VZ
636};
637
638// ----------------------------------------------------------------------------
639// now include the declaration of wxDC class
640// ----------------------------------------------------------------------------
641
2049ba38 642#if defined(__WXMSW__)
a23fd0e1 643 #include "wx/msw/dc.h"
2049ba38 644#elif defined(__WXMOTIF__)
a23fd0e1 645 #include "wx/motif/dc.h"
2049ba38 646#elif defined(__WXGTK__)
a23fd0e1 647 #include "wx/gtk/dc.h"
b4e76e0d 648#elif defined(__WXQT__)
a23fd0e1 649 #include "wx/qt/dc.h"
34138703 650#elif defined(__WXMAC__)
a23fd0e1 651 #include "wx/mac/dc.h"
1777b9bb
DW
652#elif defined(__WXPM__)
653 #include "wx/os2/dc.h"
34138703 654#elif defined(__WXSTUBS__)
a23fd0e1 655 #include "wx/stubs/dc.h"
c801d85f
KB
656#endif
657
658#endif
34138703 659 // _WX_DC_H_BASE_