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