]> git.saurik.com Git - wxWidgets.git/blob - include/wx/dc.h
added wxGLCanvas::IsDisplaySupported() (patch 1879906)
[wxWidgets.git] / include / wx / dc.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/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) wxWidgets team
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_DC_H_BASE_
13 #define _WX_DC_H_BASE_
14
15 // ----------------------------------------------------------------------------
16 // headers which we must include here
17 // ----------------------------------------------------------------------------
18
19 #include "wx/object.h" // the base class
20
21 #include "wx/intl.h" // for wxLayoutDirection
22 #include "wx/cursor.h" // we have member variables of these classes
23 #include "wx/font.h" // so we can't do without them
24 #include "wx/colour.h"
25 #include "wx/bitmap.h" // for wxNullBitmap
26 #include "wx/brush.h"
27 #include "wx/pen.h"
28 #include "wx/palette.h"
29 #include "wx/dynarray.h"
30 #include "wx/math.h"
31 #include "wx/image.h"
32 #include "wx/cmndata.h"
33
34 #define wxUSE_NEW_DC 1
35
36 class WXDLLIMPEXP_FWD_CORE wxDC;
37 class WXDLLIMPEXP_FWD_CORE wxClientDC;
38 class WXDLLIMPEXP_FWD_CORE wxPaintDC;
39 class WXDLLIMPEXP_FWD_CORE wxWindowDC;
40 class WXDLLIMPEXP_FWD_CORE wxScreenDC;
41 class WXDLLIMPEXP_FWD_CORE wxMemoryDC;
42 class WXDLLIMPEXP_FWD_CORE wxPrinterDC;
43 class WXDLLIMPEXP_FWD_CORE wxPrintData;
44
45 //-----------------------------------------------------------------------------
46 // wxDrawObject helper class
47 //-----------------------------------------------------------------------------
48
49 class WXDLLEXPORT wxDrawObject
50 {
51 public:
52
53 wxDrawObject()
54 : m_isBBoxValid(false)
55 , m_minX(0), m_minY(0), m_maxX(0), m_maxY(0)
56 { }
57
58 virtual ~wxDrawObject() { }
59
60 virtual void Draw(wxDC&) const { }
61
62 virtual void CalcBoundingBox(wxCoord x, wxCoord y)
63 {
64 if ( m_isBBoxValid )
65 {
66 if ( x < m_minX ) m_minX = x;
67 if ( y < m_minY ) m_minY = y;
68 if ( x > m_maxX ) m_maxX = x;
69 if ( y > m_maxY ) m_maxY = y;
70 }
71 else
72 {
73 m_isBBoxValid = true;
74
75 m_minX = x;
76 m_minY = y;
77 m_maxX = x;
78 m_maxY = y;
79 }
80 }
81
82 void ResetBoundingBox()
83 {
84 m_isBBoxValid = false;
85
86 m_minX = m_maxX = m_minY = m_maxY = 0;
87 }
88
89 // Get the final bounding box of the PostScript or Metafile picture.
90
91 wxCoord MinX() const { return m_minX; }
92 wxCoord MaxX() const { return m_maxX; }
93 wxCoord MinY() const { return m_minY; }
94 wxCoord MaxY() const { return m_maxY; }
95
96 //to define the type of object for derived objects
97 virtual int GetType()=0;
98
99 protected:
100 //for boundingbox calculation
101 bool m_isBBoxValid:1;
102 //for boundingbox calculation
103 wxCoord m_minX, m_minY, m_maxX, m_maxY;
104 };
105
106
107 //-----------------------------------------------------------------------------
108 // wxDCFactory
109 //-----------------------------------------------------------------------------
110
111 class WXDLLIMPEXP_FWD_CORE wxDCImpl;
112
113 class WXDLLIMPEXP_CORE wxDCFactory
114 {
115 public:
116 wxDCFactory() {}
117 virtual ~wxDCFactory() {}
118
119 virtual wxDCImpl* CreateWindowDC( wxWindowDC *owner ) = 0;
120 virtual wxDCImpl* CreateWindowDC( wxWindowDC *owner, wxWindow *window ) = 0;
121 virtual wxDCImpl* CreateClientDC( wxClientDC *owner ) = 0;
122 virtual wxDCImpl* CreateClientDC( wxClientDC *owner, wxWindow *window ) = 0;
123 virtual wxDCImpl* CreatePaintDC( wxPaintDC *owner ) = 0;
124 virtual wxDCImpl* CreatePaintDC( wxPaintDC *owner, wxWindow *window ) = 0;
125 virtual wxDCImpl* CreateMemoryDC( wxMemoryDC *owner ) = 0;
126 virtual wxDCImpl* CreateMemoryDC( wxMemoryDC *owner, wxBitmap &bitmap ) = 0;
127 virtual wxDCImpl* CreateMemoryDC( wxMemoryDC *owner, wxDC *dc ) = 0;
128 virtual wxDCImpl* CreateScreenDC( wxScreenDC *owner ) = 0;
129 #if wxUSE_PRINTING_ARCHITECTURE
130 virtual wxDCImpl* CreatePrinterDC( wxPrinterDC *owner, const wxPrintData &data ) = 0;
131 #endif
132
133 static void Set(wxDCFactory *factory);
134 static wxDCFactory *Get();
135
136 private:
137 static wxDCFactory *m_factory;
138 };
139
140 //-----------------------------------------------------------------------------
141 // wxNativeDCFactory
142 //-----------------------------------------------------------------------------
143
144 class WXDLLIMPEXP_CORE wxNativeDCFactory: public wxDCFactory
145 {
146 public:
147 wxNativeDCFactory() {}
148
149 virtual wxDCImpl* CreateWindowDC( wxWindowDC *owner );
150 virtual wxDCImpl* CreateWindowDC( wxWindowDC *owner, wxWindow *window );
151 virtual wxDCImpl* CreateClientDC( wxClientDC *owner );
152 virtual wxDCImpl* CreateClientDC( wxClientDC *owner, wxWindow *window );
153 virtual wxDCImpl* CreatePaintDC( wxPaintDC *owner );
154 virtual wxDCImpl* CreatePaintDC( wxPaintDC *owner, wxWindow *window );
155 virtual wxDCImpl* CreateMemoryDC( wxMemoryDC *owner );
156 virtual wxDCImpl* CreateMemoryDC( wxMemoryDC *owner, wxBitmap &bitmap );
157 virtual wxDCImpl* CreateMemoryDC( wxMemoryDC *owner, wxDC *dc );
158 virtual wxDCImpl* CreateScreenDC( wxScreenDC *owner );
159 #if wxUSE_PRINTING_ARCHITECTURE
160 virtual wxDCImpl* CreatePrinterDC( wxPrinterDC *owner, const wxPrintData &data );
161 #endif
162 };
163
164 //-----------------------------------------------------------------------------
165 // wxDCImpl
166 //-----------------------------------------------------------------------------
167
168 class WXDLLIMPEXP_CORE wxDCImpl: public wxObject
169 {
170 public:
171 wxDCImpl( wxDC *owner );
172 ~wxDCImpl();
173
174 wxDC *GetOwner() const { return m_owner; }
175
176 wxWindow* GetWindow() const { return m_window; }
177
178 virtual bool IsOk() const { return m_ok; }
179
180 // query capabilities
181
182 virtual bool CanDrawBitmap() const = 0;
183 virtual bool CanGetTextExtent() const = 0;
184
185 // query dimension, colour deps, resolution
186
187 virtual void DoGetSize(int *width, int *height) const = 0;
188 void GetSize(int *width, int *height) const
189 {
190 DoGetSize(width, height);
191 return ;
192 }
193
194 wxSize GetSize() const
195 {
196 int w, h;
197 DoGetSize(&w, &h);
198 return wxSize(w, h);
199 }
200
201 virtual void DoGetSizeMM(int* width, int* height) const = 0;
202
203 virtual int GetDepth() const = 0;
204 virtual wxSize GetPPI() const = 0;
205
206 // Right-To-Left (RTL) modes
207
208 virtual void SetLayoutDirection(wxLayoutDirection WXUNUSED(dir)) { }
209 virtual wxLayoutDirection GetLayoutDirection() const { return wxLayout_Default; }
210
211 // page and document
212
213 virtual bool StartDoc(const wxString& WXUNUSED(message)) { return true; }
214 virtual void EndDoc() { }
215
216 virtual void StartPage() { }
217 virtual void EndPage() { }
218
219 // flushing the content of this dc immediately eg onto screen
220 virtual void Flush() { }
221
222 // bounding box
223
224 virtual void CalcBoundingBox(wxCoord x, wxCoord y)
225 {
226 if ( m_isBBoxValid )
227 {
228 if ( x < m_minX ) m_minX = x;
229 if ( y < m_minY ) m_minY = y;
230 if ( x > m_maxX ) m_maxX = x;
231 if ( y > m_maxY ) m_maxY = y;
232 }
233 else
234 {
235 m_isBBoxValid = true;
236
237 m_minX = x;
238 m_minY = y;
239 m_maxX = x;
240 m_maxY = y;
241 }
242 }
243 void ResetBoundingBox()
244 {
245 m_isBBoxValid = false;
246
247 m_minX = m_maxX = m_minY = m_maxY = 0;
248 }
249
250 wxCoord MinX() const { return m_minX; }
251 wxCoord MaxX() const { return m_maxX; }
252 wxCoord MinY() const { return m_minY; }
253 wxCoord MaxY() const { return m_maxY; }
254
255 // setters and getters
256
257 virtual void SetFont(const wxFont& font) = 0;
258 virtual const wxFont& GetFont() const { return m_font; }
259
260 virtual void SetPen(const wxPen& pen) = 0;
261 virtual const wxPen& GetPen() const { return m_pen; }
262
263 virtual void SetBrush(const wxBrush& brush) = 0;
264 virtual const wxBrush& GetBrush() const { return m_brush; }
265
266 virtual void SetBackground(const wxBrush& brush) = 0;
267 virtual const wxBrush& GetBackground() const { return m_backgroundBrush; }
268
269 virtual void SetBackgroundMode(int mode) = 0;
270 virtual int GetBackgroundMode() const { return m_backgroundMode; }
271
272 virtual void SetTextForeground(const wxColour& colour)
273 { m_textForegroundColour = colour; }
274 virtual const wxColour& GetTextForeground() const { return m_textForegroundColour; }
275
276 virtual void SetTextBackground(const wxColour& colour)
277 { m_textBackgroundColour = colour; }
278 virtual const wxColour& GetTextBackground() const { return m_textBackgroundColour; }
279
280 #if wxUSE_PALETTE
281 virtual void SetPalette(const wxPalette& palette) = 0;
282 #endif // wxUSE_PALETTE
283
284 // logical functions
285
286 virtual void SetLogicalFunction(int function) = 0;
287 virtual int GetLogicalFunction() const { return m_logicalFunction; }
288
289 // text measurement
290
291 virtual wxCoord GetCharHeight() const = 0;
292 virtual wxCoord GetCharWidth() const = 0;
293 virtual void DoGetTextExtent(const wxString& string,
294 wxCoord *x, wxCoord *y,
295 wxCoord *descent = NULL,
296 wxCoord *externalLeading = NULL,
297 const wxFont *theFont = NULL) const = 0;
298 virtual void GetMultiLineTextExtent(const wxString& string,
299 wxCoord *width,
300 wxCoord *height,
301 wxCoord *heightLine = NULL,
302 const wxFont *font = NULL) const;
303 virtual bool DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths) const;
304
305 // clearing
306
307 virtual void Clear() = 0;
308
309 // clipping
310
311 virtual void DoSetClippingRegion(wxCoord x, wxCoord y,
312 wxCoord width, wxCoord height) = 0;
313 virtual void DoSetClippingRegionAsRegion(const wxRegion& region) = 0;
314
315 virtual void DoGetClippingBox(wxCoord *x, wxCoord *y,
316 wxCoord *w, wxCoord *h) const
317 {
318 if ( x )
319 *x = m_clipX1;
320 if ( y )
321 *y = m_clipY1;
322 if ( w )
323 *w = m_clipX2 - m_clipX1;
324 if ( h )
325 *h = m_clipY2 - m_clipY1;
326 }
327
328 virtual void DestroyClippingRegion() { ResetClipping(); }
329
330
331 // coordinates conversions and transforms
332
333 virtual wxCoord DeviceToLogicalX(wxCoord x) const;
334 virtual wxCoord DeviceToLogicalY(wxCoord y) const;
335 virtual wxCoord DeviceToLogicalXRel(wxCoord x) const;
336 virtual wxCoord DeviceToLogicalYRel(wxCoord y) const;
337 virtual wxCoord LogicalToDeviceX(wxCoord x) const;
338 virtual wxCoord LogicalToDeviceY(wxCoord y) const;
339 virtual wxCoord LogicalToDeviceXRel(wxCoord x) const;
340 virtual wxCoord LogicalToDeviceYRel(wxCoord y) const;
341
342 virtual void SetMapMode(int mode);
343 virtual int GetMapMode() const { return m_mappingMode; }
344
345 virtual void SetUserScale(double x, double y);
346 virtual void GetUserScale(double *x, double *y) const
347 {
348 if ( x ) *x = m_userScaleX;
349 if ( y ) *y = m_userScaleY;
350 }
351
352 virtual void SetLogicalScale(double x, double y);
353 virtual void GetLogicalScale(double *x, double *y)
354 {
355 if ( x ) *x = m_logicalScaleX;
356 if ( y ) *y = m_logicalScaleY;
357 }
358
359 virtual void SetLogicalOrigin(wxCoord x, wxCoord y);
360 virtual void DoGetLogicalOrigin(wxCoord *x, wxCoord *y) const
361 {
362 if ( x ) *x = m_logicalOriginX;
363 if ( y ) *y = m_logicalOriginY;
364 }
365
366 virtual void SetDeviceOrigin(wxCoord x, wxCoord y);
367 virtual void DoGetDeviceOrigin(wxCoord *x, wxCoord *y) const
368 {
369 if ( x ) *x = m_deviceOriginX;
370 if ( y ) *y = m_deviceOriginY;
371 }
372
373 virtual void SetDeviceLocalOrigin( wxCoord x, wxCoord y );
374
375 virtual void ComputeScaleAndOrigin();
376
377 // this needs to overidden if the axis is inverted
378 virtual void SetAxisOrientation(bool xLeftRight, bool yBottomUp);
379
380 // ---------------------------------------------------------
381 // the actual drawing API
382
383 virtual bool DoFloodFill(wxCoord x, wxCoord y, const wxColour& col,
384 int style = wxFLOOD_SURFACE) = 0;
385
386 virtual void DoGradientFillLinear(const wxRect& rect,
387 const wxColour& initialColour,
388 const wxColour& destColour,
389 wxDirection nDirection = wxEAST);
390
391 virtual void DoGradientFillConcentric(const wxRect& rect,
392 const wxColour& initialColour,
393 const wxColour& destColour,
394 const wxPoint& circleCenter);
395
396 virtual bool DoGetPixel(wxCoord x, wxCoord y, wxColour *col) const = 0;
397
398 virtual void DoDrawPoint(wxCoord x, wxCoord y) = 0;
399 virtual void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2) = 0;
400
401 virtual void DoDrawArc(wxCoord x1, wxCoord y1,
402 wxCoord x2, wxCoord y2,
403 wxCoord xc, wxCoord yc) = 0;
404 virtual void DoDrawCheckMark(wxCoord x, wxCoord y,
405 wxCoord width, wxCoord height);
406 virtual void DoDrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h,
407 double sa, double ea) = 0;
408
409 virtual void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height) = 0;
410 virtual void DoDrawRoundedRectangle(wxCoord x, wxCoord y,
411 wxCoord width, wxCoord height,
412 double radius) = 0;
413 virtual void DoDrawEllipse(wxCoord x, wxCoord y,
414 wxCoord width, wxCoord height) = 0;
415
416 virtual void DoCrossHair(wxCoord x, wxCoord y) = 0;
417
418 virtual void DoDrawIcon(const wxIcon& icon, wxCoord x, wxCoord y) = 0;
419 virtual void DoDrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y,
420 bool useMask = false) = 0;
421
422 virtual void DoDrawText(const wxString& text, wxCoord x, wxCoord y) = 0;
423 virtual void DoDrawRotatedText(const wxString& text,
424 wxCoord x, wxCoord y, double angle) = 0;
425
426 virtual bool DoBlit(wxCoord xdest, wxCoord ydest,
427 wxCoord width, wxCoord height,
428 wxDC *source,
429 wxCoord xsrc, wxCoord ysrc,
430 int rop = wxCOPY,
431 bool useMask = false,
432 wxCoord xsrcMask = wxDefaultCoord,
433 wxCoord ysrcMask = wxDefaultCoord) = 0;
434
435 virtual bool DoStretchBlit(wxCoord xdest, wxCoord ydest,
436 wxCoord dstWidth, wxCoord dstHeight,
437 wxDC *source,
438 wxCoord xsrc, wxCoord ysrc,
439 wxCoord srcWidth, wxCoord srcHeight,
440 int rop = wxCOPY,
441 bool useMask = false,
442 wxCoord xsrcMask = wxDefaultCoord,
443 wxCoord ysrcMask = wxDefaultCoord);
444
445 virtual wxBitmap DoGetAsBitmap(const wxRect *WXUNUSED(subrect)) const
446 { return wxNullBitmap; }
447
448
449 virtual void DoDrawLines(int n, wxPoint points[],
450 wxCoord xoffset, wxCoord yoffset ) = 0;
451 virtual void DrawLines(const wxPointList *list,
452 wxCoord xoffset, wxCoord yoffset );
453
454 virtual void DoDrawPolygon(int n, wxPoint points[],
455 wxCoord xoffset, wxCoord yoffset,
456 int fillStyle = wxODDEVEN_RULE) = 0;
457 virtual void DoDrawPolyPolygon(int n, int count[], wxPoint points[],
458 wxCoord xoffset, wxCoord yoffset,
459 int fillStyle);
460 void DrawPolygon(const wxPointList *list,
461 wxCoord xoffset, wxCoord yoffset,
462 int fillStyle );
463
464
465 #if wxUSE_SPLINES
466 virtual void DoDrawSpline(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2, wxCoord x3, wxCoord y3);
467 virtual void DoDrawSpline(int n, wxPoint points[]);
468 virtual void DoDrawSpline(const wxPointList *points);
469 #endif
470
471 // ---------------------------------------------------------
472 // wxMemoryDC Impl API
473
474 virtual void DoSelect(const wxBitmap& WXUNUSED(bmp))
475 { }
476
477 virtual const wxBitmap& GetSelectedBitmap() const
478 { return wxNullBitmap; }
479 virtual wxBitmap& GetSelectedBitmap()
480 { return wxNullBitmap; }
481
482 // ---------------------------------------------------------
483 // wxPrinterDC Impl API
484
485 virtual wxRect GetPaperRect()
486 { int w = 0; int h = 0; DoGetSize( &w, &h ); return wxRect(0,0,w,h); }
487
488 virtual int GetResolution()
489 { return -1; }
490
491 private:
492 wxDC *m_owner;
493
494 protected:
495 // unset clipping variables (after clipping region was destroyed)
496 void ResetClipping()
497 {
498 m_clipping = false;
499
500 m_clipX1 = m_clipX2 = m_clipY1 = m_clipY2 = 0;
501 }
502
503 // window on which the DC draws or NULL
504 wxWindow *m_window;
505
506 // flags
507 bool m_colour:1;
508 bool m_ok:1;
509 bool m_clipping:1;
510 bool m_isInteractive:1;
511 bool m_isBBoxValid:1;
512
513 // coordinate system variables
514
515 wxCoord m_logicalOriginX, m_logicalOriginY;
516 wxCoord m_deviceOriginX, m_deviceOriginY; // Usually 0,0, can be change by user
517
518 wxCoord m_deviceLocalOriginX, m_deviceLocalOriginY; // non-zero if native top-left corner
519 // is not at 0,0. This was the case under
520 // Mac's GrafPorts (coordinate system
521 // used toplevel window's origin) and
522 // e.g. for Postscript, where the native
523 // origin in the bottom left corner.
524 double m_logicalScaleX, m_logicalScaleY;
525 double m_userScaleX, m_userScaleY;
526 double m_scaleX, m_scaleY; // calculated from logical scale and user scale
527
528 int m_signX, m_signY; // Used by SetAxisOrientation() to invert the axes
529
530 // what is a mm on a screen you don't know the size of?
531 double m_mm_to_pix_x,
532 m_mm_to_pix_y;
533
534 // bounding and clipping boxes
535 wxCoord m_minX, m_minY, m_maxX, m_maxY;
536 wxCoord m_clipX1, m_clipY1, m_clipX2, m_clipY2;
537
538 int m_logicalFunction;
539 int m_backgroundMode;
540 int m_mappingMode;
541
542 wxPen m_pen;
543 wxBrush m_brush;
544 wxBrush m_backgroundBrush;
545 wxColour m_textForegroundColour;
546 wxColour m_textBackgroundColour;
547 wxFont m_font;
548
549 #if wxUSE_PALETTE
550 wxPalette m_palette;
551 bool m_hasCustomPalette;
552 #endif // wxUSE_PALETTE
553
554 private:
555 DECLARE_ABSTRACT_CLASS(wxDCImpl)
556 };
557
558
559 class WXDLLIMPEXP_CORE wxDC : public wxObject
560 {
561 public:
562 virtual ~wxDC() { delete m_pimpl; }
563
564 wxDCImpl *GetImpl()
565 { return m_pimpl; }
566 const wxDCImpl *GetImpl() const
567 { return m_pimpl; }
568
569 wxWindow *GetWindow() const
570 { return m_pimpl->GetWindow(); }
571
572 bool IsOk() const
573 { return m_pimpl && m_pimpl->IsOk(); }
574
575 // query capabilities
576
577 bool CanDrawBitmap() const
578 { return m_pimpl->CanDrawBitmap(); }
579 bool CanGetTextExtent() const
580 { return m_pimpl->CanGetTextExtent(); }
581
582 // query dimension, colour deps, resolution
583
584 void GetSize(int *width, int *height) const
585 { m_pimpl->DoGetSize(width, height); }
586 wxSize GetSize() const
587 { return m_pimpl->GetSize(); }
588
589 void GetSizeMM(int* width, int* height) const
590 { m_pimpl->DoGetSizeMM(width, height); }
591 wxSize GetSizeMM() const
592 {
593 int w, h;
594 m_pimpl->DoGetSizeMM(&w, &h);
595 return wxSize(w, h);
596 }
597
598 int GetDepth() const
599 { return m_pimpl->GetDepth(); }
600 wxSize GetPPI() const
601 { return m_pimpl->GetPPI(); }
602
603 virtual int GetResolution()
604 { return m_pimpl->GetResolution(); }
605
606 // Right-To-Left (RTL) modes
607
608 void SetLayoutDirection(wxLayoutDirection dir)
609 { m_pimpl->SetLayoutDirection( dir ); }
610 wxLayoutDirection GetLayoutDirection() const
611 { return m_pimpl->GetLayoutDirection(); }
612
613 // page and document
614
615 bool StartDoc(const wxString& message)
616 { return m_pimpl->StartDoc(message); }
617 void EndDoc()
618 { m_pimpl->EndDoc(); }
619
620 void StartPage()
621 { m_pimpl->StartPage(); }
622 void EndPage()
623 { m_pimpl->EndPage(); }
624
625 // bounding box
626
627 void CalcBoundingBox(wxCoord x, wxCoord y)
628 { m_pimpl->CalcBoundingBox(x,y); }
629 void ResetBoundingBox()
630 { m_pimpl->ResetBoundingBox(); }
631
632 wxCoord MinX() const
633 { return m_pimpl->MinX(); }
634 wxCoord MaxX() const
635 { return m_pimpl->MaxX(); }
636 wxCoord MinY() const
637 { return m_pimpl->MinY(); }
638 wxCoord MaxY() const
639 { return m_pimpl->MaxY(); }
640
641 // setters and getters
642
643 void SetFont(const wxFont& font)
644 { m_pimpl->SetFont( font ); }
645 const wxFont& GetFont() const
646 { return m_pimpl->GetFont(); }
647
648 void SetPen(const wxPen& pen)
649 { m_pimpl->SetPen( pen ); }
650 const wxPen& GetPen() const
651 { return m_pimpl->GetPen(); }
652
653 void SetBrush(const wxBrush& brush)
654 { m_pimpl->SetBrush( brush ); }
655 const wxBrush& GetBrush() const
656 { return m_pimpl->GetBrush(); }
657
658 void SetBackground(const wxBrush& brush)
659 { m_pimpl->SetBackground( brush ); }
660 const wxBrush& GetBackground() const
661 { return m_pimpl->GetBackground(); }
662
663 void SetBackgroundMode(int mode)
664 { m_pimpl->SetBackgroundMode( mode ); }
665 int GetBackgroundMode() const
666 { return m_pimpl->GetBackgroundMode(); }
667
668 void SetTextForeground(const wxColour& colour)
669 { m_pimpl->SetTextForeground(colour); }
670 const wxColour& GetTextForeground() const
671 { return m_pimpl->GetTextForeground(); }
672
673 void SetTextBackground(const wxColour& colour)
674 { m_pimpl->SetTextBackground(colour); }
675 const wxColour& GetTextBackground() const
676 { return m_pimpl->GetTextBackground(); }
677
678 #if wxUSE_PALETTE
679 void SetPalette(const wxPalette& palette)
680 { m_pimpl->SetPalette(palette); }
681 #endif // wxUSE_PALETTE
682
683 // logical functions
684
685 void SetLogicalFunction(int function)
686 { m_pimpl->SetLogicalFunction(function); }
687 int GetLogicalFunction() const
688 { return m_pimpl->GetLogicalFunction(); }
689
690 // text measurement
691
692 wxCoord GetCharHeight() const
693 { return m_pimpl->GetCharHeight(); }
694 wxCoord GetCharWidth() const
695 { return m_pimpl->GetCharWidth(); }
696
697 void GetTextExtent(const wxString& string,
698 wxCoord *x, wxCoord *y,
699 wxCoord *descent = NULL,
700 wxCoord *externalLeading = NULL,
701 const wxFont *theFont = NULL) const
702 { m_pimpl->DoGetTextExtent(string, x, y, descent, externalLeading, theFont); }
703
704 wxSize GetTextExtent(const wxString& string) const
705 {
706 wxCoord w, h;
707 m_pimpl->DoGetTextExtent(string, &w, &h);
708 return wxSize(w, h);
709 }
710
711 void GetMultiLineTextExtent(const wxString& string,
712 wxCoord *width,
713 wxCoord *height,
714 wxCoord *heightLine = NULL,
715 const wxFont *font = NULL) const
716 { m_pimpl->GetMultiLineTextExtent( string, width, height, heightLine, font ); }
717
718 wxSize GetMultiLineTextExtent(const wxString& string) const
719 {
720 wxCoord w, h;
721 m_pimpl->GetMultiLineTextExtent(string, &w, &h);
722 return wxSize(w, h);
723 }
724
725 bool GetPartialTextExtents(const wxString& text, wxArrayInt& widths) const
726 { return m_pimpl->DoGetPartialTextExtents(text, widths); }
727
728 // clearing
729
730 void Clear()
731 { m_pimpl->Clear(); }
732
733 // clipping
734
735 void SetClippingRegion(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
736 { m_pimpl->DoSetClippingRegion(x, y, width, height); }
737 void SetClippingRegion(const wxPoint& pt, const wxSize& sz)
738 { m_pimpl->DoSetClippingRegion(pt.x, pt.y, sz.x, sz.y); }
739 void SetClippingRegion(const wxRect& rect)
740 { m_pimpl->DoSetClippingRegion(rect.x, rect.y, rect.width, rect.height); }
741 void SetClippingRegion(const wxRegion& region)
742 { m_pimpl->DoSetClippingRegionAsRegion(region); }
743
744 void DestroyClippingRegion()
745 { m_pimpl->DestroyClippingRegion(); }
746
747 void GetClippingBox(wxCoord *x, wxCoord *y, wxCoord *w, wxCoord *h) const
748 { m_pimpl->DoGetClippingBox(x, y, w, h); }
749 void GetClippingBox(wxRect& rect) const
750 { m_pimpl->DoGetClippingBox(&rect.x, &rect.y, &rect.width, &rect.height); }
751
752 // coordinates conversions and transforms
753
754 wxCoord DeviceToLogicalX(wxCoord x) const
755 { return m_pimpl->DeviceToLogicalX(x); }
756 wxCoord DeviceToLogicalY(wxCoord y) const
757 { return m_pimpl->DeviceToLogicalY(y); }
758 wxCoord DeviceToLogicalXRel(wxCoord x) const
759 { return m_pimpl->DeviceToLogicalXRel(x); }
760 wxCoord DeviceToLogicalYRel(wxCoord y) const
761 { return m_pimpl->DeviceToLogicalYRel(y); }
762 wxCoord LogicalToDeviceX(wxCoord x) const
763 { return m_pimpl->LogicalToDeviceX(x); }
764 wxCoord LogicalToDeviceY(wxCoord y) const
765 { return m_pimpl->LogicalToDeviceY(y); }
766 wxCoord LogicalToDeviceXRel(wxCoord x) const
767 { return m_pimpl->LogicalToDeviceXRel(x); }
768 wxCoord LogicalToDeviceYRel(wxCoord y) const
769 { return m_pimpl->LogicalToDeviceYRel(y); }
770
771 void SetMapMode(int mode)
772 { m_pimpl->SetMapMode(mode); }
773 int GetMapMode() const
774 { return m_pimpl->GetMapMode(); }
775
776 void SetUserScale(double x, double y)
777 { m_pimpl->SetUserScale(x,y); }
778 void GetUserScale(double *x, double *y) const
779 { m_pimpl->GetUserScale( x, y ); }
780
781 void SetLogicalScale(double x, double y)
782 { m_pimpl->SetLogicalScale( x, y ); }
783 void GetLogicalScale(double *x, double *y)
784 { m_pimpl->GetLogicalScale( x, y ); }
785
786 void SetLogicalOrigin(wxCoord x, wxCoord y)
787 { m_pimpl->SetLogicalOrigin(x,y); }
788 void GetLogicalOrigin(wxCoord *x, wxCoord *y) const
789 { m_pimpl->DoGetLogicalOrigin(x, y); }
790 wxPoint GetLogicalOrigin() const
791 { wxCoord x, y; m_pimpl->DoGetLogicalOrigin(&x, &y); return wxPoint(x, y); }
792
793 void SetDeviceOrigin(wxCoord x, wxCoord y)
794 { m_pimpl->SetDeviceOrigin( x, y); }
795 void GetDeviceOrigin(wxCoord *x, wxCoord *y) const
796 { m_pimpl->DoGetDeviceOrigin(x, y); }
797 wxPoint GetDeviceOrigin() const
798 { wxCoord x, y; m_pimpl->DoGetDeviceOrigin(&x, &y); return wxPoint(x, y); }
799
800 void SetAxisOrientation(bool xLeftRight, bool yBottomUp)
801 { m_pimpl->SetAxisOrientation(xLeftRight, yBottomUp); }
802
803 // mostly internal
804 void SetDeviceLocalOrigin( wxCoord x, wxCoord y )
805 { m_pimpl->SetDeviceLocalOrigin( x, y ); }
806
807
808 // draw generic object
809
810 void DrawObject(wxDrawObject* drawobject)
811 {
812 drawobject->Draw(*this);
813 CalcBoundingBox(drawobject->MinX(),drawobject->MinY());
814 CalcBoundingBox(drawobject->MaxX(),drawobject->MaxY());
815 }
816
817 // -----------------------------------------------
818 // the actual drawing API
819
820 bool FloodFill(wxCoord x, wxCoord y, const wxColour& col,
821 int style = wxFLOOD_SURFACE)
822 { return m_pimpl->DoFloodFill(x, y, col, style); }
823 bool FloodFill(const wxPoint& pt, const wxColour& col,
824 int style = wxFLOOD_SURFACE)
825 { return m_pimpl->DoFloodFill(pt.x, pt.y, col, style); }
826
827 // fill the area specified by rect with a radial gradient, starting from
828 // initialColour in the centre of the cercle and fading to destColour.
829 void GradientFillConcentric(const wxRect& rect,
830 const wxColour& initialColour,
831 const wxColour& destColour)
832 { m_pimpl->DoGradientFillConcentric( rect, initialColour, destColour,
833 wxPoint(rect.GetWidth() / 2,
834 rect.GetHeight() / 2)); }
835
836 void GradientFillConcentric(const wxRect& rect,
837 const wxColour& initialColour,
838 const wxColour& destColour,
839 const wxPoint& circleCenter)
840 { m_pimpl->DoGradientFillConcentric(rect, initialColour, destColour, circleCenter); }
841
842 // fill the area specified by rect with a linear gradient
843 void GradientFillLinear(const wxRect& rect,
844 const wxColour& initialColour,
845 const wxColour& destColour,
846 wxDirection nDirection = wxEAST)
847 { m_pimpl->DoGradientFillLinear(rect, initialColour, destColour, nDirection); }
848
849 bool GetPixel(wxCoord x, wxCoord y, wxColour *col) const
850 { return m_pimpl->DoGetPixel(x, y, col); }
851 bool GetPixel(const wxPoint& pt, wxColour *col) const
852 { return m_pimpl->DoGetPixel(pt.x, pt.y, col); }
853
854 void DrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2)
855 { m_pimpl->DoDrawLine(x1, y1, x2, y2); }
856 void DrawLine(const wxPoint& pt1, const wxPoint& pt2)
857 { m_pimpl->DoDrawLine(pt1.x, pt1.y, pt2.x, pt2.y); }
858
859 void CrossHair(wxCoord x, wxCoord y)
860 { m_pimpl->DoCrossHair(x, y); }
861 void CrossHair(const wxPoint& pt)
862 { m_pimpl->DoCrossHair(pt.x, pt.y); }
863
864 void DrawArc(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2,
865 wxCoord xc, wxCoord yc)
866 { m_pimpl->DoDrawArc(x1, y1, x2, y2, xc, yc); }
867 void DrawArc(const wxPoint& pt1, const wxPoint& pt2, const wxPoint& centre)
868 { m_pimpl->DoDrawArc(pt1.x, pt1.y, pt2.x, pt2.y, centre.x, centre.y); }
869
870 void DrawCheckMark(wxCoord x, wxCoord y,
871 wxCoord width, wxCoord height)
872 { m_pimpl->DoDrawCheckMark(x, y, width, height); }
873 void DrawCheckMark(const wxRect& rect)
874 { m_pimpl->DoDrawCheckMark(rect.x, rect.y, rect.width, rect.height); }
875
876 void DrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h,
877 double sa, double ea)
878 { m_pimpl->DoDrawEllipticArc(x, y, w, h, sa, ea); }
879 void DrawEllipticArc(const wxPoint& pt, const wxSize& sz,
880 double sa, double ea)
881 { m_pimpl->DoDrawEllipticArc(pt.x, pt.y, sz.x, sz.y, sa, ea); }
882
883 void DrawPoint(wxCoord x, wxCoord y)
884 { m_pimpl->DoDrawPoint(x, y); }
885 void DrawPoint(const wxPoint& pt)
886 { m_pimpl->DoDrawPoint(pt.x, pt.y); }
887
888 void DrawLines(int n, wxPoint points[],
889 wxCoord xoffset = 0, wxCoord yoffset = 0)
890 { m_pimpl->DoDrawLines(n, points, xoffset, yoffset); }
891 void DrawLines(const wxPointList *list,
892 wxCoord xoffset = 0, wxCoord yoffset = 0)
893 { m_pimpl->DrawLines( list, xoffset, yoffset ); }
894 #if WXWIN_COMPATIBILITY_2_8
895 wxDEPRECATED( void DrawLines(const wxList *list,
896 wxCoord xoffset = 0, wxCoord yoffset = 0) );
897 #endif // WXWIN_COMPATIBILITY_2_8
898
899 void DrawPolygon(int n, wxPoint points[],
900 wxCoord xoffset = 0, wxCoord yoffset = 0,
901 int fillStyle = wxODDEVEN_RULE)
902 { m_pimpl->DoDrawPolygon(n, points, xoffset, yoffset, fillStyle); }
903 void DrawPolygon(const wxPointList *list,
904 wxCoord xoffset = 0, wxCoord yoffset = 0,
905 int fillStyle = wxODDEVEN_RULE)
906 { m_pimpl->DrawPolygon( list, xoffset, yoffset, fillStyle ); }
907 void DrawPolyPolygon(int n, int count[], wxPoint points[],
908 wxCoord xoffset = 0, wxCoord yoffset = 0,
909 int fillStyle = wxODDEVEN_RULE)
910 { m_pimpl->DoDrawPolyPolygon(n, count, points, xoffset, yoffset, fillStyle); }
911 #if WXWIN_COMPATIBILITY_2_8
912 wxDEPRECATED( void DrawPolygon(const wxList *list,
913 wxCoord xoffset = 0, wxCoord yoffset = 0,
914 int fillStyle = wxODDEVEN_RULE) );
915 #endif // WXWIN_COMPATIBILITY_2_8
916
917 void DrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
918 { m_pimpl->DoDrawRectangle(x, y, width, height); }
919 void DrawRectangle(const wxPoint& pt, const wxSize& sz)
920 { m_pimpl->DoDrawRectangle(pt.x, pt.y, sz.x, sz.y); }
921 void DrawRectangle(const wxRect& rect)
922 { m_pimpl->DoDrawRectangle(rect.x, rect.y, rect.width, rect.height); }
923
924 void DrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height,
925 double radius)
926 { m_pimpl->DoDrawRoundedRectangle(x, y, width, height, radius); }
927 void DrawRoundedRectangle(const wxPoint& pt, const wxSize& sz,
928 double radius)
929 { m_pimpl->DoDrawRoundedRectangle(pt.x, pt.y, sz.x, sz.y, radius); }
930 void DrawRoundedRectangle(const wxRect& r, double radius)
931 { m_pimpl->DoDrawRoundedRectangle(r.x, r.y, r.width, r.height, radius); }
932
933 void DrawCircle(wxCoord x, wxCoord y, wxCoord radius)
934 { m_pimpl->DoDrawEllipse(x - radius, y - radius, 2*radius, 2*radius); }
935 void DrawCircle(const wxPoint& pt, wxCoord radius)
936 { m_pimpl->DoDrawEllipse(pt.x - radius, pt.y - radius, 2*radius, 2*radius); }
937
938 void DrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
939 { m_pimpl->DoDrawEllipse(x, y, width, height); }
940 void DrawEllipse(const wxPoint& pt, const wxSize& sz)
941 { m_pimpl->DoDrawEllipse(pt.x, pt.y, sz.x, sz.y); }
942 void DrawEllipse(const wxRect& rect)
943 { m_pimpl->DoDrawEllipse(rect.x, rect.y, rect.width, rect.height); }
944
945 void DrawIcon(const wxIcon& icon, wxCoord x, wxCoord y)
946 { m_pimpl->DoDrawIcon(icon, x, y); }
947 void DrawIcon(const wxIcon& icon, const wxPoint& pt)
948 { m_pimpl->DoDrawIcon(icon, pt.x, pt.y); }
949
950 void DrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y,
951 bool useMask = false)
952 { m_pimpl->DoDrawBitmap(bmp, x, y, useMask); }
953 void DrawBitmap(const wxBitmap &bmp, const wxPoint& pt,
954 bool useMask = false)
955 { m_pimpl->DoDrawBitmap(bmp, pt.x, pt.y, useMask); }
956
957 void DrawText(const wxString& text, wxCoord x, wxCoord y)
958 { m_pimpl->DoDrawText(text, x, y); }
959 void DrawText(const wxString& text, const wxPoint& pt)
960 { m_pimpl->DoDrawText(text, pt.x, pt.y); }
961
962 void DrawRotatedText(const wxString& text, wxCoord x, wxCoord y, double angle)
963 { m_pimpl->DoDrawRotatedText(text, x, y, angle); }
964 void DrawRotatedText(const wxString& text, const wxPoint& pt, double angle)
965 { m_pimpl->DoDrawRotatedText(text, pt.x, pt.y, angle); }
966
967 // this version puts both optional bitmap and the text into the given
968 // rectangle and aligns is as specified by alignment parameter; it also
969 // will emphasize the character with the given index if it is != -1 and
970 // return the bounding rectangle if required
971 void DrawLabel(const wxString& text,
972 const wxBitmap& image,
973 const wxRect& rect,
974 int alignment = wxALIGN_LEFT | wxALIGN_TOP,
975 int indexAccel = -1,
976 wxRect *rectBounding = NULL);
977
978 void DrawLabel(const wxString& text, const wxRect& rect,
979 int alignment = wxALIGN_LEFT | wxALIGN_TOP,
980 int indexAccel = -1)
981 { DrawLabel(text, wxNullBitmap, rect, alignment, indexAccel); }
982
983 bool Blit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
984 wxDC *source, wxCoord xsrc, wxCoord ysrc,
985 int rop = wxCOPY, bool useMask = false, wxCoord xsrcMask = wxDefaultCoord, wxCoord ysrcMask = wxDefaultCoord)
986 {
987 return m_pimpl->DoBlit(xdest, ydest, width, height,
988 source, xsrc, ysrc, rop, useMask, xsrcMask, ysrcMask);
989 }
990 bool Blit(const wxPoint& destPt, const wxSize& sz,
991 wxDC *source, const wxPoint& srcPt,
992 int rop = wxCOPY, bool useMask = false, const wxPoint& srcPtMask = wxDefaultPosition)
993 {
994 return m_pimpl->DoBlit(destPt.x, destPt.y, sz.x, sz.y,
995 source, srcPt.x, srcPt.y, rop, useMask, srcPtMask.x, srcPtMask.y);
996 }
997
998 bool StretchBlit(wxCoord dstX, wxCoord dstY,
999 wxCoord dstWidth, wxCoord dstHeight,
1000 wxDC *source,
1001 wxCoord srcX, wxCoord srcY,
1002 wxCoord srcWidth, wxCoord srcHeight,
1003 int rop = wxCOPY, bool useMask = false,
1004 wxCoord srcMaskX = wxDefaultCoord, wxCoord srcMaskY = wxDefaultCoord)
1005 {
1006 return m_pimpl->DoStretchBlit(dstX, dstY, dstWidth, dstHeight,
1007 source, srcX, srcY, srcWidth, srcHeight, rop, useMask, srcMaskX, srcMaskY);
1008 }
1009 bool StretchBlit(const wxPoint& dstPt, const wxSize& dstSize,
1010 wxDC *source, const wxPoint& srcPt, const wxSize& srcSize,
1011 int rop = wxCOPY, bool useMask = false, const wxPoint& srcMaskPt = wxDefaultPosition)
1012 {
1013 return m_pimpl->DoStretchBlit(dstPt.x, dstPt.y, dstSize.x, dstSize.y,
1014 source, srcPt.x, srcPt.y, srcSize.x, srcSize.y, rop, useMask, srcMaskPt.x, srcMaskPt.y);
1015 }
1016
1017 wxBitmap GetAsBitmap(const wxRect *subrect = (const wxRect *) NULL) const
1018 {
1019 return m_pimpl->DoGetAsBitmap(subrect);
1020 }
1021
1022 #if wxUSE_SPLINES
1023 void DrawSpline(wxCoord x1, wxCoord y1,
1024 wxCoord x2, wxCoord y2,
1025 wxCoord x3, wxCoord y3)
1026 { m_pimpl->DoDrawSpline(x1,y1,x2,y2,x3,y3); }
1027 void DrawSpline(int n, wxPoint points[])
1028 { m_pimpl->DoDrawSpline(n,points); }
1029 void DrawSpline(const wxPointList *points)
1030 { m_pimpl->DoDrawSpline(points); }
1031 #endif // wxUSE_SPLINES
1032
1033
1034 #if WXWIN_COMPATIBILITY_2_8
1035 // for compatibility with the old code when wxCoord was long everywhere
1036 wxDEPRECATED( void GetTextExtent(const wxString& string,
1037 long *x, long *y,
1038 long *descent = NULL,
1039 long *externalLeading = NULL,
1040 const wxFont *theFont = NULL) const );
1041 wxDEPRECATED( void GetLogicalOrigin(long *x, long *y) const );
1042 wxDEPRECATED( void GetDeviceOrigin(long *x, long *y) const );
1043 wxDEPRECATED( void GetClippingBox(long *x, long *y, long *w, long *h) const );
1044 #endif // WXWIN_COMPATIBILITY_2_8
1045
1046
1047 protected:
1048 // ctor takes ownership of the pointer
1049 wxDC(wxDCImpl *pimpl) : m_pimpl(pimpl) { }
1050
1051 wxDCImpl * const m_pimpl;
1052
1053 private:
1054 DECLARE_ABSTRACT_CLASS(wxDC)
1055 DECLARE_NO_COPY_CLASS(wxDC)
1056 };
1057
1058 // ----------------------------------------------------------------------------
1059 // helper class: you can use it to temporarily change the DC text colour and
1060 // restore it automatically when the object goes out of scope
1061 // ----------------------------------------------------------------------------
1062
1063 class WXDLLEXPORT wxDCTextColourChanger
1064 {
1065 public:
1066 wxDCTextColourChanger(wxDC& dc) : m_dc(dc), m_colFgOld() { }
1067
1068 wxDCTextColourChanger(wxDC& dc, const wxColour& col) : m_dc(dc)
1069 {
1070 Set(col);
1071 }
1072
1073 ~wxDCTextColourChanger()
1074 {
1075 if ( m_colFgOld.Ok() )
1076 m_dc.SetTextForeground(m_colFgOld);
1077 }
1078
1079 void Set(const wxColour& col)
1080 {
1081 if ( !m_colFgOld.Ok() )
1082 m_colFgOld = m_dc.GetTextForeground();
1083 m_dc.SetTextForeground(col);
1084 }
1085
1086 private:
1087 wxDC& m_dc;
1088
1089 wxColour m_colFgOld;
1090
1091 DECLARE_NO_COPY_CLASS(wxDCTextColourChanger)
1092 };
1093
1094 // ----------------------------------------------------------------------------
1095 // helper class: you can use it to temporarily change the DC pen and
1096 // restore it automatically when the object goes out of scope
1097 // ----------------------------------------------------------------------------
1098
1099 class WXDLLEXPORT wxDCPenChanger
1100 {
1101 public:
1102 wxDCPenChanger(wxDC& dc, const wxPen& pen) : m_dc(dc), m_penOld(dc.GetPen())
1103 {
1104 m_dc.SetPen(pen);
1105 }
1106
1107 ~wxDCPenChanger()
1108 {
1109 if ( m_penOld.Ok() )
1110 m_dc.SetPen(m_penOld);
1111 }
1112
1113 private:
1114 wxDC& m_dc;
1115
1116 wxPen m_penOld;
1117
1118 DECLARE_NO_COPY_CLASS(wxDCPenChanger)
1119 };
1120
1121 // ----------------------------------------------------------------------------
1122 // helper class: you can use it to temporarily change the DC brush and
1123 // restore it automatically when the object goes out of scope
1124 // ----------------------------------------------------------------------------
1125
1126 class WXDLLEXPORT wxDCBrushChanger
1127 {
1128 public:
1129 wxDCBrushChanger(wxDC& dc, const wxBrush& brush) : m_dc(dc), m_brushOld(dc.GetBrush())
1130 {
1131 m_dc.SetBrush(brush);
1132 }
1133
1134 ~wxDCBrushChanger()
1135 {
1136 if ( m_brushOld.Ok() )
1137 m_dc.SetBrush(m_brushOld);
1138 }
1139
1140 private:
1141 wxDC& m_dc;
1142
1143 wxBrush m_brushOld;
1144
1145 DECLARE_NO_COPY_CLASS(wxDCBrushChanger)
1146 };
1147
1148 // ----------------------------------------------------------------------------
1149 // another small helper class: sets the clipping region in its ctor and
1150 // destroys it in the dtor
1151 // ----------------------------------------------------------------------------
1152
1153 class WXDLLEXPORT wxDCClipper
1154 {
1155 public:
1156 wxDCClipper(wxDC& dc, const wxRegion& r) : m_dc(dc)
1157 { dc.SetClippingRegion(r); }
1158 wxDCClipper(wxDC& dc, const wxRect& r) : m_dc(dc)
1159 { dc.SetClippingRegion(r.x, r.y, r.width, r.height); }
1160 wxDCClipper(wxDC& dc, wxCoord x, wxCoord y, wxCoord w, wxCoord h) : m_dc(dc)
1161 { dc.SetClippingRegion(x, y, w, h); }
1162
1163 ~wxDCClipper() { m_dc.DestroyClippingRegion(); }
1164
1165 private:
1166 wxDC& m_dc;
1167
1168 DECLARE_NO_COPY_CLASS(wxDCClipper)
1169 };
1170
1171 #endif // _WX_DC_H_BASE_