1 /////////////////////////////////////////////////////////////////////////////
4 // Author: Vadim Zeitlin
8 // Copyright: (c) wxWidgets team
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_DC_H_BASE_
13 #define _WX_DC_H_BASE_
15 // ----------------------------------------------------------------------------
16 // headers which we must include here
17 // ----------------------------------------------------------------------------
19 #include "wx/object.h" // the base class
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
28 #include "wx/palette.h"
29 #include "wx/dynarray.h"
32 #include "wx/cmndata.h"
34 #define wxUSE_NEW_DC 1
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
;
45 //-----------------------------------------------------------------------------
46 // wxDrawObject helper class
47 //-----------------------------------------------------------------------------
49 class WXDLLIMPEXP_CORE wxDrawObject
54 : m_isBBoxValid(false)
55 , m_minX(0), m_minY(0), m_maxX(0), m_maxY(0)
58 virtual ~wxDrawObject() { }
60 virtual void Draw(wxDC
&) const { }
62 virtual void CalcBoundingBox(wxCoord x
, wxCoord y
)
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
;
82 void ResetBoundingBox()
84 m_isBBoxValid
= false;
86 m_minX
= m_maxX
= m_minY
= m_maxY
= 0;
89 // Get the final bounding box of the PostScript or Metafile picture.
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
; }
96 //to define the type of object for derived objects
97 virtual int GetType()=0;
100 //for boundingbox calculation
101 bool m_isBBoxValid
:1;
102 //for boundingbox calculation
103 wxCoord m_minX
, m_minY
, m_maxX
, m_maxY
;
107 //-----------------------------------------------------------------------------
109 //-----------------------------------------------------------------------------
111 class WXDLLIMPEXP_FWD_CORE wxDCImpl
;
113 class WXDLLIMPEXP_CORE wxDCFactory
117 virtual ~wxDCFactory() {}
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;
133 static void Set(wxDCFactory
*factory
);
134 static wxDCFactory
*Get();
137 static wxDCFactory
*m_factory
;
140 //-----------------------------------------------------------------------------
142 //-----------------------------------------------------------------------------
144 class WXDLLIMPEXP_CORE wxNativeDCFactory
: public wxDCFactory
147 wxNativeDCFactory() {}
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
);
164 //-----------------------------------------------------------------------------
166 //-----------------------------------------------------------------------------
168 class WXDLLIMPEXP_CORE wxDCImpl
: public wxObject
171 wxDCImpl( wxDC
*owner
);
174 wxDC
*GetOwner() const { return m_owner
; }
176 wxWindow
* GetWindow() const { return m_window
; }
178 virtual bool IsOk() const { return m_ok
; }
180 // query capabilities
182 virtual bool CanDrawBitmap() const = 0;
183 virtual bool CanGetTextExtent() const = 0;
186 virtual void* GetCairoContext() const
191 // query dimension, colour deps, resolution
193 virtual void DoGetSize(int *width
, int *height
) const = 0;
194 void GetSize(int *width
, int *height
) const
196 DoGetSize(width
, height
);
200 wxSize
GetSize() const
207 virtual void DoGetSizeMM(int* width
, int* height
) const = 0;
209 virtual int GetDepth() const = 0;
210 virtual wxSize
GetPPI() const = 0;
212 // Right-To-Left (RTL) modes
214 virtual void SetLayoutDirection(wxLayoutDirection
WXUNUSED(dir
)) { }
215 virtual wxLayoutDirection
GetLayoutDirection() const { return wxLayout_Default
; }
219 virtual bool StartDoc(const wxString
& WXUNUSED(message
)) { return true; }
220 virtual void EndDoc() { }
222 virtual void StartPage() { }
223 virtual void EndPage() { }
225 // flushing the content of this dc immediately eg onto screen
226 virtual void Flush() { }
230 virtual void CalcBoundingBox(wxCoord x
, wxCoord y
)
234 if ( x
< m_minX
) m_minX
= x
;
235 if ( y
< m_minY
) m_minY
= y
;
236 if ( x
> m_maxX
) m_maxX
= x
;
237 if ( y
> m_maxY
) m_maxY
= y
;
241 m_isBBoxValid
= true;
249 void ResetBoundingBox()
251 m_isBBoxValid
= false;
253 m_minX
= m_maxX
= m_minY
= m_maxY
= 0;
256 wxCoord
MinX() const { return m_minX
; }
257 wxCoord
MaxX() const { return m_maxX
; }
258 wxCoord
MinY() const { return m_minY
; }
259 wxCoord
MaxY() const { return m_maxY
; }
261 // setters and getters
263 virtual void SetFont(const wxFont
& font
) = 0;
264 virtual const wxFont
& GetFont() const { return m_font
; }
266 virtual void SetPen(const wxPen
& pen
) = 0;
267 virtual const wxPen
& GetPen() const { return m_pen
; }
269 virtual void SetBrush(const wxBrush
& brush
) = 0;
270 virtual const wxBrush
& GetBrush() const { return m_brush
; }
272 virtual void SetBackground(const wxBrush
& brush
) = 0;
273 virtual const wxBrush
& GetBackground() const { return m_backgroundBrush
; }
275 virtual void SetBackgroundMode(int mode
) = 0;
276 virtual int GetBackgroundMode() const { return m_backgroundMode
; }
278 virtual void SetTextForeground(const wxColour
& colour
)
279 { m_textForegroundColour
= colour
; }
280 virtual const wxColour
& GetTextForeground() const { return m_textForegroundColour
; }
282 virtual void SetTextBackground(const wxColour
& colour
)
283 { m_textBackgroundColour
= colour
; }
284 virtual const wxColour
& GetTextBackground() const { return m_textBackgroundColour
; }
287 virtual void SetPalette(const wxPalette
& palette
) = 0;
288 #endif // wxUSE_PALETTE
292 virtual void SetLogicalFunction(int function
) = 0;
293 virtual int GetLogicalFunction() const { return m_logicalFunction
; }
297 virtual wxCoord
GetCharHeight() const = 0;
298 virtual wxCoord
GetCharWidth() const = 0;
299 virtual void DoGetTextExtent(const wxString
& string
,
300 wxCoord
*x
, wxCoord
*y
,
301 wxCoord
*descent
= NULL
,
302 wxCoord
*externalLeading
= NULL
,
303 const wxFont
*theFont
= NULL
) const = 0;
304 virtual void GetMultiLineTextExtent(const wxString
& string
,
307 wxCoord
*heightLine
= NULL
,
308 const wxFont
*font
= NULL
) const;
309 virtual bool DoGetPartialTextExtents(const wxString
& text
, wxArrayInt
& widths
) const;
313 virtual void Clear() = 0;
317 virtual void DoSetClippingRegion(wxCoord x
, wxCoord y
,
318 wxCoord width
, wxCoord height
) = 0;
319 virtual void DoSetClippingRegionAsRegion(const wxRegion
& region
) = 0;
321 virtual void DoGetClippingBox(wxCoord
*x
, wxCoord
*y
,
322 wxCoord
*w
, wxCoord
*h
) const
329 *w
= m_clipX2
- m_clipX1
;
331 *h
= m_clipY2
- m_clipY1
;
334 virtual void DestroyClippingRegion() { ResetClipping(); }
337 // coordinates conversions and transforms
339 virtual wxCoord
DeviceToLogicalX(wxCoord x
) const;
340 virtual wxCoord
DeviceToLogicalY(wxCoord y
) const;
341 virtual wxCoord
DeviceToLogicalXRel(wxCoord x
) const;
342 virtual wxCoord
DeviceToLogicalYRel(wxCoord y
) const;
343 virtual wxCoord
LogicalToDeviceX(wxCoord x
) const;
344 virtual wxCoord
LogicalToDeviceY(wxCoord y
) const;
345 virtual wxCoord
LogicalToDeviceXRel(wxCoord x
) const;
346 virtual wxCoord
LogicalToDeviceYRel(wxCoord y
) const;
348 virtual void SetMapMode(int mode
);
349 virtual int GetMapMode() const { return m_mappingMode
; }
351 virtual void SetUserScale(double x
, double y
);
352 virtual void GetUserScale(double *x
, double *y
) const
354 if ( x
) *x
= m_userScaleX
;
355 if ( y
) *y
= m_userScaleY
;
358 virtual void SetLogicalScale(double x
, double y
);
359 virtual void GetLogicalScale(double *x
, double *y
)
361 if ( x
) *x
= m_logicalScaleX
;
362 if ( y
) *y
= m_logicalScaleY
;
365 virtual void SetLogicalOrigin(wxCoord x
, wxCoord y
);
366 virtual void DoGetLogicalOrigin(wxCoord
*x
, wxCoord
*y
) const
368 if ( x
) *x
= m_logicalOriginX
;
369 if ( y
) *y
= m_logicalOriginY
;
372 virtual void SetDeviceOrigin(wxCoord x
, wxCoord y
);
373 virtual void DoGetDeviceOrigin(wxCoord
*x
, wxCoord
*y
) const
375 if ( x
) *x
= m_deviceOriginX
;
376 if ( y
) *y
= m_deviceOriginY
;
379 virtual void SetDeviceLocalOrigin( wxCoord x
, wxCoord y
);
381 virtual void ComputeScaleAndOrigin();
383 // this needs to overidden if the axis is inverted
384 virtual void SetAxisOrientation(bool xLeftRight
, bool yBottomUp
);
386 // ---------------------------------------------------------
387 // the actual drawing API
389 virtual bool DoFloodFill(wxCoord x
, wxCoord y
, const wxColour
& col
,
390 int style
= wxFLOOD_SURFACE
) = 0;
392 virtual void DoGradientFillLinear(const wxRect
& rect
,
393 const wxColour
& initialColour
,
394 const wxColour
& destColour
,
395 wxDirection nDirection
= wxEAST
);
397 virtual void DoGradientFillConcentric(const wxRect
& rect
,
398 const wxColour
& initialColour
,
399 const wxColour
& destColour
,
400 const wxPoint
& circleCenter
);
402 virtual bool DoGetPixel(wxCoord x
, wxCoord y
, wxColour
*col
) const = 0;
404 virtual void DoDrawPoint(wxCoord x
, wxCoord y
) = 0;
405 virtual void DoDrawLine(wxCoord x1
, wxCoord y1
, wxCoord x2
, wxCoord y2
) = 0;
407 virtual void DoDrawArc(wxCoord x1
, wxCoord y1
,
408 wxCoord x2
, wxCoord y2
,
409 wxCoord xc
, wxCoord yc
) = 0;
410 virtual void DoDrawCheckMark(wxCoord x
, wxCoord y
,
411 wxCoord width
, wxCoord height
);
412 virtual void DoDrawEllipticArc(wxCoord x
, wxCoord y
, wxCoord w
, wxCoord h
,
413 double sa
, double ea
) = 0;
415 virtual void DoDrawRectangle(wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
) = 0;
416 virtual void DoDrawRoundedRectangle(wxCoord x
, wxCoord y
,
417 wxCoord width
, wxCoord height
,
419 virtual void DoDrawEllipse(wxCoord x
, wxCoord y
,
420 wxCoord width
, wxCoord height
) = 0;
422 virtual void DoCrossHair(wxCoord x
, wxCoord y
) = 0;
424 virtual void DoDrawIcon(const wxIcon
& icon
, wxCoord x
, wxCoord y
) = 0;
425 virtual void DoDrawBitmap(const wxBitmap
&bmp
, wxCoord x
, wxCoord y
,
426 bool useMask
= false) = 0;
428 virtual void DoDrawText(const wxString
& text
, wxCoord x
, wxCoord y
) = 0;
429 virtual void DoDrawRotatedText(const wxString
& text
,
430 wxCoord x
, wxCoord y
, double angle
) = 0;
432 virtual bool DoBlit(wxCoord xdest
, wxCoord ydest
,
433 wxCoord width
, wxCoord height
,
435 wxCoord xsrc
, wxCoord ysrc
,
437 bool useMask
= false,
438 wxCoord xsrcMask
= wxDefaultCoord
,
439 wxCoord ysrcMask
= wxDefaultCoord
) = 0;
441 virtual bool DoStretchBlit(wxCoord xdest
, wxCoord ydest
,
442 wxCoord dstWidth
, wxCoord dstHeight
,
444 wxCoord xsrc
, wxCoord ysrc
,
445 wxCoord srcWidth
, wxCoord srcHeight
,
447 bool useMask
= false,
448 wxCoord xsrcMask
= wxDefaultCoord
,
449 wxCoord ysrcMask
= wxDefaultCoord
);
451 virtual wxBitmap
DoGetAsBitmap(const wxRect
*WXUNUSED(subrect
)) const
452 { return wxNullBitmap
; }
455 virtual void DoDrawLines(int n
, wxPoint points
[],
456 wxCoord xoffset
, wxCoord yoffset
) = 0;
457 virtual void DrawLines(const wxPointList
*list
,
458 wxCoord xoffset
, wxCoord yoffset
);
460 virtual void DoDrawPolygon(int n
, wxPoint points
[],
461 wxCoord xoffset
, wxCoord yoffset
,
462 int fillStyle
= wxODDEVEN_RULE
) = 0;
463 virtual void DoDrawPolyPolygon(int n
, int count
[], wxPoint points
[],
464 wxCoord xoffset
, wxCoord yoffset
,
466 void DrawPolygon(const wxPointList
*list
,
467 wxCoord xoffset
, wxCoord yoffset
,
472 virtual void DoDrawSpline(wxCoord x1
, wxCoord y1
, wxCoord x2
, wxCoord y2
, wxCoord x3
, wxCoord y3
);
473 virtual void DoDrawSpline(int n
, wxPoint points
[]);
474 virtual void DoDrawSpline(const wxPointList
*points
);
477 // ---------------------------------------------------------
478 // wxMemoryDC Impl API
480 virtual void DoSelect(const wxBitmap
& WXUNUSED(bmp
))
483 virtual const wxBitmap
& GetSelectedBitmap() const
484 { return wxNullBitmap
; }
485 virtual wxBitmap
& GetSelectedBitmap()
486 { return wxNullBitmap
; }
488 // ---------------------------------------------------------
489 // wxPrinterDC Impl API
491 virtual wxRect
GetPaperRect()
492 { int w
= 0; int h
= 0; DoGetSize( &w
, &h
); return wxRect(0,0,w
,h
); }
494 virtual int GetResolution()
501 // unset clipping variables (after clipping region was destroyed)
506 m_clipX1
= m_clipX2
= m_clipY1
= m_clipY2
= 0;
510 //! Generic method to draw ellipses, circles and arcs with current pen and brush.
511 /*! \param x Upper left corner of bounding box.
512 * \param y Upper left corner of bounding box.
513 * \param w Width of bounding box.
514 * \param h Height of bounding box.
515 * \param sa Starting angle of arc
516 * (counterclockwise, start at 3 o'clock, 360 is full circle).
517 * \param ea Ending angle of arc.
518 * \param angle Rotation angle, the Arc will be rotated after
519 * calculating begin and end.
521 void DrawEllipticArcRot( wxCoord x
, wxCoord y
,
522 wxCoord width
, wxCoord height
,
523 double sa
= 0, double ea
= 0, double angle
= 0 )
524 { DoDrawEllipticArcRot( x
, y
, width
, height
, sa
, ea
, angle
); }
526 void DrawEllipticArcRot( const wxPoint
& pt
,
528 double sa
= 0, double ea
= 0, double angle
= 0 )
529 { DoDrawEllipticArcRot( pt
.x
, pt
.y
, sz
.x
, sz
.y
, sa
, ea
, angle
); }
531 void DrawEllipticArcRot( const wxRect
& rect
,
532 double sa
= 0, double ea
= 0, double angle
= 0 )
533 { DoDrawEllipticArcRot( rect
.x
, rect
.y
, rect
.width
, rect
.height
, sa
, ea
, angle
); }
535 virtual void DoDrawEllipticArcRot( wxCoord x
, wxCoord y
,
536 wxCoord w
, wxCoord h
,
537 double sa
= 0, double ea
= 0, double angle
= 0 );
539 //! Rotates points around center.
540 /*! This is a quite straight method, it calculates in pixels
541 * and so it produces rounding errors.
542 * \param points The points inside will be rotated.
543 * \param angle Rotating angle (counterclockwise, start at 3 o'clock, 360 is full circle).
544 * \param center Center of rotation.
546 void Rotate( wxPointList
* points
, double angle
, wxPoint center
= wxPoint(0,0) );
548 // used by DrawEllipticArcRot
549 // Careful: wxList gets filled with points you have to delete later.
550 void CalculateEllipticPoints( wxPointList
* points
,
551 wxCoord xStart
, wxCoord yStart
,
552 wxCoord w
, wxCoord h
,
553 double sa
, double ea
);
554 #endif // __WXWINCE__
557 // window on which the DC draws or NULL
564 bool m_isInteractive
:1;
565 bool m_isBBoxValid
:1;
567 // coordinate system variables
569 wxCoord m_logicalOriginX
, m_logicalOriginY
;
570 wxCoord m_deviceOriginX
, m_deviceOriginY
; // Usually 0,0, can be change by user
572 wxCoord m_deviceLocalOriginX
, m_deviceLocalOriginY
; // non-zero if native top-left corner
573 // is not at 0,0. This was the case under
574 // Mac's GrafPorts (coordinate system
575 // used toplevel window's origin) and
576 // e.g. for Postscript, where the native
577 // origin in the bottom left corner.
578 double m_logicalScaleX
, m_logicalScaleY
;
579 double m_userScaleX
, m_userScaleY
;
580 double m_scaleX
, m_scaleY
; // calculated from logical scale and user scale
582 int m_signX
, m_signY
; // Used by SetAxisOrientation() to invert the axes
584 // what is a mm on a screen you don't know the size of?
585 double m_mm_to_pix_x
,
588 // bounding and clipping boxes
589 wxCoord m_minX
, m_minY
, m_maxX
, m_maxY
;
590 wxCoord m_clipX1
, m_clipY1
, m_clipX2
, m_clipY2
;
592 int m_logicalFunction
;
593 int m_backgroundMode
;
598 wxBrush m_backgroundBrush
;
599 wxColour m_textForegroundColour
;
600 wxColour m_textBackgroundColour
;
605 bool m_hasCustomPalette
;
606 #endif // wxUSE_PALETTE
609 DECLARE_ABSTRACT_CLASS(wxDCImpl
)
613 class WXDLLIMPEXP_CORE wxDC
: public wxObject
616 virtual ~wxDC() { delete m_pimpl
; }
620 const wxDCImpl
*GetImpl() const
623 wxWindow
*GetWindow() const
624 { return m_pimpl
->GetWindow(); }
627 { return m_pimpl
&& m_pimpl
->IsOk(); }
629 // query capabilities
631 bool CanDrawBitmap() const
632 { return m_pimpl
->CanDrawBitmap(); }
633 bool CanGetTextExtent() const
634 { return m_pimpl
->CanGetTextExtent(); }
636 // query dimension, colour deps, resolution
638 void GetSize(int *width
, int *height
) const
639 { m_pimpl
->DoGetSize(width
, height
); }
640 wxSize
GetSize() const
641 { return m_pimpl
->GetSize(); }
643 void GetSizeMM(int* width
, int* height
) const
644 { m_pimpl
->DoGetSizeMM(width
, height
); }
645 wxSize
GetSizeMM() const
648 m_pimpl
->DoGetSizeMM(&w
, &h
);
653 { return m_pimpl
->GetDepth(); }
654 wxSize
GetPPI() const
655 { return m_pimpl
->GetPPI(); }
657 virtual int GetResolution()
658 { return m_pimpl
->GetResolution(); }
660 // Right-To-Left (RTL) modes
662 void SetLayoutDirection(wxLayoutDirection dir
)
663 { m_pimpl
->SetLayoutDirection( dir
); }
664 wxLayoutDirection
GetLayoutDirection() const
665 { return m_pimpl
->GetLayoutDirection(); }
669 bool StartDoc(const wxString
& message
)
670 { return m_pimpl
->StartDoc(message
); }
672 { m_pimpl
->EndDoc(); }
675 { m_pimpl
->StartPage(); }
677 { m_pimpl
->EndPage(); }
681 void CalcBoundingBox(wxCoord x
, wxCoord y
)
682 { m_pimpl
->CalcBoundingBox(x
,y
); }
683 void ResetBoundingBox()
684 { m_pimpl
->ResetBoundingBox(); }
687 { return m_pimpl
->MinX(); }
689 { return m_pimpl
->MaxX(); }
691 { return m_pimpl
->MinY(); }
693 { return m_pimpl
->MaxY(); }
695 // setters and getters
697 void SetFont(const wxFont
& font
)
698 { m_pimpl
->SetFont( font
); }
699 const wxFont
& GetFont() const
700 { return m_pimpl
->GetFont(); }
702 void SetPen(const wxPen
& pen
)
703 { m_pimpl
->SetPen( pen
); }
704 const wxPen
& GetPen() const
705 { return m_pimpl
->GetPen(); }
707 void SetBrush(const wxBrush
& brush
)
708 { m_pimpl
->SetBrush( brush
); }
709 const wxBrush
& GetBrush() const
710 { return m_pimpl
->GetBrush(); }
712 void SetBackground(const wxBrush
& brush
)
713 { m_pimpl
->SetBackground( brush
); }
714 const wxBrush
& GetBackground() const
715 { return m_pimpl
->GetBackground(); }
717 void SetBackgroundMode(int mode
)
718 { m_pimpl
->SetBackgroundMode( mode
); }
719 int GetBackgroundMode() const
720 { return m_pimpl
->GetBackgroundMode(); }
722 void SetTextForeground(const wxColour
& colour
)
723 { m_pimpl
->SetTextForeground(colour
); }
724 const wxColour
& GetTextForeground() const
725 { return m_pimpl
->GetTextForeground(); }
727 void SetTextBackground(const wxColour
& colour
)
728 { m_pimpl
->SetTextBackground(colour
); }
729 const wxColour
& GetTextBackground() const
730 { return m_pimpl
->GetTextBackground(); }
733 void SetPalette(const wxPalette
& palette
)
734 { m_pimpl
->SetPalette(palette
); }
735 #endif // wxUSE_PALETTE
739 void SetLogicalFunction(int function
)
740 { m_pimpl
->SetLogicalFunction(function
); }
741 int GetLogicalFunction() const
742 { return m_pimpl
->GetLogicalFunction(); }
746 wxCoord
GetCharHeight() const
747 { return m_pimpl
->GetCharHeight(); }
748 wxCoord
GetCharWidth() const
749 { return m_pimpl
->GetCharWidth(); }
751 void GetTextExtent(const wxString
& string
,
752 wxCoord
*x
, wxCoord
*y
,
753 wxCoord
*descent
= NULL
,
754 wxCoord
*externalLeading
= NULL
,
755 const wxFont
*theFont
= NULL
) const
756 { m_pimpl
->DoGetTextExtent(string
, x
, y
, descent
, externalLeading
, theFont
); }
758 wxSize
GetTextExtent(const wxString
& string
) const
761 m_pimpl
->DoGetTextExtent(string
, &w
, &h
);
765 void GetMultiLineTextExtent(const wxString
& string
,
768 wxCoord
*heightLine
= NULL
,
769 const wxFont
*font
= NULL
) const
770 { m_pimpl
->GetMultiLineTextExtent( string
, width
, height
, heightLine
, font
); }
772 wxSize
GetMultiLineTextExtent(const wxString
& string
) const
775 m_pimpl
->GetMultiLineTextExtent(string
, &w
, &h
);
779 bool GetPartialTextExtents(const wxString
& text
, wxArrayInt
& widths
) const
780 { return m_pimpl
->DoGetPartialTextExtents(text
, widths
); }
785 { m_pimpl
->Clear(); }
789 void SetClippingRegion(wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
)
790 { m_pimpl
->DoSetClippingRegion(x
, y
, width
, height
); }
791 void SetClippingRegion(const wxPoint
& pt
, const wxSize
& sz
)
792 { m_pimpl
->DoSetClippingRegion(pt
.x
, pt
.y
, sz
.x
, sz
.y
); }
793 void SetClippingRegion(const wxRect
& rect
)
794 { m_pimpl
->DoSetClippingRegion(rect
.x
, rect
.y
, rect
.width
, rect
.height
); }
795 void SetClippingRegion(const wxRegion
& region
)
796 { m_pimpl
->DoSetClippingRegionAsRegion(region
); }
798 void DestroyClippingRegion()
799 { m_pimpl
->DestroyClippingRegion(); }
801 void GetClippingBox(wxCoord
*x
, wxCoord
*y
, wxCoord
*w
, wxCoord
*h
) const
802 { m_pimpl
->DoGetClippingBox(x
, y
, w
, h
); }
803 void GetClippingBox(wxRect
& rect
) const
804 { m_pimpl
->DoGetClippingBox(&rect
.x
, &rect
.y
, &rect
.width
, &rect
.height
); }
806 // coordinates conversions and transforms
808 wxCoord
DeviceToLogicalX(wxCoord x
) const
809 { return m_pimpl
->DeviceToLogicalX(x
); }
810 wxCoord
DeviceToLogicalY(wxCoord y
) const
811 { return m_pimpl
->DeviceToLogicalY(y
); }
812 wxCoord
DeviceToLogicalXRel(wxCoord x
) const
813 { return m_pimpl
->DeviceToLogicalXRel(x
); }
814 wxCoord
DeviceToLogicalYRel(wxCoord y
) const
815 { return m_pimpl
->DeviceToLogicalYRel(y
); }
816 wxCoord
LogicalToDeviceX(wxCoord x
) const
817 { return m_pimpl
->LogicalToDeviceX(x
); }
818 wxCoord
LogicalToDeviceY(wxCoord y
) const
819 { return m_pimpl
->LogicalToDeviceY(y
); }
820 wxCoord
LogicalToDeviceXRel(wxCoord x
) const
821 { return m_pimpl
->LogicalToDeviceXRel(x
); }
822 wxCoord
LogicalToDeviceYRel(wxCoord y
) const
823 { return m_pimpl
->LogicalToDeviceYRel(y
); }
825 void SetMapMode(int mode
)
826 { m_pimpl
->SetMapMode(mode
); }
827 int GetMapMode() const
828 { return m_pimpl
->GetMapMode(); }
830 void SetUserScale(double x
, double y
)
831 { m_pimpl
->SetUserScale(x
,y
); }
832 void GetUserScale(double *x
, double *y
) const
833 { m_pimpl
->GetUserScale( x
, y
); }
835 void SetLogicalScale(double x
, double y
)
836 { m_pimpl
->SetLogicalScale( x
, y
); }
837 void GetLogicalScale(double *x
, double *y
)
838 { m_pimpl
->GetLogicalScale( x
, y
); }
840 void SetLogicalOrigin(wxCoord x
, wxCoord y
)
841 { m_pimpl
->SetLogicalOrigin(x
,y
); }
842 void GetLogicalOrigin(wxCoord
*x
, wxCoord
*y
) const
843 { m_pimpl
->DoGetLogicalOrigin(x
, y
); }
844 wxPoint
GetLogicalOrigin() const
845 { wxCoord x
, y
; m_pimpl
->DoGetLogicalOrigin(&x
, &y
); return wxPoint(x
, y
); }
847 void SetDeviceOrigin(wxCoord x
, wxCoord y
)
848 { m_pimpl
->SetDeviceOrigin( x
, y
); }
849 void GetDeviceOrigin(wxCoord
*x
, wxCoord
*y
) const
850 { m_pimpl
->DoGetDeviceOrigin(x
, y
); }
851 wxPoint
GetDeviceOrigin() const
852 { wxCoord x
, y
; m_pimpl
->DoGetDeviceOrigin(&x
, &y
); return wxPoint(x
, y
); }
854 void SetAxisOrientation(bool xLeftRight
, bool yBottomUp
)
855 { m_pimpl
->SetAxisOrientation(xLeftRight
, yBottomUp
); }
858 void SetDeviceLocalOrigin( wxCoord x
, wxCoord y
)
859 { m_pimpl
->SetDeviceLocalOrigin( x
, y
); }
862 // draw generic object
864 void DrawObject(wxDrawObject
* drawobject
)
866 drawobject
->Draw(*this);
867 CalcBoundingBox(drawobject
->MinX(),drawobject
->MinY());
868 CalcBoundingBox(drawobject
->MaxX(),drawobject
->MaxY());
871 // -----------------------------------------------
872 // the actual drawing API
874 bool FloodFill(wxCoord x
, wxCoord y
, const wxColour
& col
,
875 int style
= wxFLOOD_SURFACE
)
876 { return m_pimpl
->DoFloodFill(x
, y
, col
, style
); }
877 bool FloodFill(const wxPoint
& pt
, const wxColour
& col
,
878 int style
= wxFLOOD_SURFACE
)
879 { return m_pimpl
->DoFloodFill(pt
.x
, pt
.y
, col
, style
); }
881 // fill the area specified by rect with a radial gradient, starting from
882 // initialColour in the centre of the cercle and fading to destColour.
883 void GradientFillConcentric(const wxRect
& rect
,
884 const wxColour
& initialColour
,
885 const wxColour
& destColour
)
886 { m_pimpl
->DoGradientFillConcentric( rect
, initialColour
, destColour
,
887 wxPoint(rect
.GetWidth() / 2,
888 rect
.GetHeight() / 2)); }
890 void GradientFillConcentric(const wxRect
& rect
,
891 const wxColour
& initialColour
,
892 const wxColour
& destColour
,
893 const wxPoint
& circleCenter
)
894 { m_pimpl
->DoGradientFillConcentric(rect
, initialColour
, destColour
, circleCenter
); }
896 // fill the area specified by rect with a linear gradient
897 void GradientFillLinear(const wxRect
& rect
,
898 const wxColour
& initialColour
,
899 const wxColour
& destColour
,
900 wxDirection nDirection
= wxEAST
)
901 { m_pimpl
->DoGradientFillLinear(rect
, initialColour
, destColour
, nDirection
); }
903 bool GetPixel(wxCoord x
, wxCoord y
, wxColour
*col
) const
904 { return m_pimpl
->DoGetPixel(x
, y
, col
); }
905 bool GetPixel(const wxPoint
& pt
, wxColour
*col
) const
906 { return m_pimpl
->DoGetPixel(pt
.x
, pt
.y
, col
); }
908 void DrawLine(wxCoord x1
, wxCoord y1
, wxCoord x2
, wxCoord y2
)
909 { m_pimpl
->DoDrawLine(x1
, y1
, x2
, y2
); }
910 void DrawLine(const wxPoint
& pt1
, const wxPoint
& pt2
)
911 { m_pimpl
->DoDrawLine(pt1
.x
, pt1
.y
, pt2
.x
, pt2
.y
); }
913 void CrossHair(wxCoord x
, wxCoord y
)
914 { m_pimpl
->DoCrossHair(x
, y
); }
915 void CrossHair(const wxPoint
& pt
)
916 { m_pimpl
->DoCrossHair(pt
.x
, pt
.y
); }
918 void DrawArc(wxCoord x1
, wxCoord y1
, wxCoord x2
, wxCoord y2
,
919 wxCoord xc
, wxCoord yc
)
920 { m_pimpl
->DoDrawArc(x1
, y1
, x2
, y2
, xc
, yc
); }
921 void DrawArc(const wxPoint
& pt1
, const wxPoint
& pt2
, const wxPoint
& centre
)
922 { m_pimpl
->DoDrawArc(pt1
.x
, pt1
.y
, pt2
.x
, pt2
.y
, centre
.x
, centre
.y
); }
924 void DrawCheckMark(wxCoord x
, wxCoord y
,
925 wxCoord width
, wxCoord height
)
926 { m_pimpl
->DoDrawCheckMark(x
, y
, width
, height
); }
927 void DrawCheckMark(const wxRect
& rect
)
928 { m_pimpl
->DoDrawCheckMark(rect
.x
, rect
.y
, rect
.width
, rect
.height
); }
930 void DrawEllipticArc(wxCoord x
, wxCoord y
, wxCoord w
, wxCoord h
,
931 double sa
, double ea
)
932 { m_pimpl
->DoDrawEllipticArc(x
, y
, w
, h
, sa
, ea
); }
933 void DrawEllipticArc(const wxPoint
& pt
, const wxSize
& sz
,
934 double sa
, double ea
)
935 { m_pimpl
->DoDrawEllipticArc(pt
.x
, pt
.y
, sz
.x
, sz
.y
, sa
, ea
); }
937 void DrawPoint(wxCoord x
, wxCoord y
)
938 { m_pimpl
->DoDrawPoint(x
, y
); }
939 void DrawPoint(const wxPoint
& pt
)
940 { m_pimpl
->DoDrawPoint(pt
.x
, pt
.y
); }
942 void DrawLines(int n
, wxPoint points
[],
943 wxCoord xoffset
= 0, wxCoord yoffset
= 0)
944 { m_pimpl
->DoDrawLines(n
, points
, xoffset
, yoffset
); }
945 void DrawLines(const wxPointList
*list
,
946 wxCoord xoffset
= 0, wxCoord yoffset
= 0)
947 { m_pimpl
->DrawLines( list
, xoffset
, yoffset
); }
948 #if WXWIN_COMPATIBILITY_2_8
949 wxDEPRECATED( void DrawLines(const wxList
*list
,
950 wxCoord xoffset
= 0, wxCoord yoffset
= 0) );
951 #endif // WXWIN_COMPATIBILITY_2_8
953 void DrawPolygon(int n
, wxPoint points
[],
954 wxCoord xoffset
= 0, wxCoord yoffset
= 0,
955 int fillStyle
= wxODDEVEN_RULE
)
956 { m_pimpl
->DoDrawPolygon(n
, points
, xoffset
, yoffset
, fillStyle
); }
957 void DrawPolygon(const wxPointList
*list
,
958 wxCoord xoffset
= 0, wxCoord yoffset
= 0,
959 int fillStyle
= wxODDEVEN_RULE
)
960 { m_pimpl
->DrawPolygon( list
, xoffset
, yoffset
, fillStyle
); }
961 void DrawPolyPolygon(int n
, int count
[], wxPoint points
[],
962 wxCoord xoffset
= 0, wxCoord yoffset
= 0,
963 int fillStyle
= wxODDEVEN_RULE
)
964 { m_pimpl
->DoDrawPolyPolygon(n
, count
, points
, xoffset
, yoffset
, fillStyle
); }
965 #if WXWIN_COMPATIBILITY_2_8
966 wxDEPRECATED( void DrawPolygon(const wxList
*list
,
967 wxCoord xoffset
= 0, wxCoord yoffset
= 0,
968 int fillStyle
= wxODDEVEN_RULE
) );
969 #endif // WXWIN_COMPATIBILITY_2_8
971 void DrawRectangle(wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
)
972 { m_pimpl
->DoDrawRectangle(x
, y
, width
, height
); }
973 void DrawRectangle(const wxPoint
& pt
, const wxSize
& sz
)
974 { m_pimpl
->DoDrawRectangle(pt
.x
, pt
.y
, sz
.x
, sz
.y
); }
975 void DrawRectangle(const wxRect
& rect
)
976 { m_pimpl
->DoDrawRectangle(rect
.x
, rect
.y
, rect
.width
, rect
.height
); }
978 void DrawRoundedRectangle(wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
,
980 { m_pimpl
->DoDrawRoundedRectangle(x
, y
, width
, height
, radius
); }
981 void DrawRoundedRectangle(const wxPoint
& pt
, const wxSize
& sz
,
983 { m_pimpl
->DoDrawRoundedRectangle(pt
.x
, pt
.y
, sz
.x
, sz
.y
, radius
); }
984 void DrawRoundedRectangle(const wxRect
& r
, double radius
)
985 { m_pimpl
->DoDrawRoundedRectangle(r
.x
, r
.y
, r
.width
, r
.height
, radius
); }
987 void DrawCircle(wxCoord x
, wxCoord y
, wxCoord radius
)
988 { m_pimpl
->DoDrawEllipse(x
- radius
, y
- radius
, 2*radius
, 2*radius
); }
989 void DrawCircle(const wxPoint
& pt
, wxCoord radius
)
990 { m_pimpl
->DoDrawEllipse(pt
.x
- radius
, pt
.y
- radius
, 2*radius
, 2*radius
); }
992 void DrawEllipse(wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
)
993 { m_pimpl
->DoDrawEllipse(x
, y
, width
, height
); }
994 void DrawEllipse(const wxPoint
& pt
, const wxSize
& sz
)
995 { m_pimpl
->DoDrawEllipse(pt
.x
, pt
.y
, sz
.x
, sz
.y
); }
996 void DrawEllipse(const wxRect
& rect
)
997 { m_pimpl
->DoDrawEllipse(rect
.x
, rect
.y
, rect
.width
, rect
.height
); }
999 void DrawIcon(const wxIcon
& icon
, wxCoord x
, wxCoord y
)
1000 { m_pimpl
->DoDrawIcon(icon
, x
, y
); }
1001 void DrawIcon(const wxIcon
& icon
, const wxPoint
& pt
)
1002 { m_pimpl
->DoDrawIcon(icon
, pt
.x
, pt
.y
); }
1004 void DrawBitmap(const wxBitmap
&bmp
, wxCoord x
, wxCoord y
,
1005 bool useMask
= false)
1006 { m_pimpl
->DoDrawBitmap(bmp
, x
, y
, useMask
); }
1007 void DrawBitmap(const wxBitmap
&bmp
, const wxPoint
& pt
,
1008 bool useMask
= false)
1009 { m_pimpl
->DoDrawBitmap(bmp
, pt
.x
, pt
.y
, useMask
); }
1011 void DrawText(const wxString
& text
, wxCoord x
, wxCoord y
)
1012 { m_pimpl
->DoDrawText(text
, x
, y
); }
1013 void DrawText(const wxString
& text
, const wxPoint
& pt
)
1014 { m_pimpl
->DoDrawText(text
, pt
.x
, pt
.y
); }
1016 void DrawRotatedText(const wxString
& text
, wxCoord x
, wxCoord y
, double angle
)
1017 { m_pimpl
->DoDrawRotatedText(text
, x
, y
, angle
); }
1018 void DrawRotatedText(const wxString
& text
, const wxPoint
& pt
, double angle
)
1019 { m_pimpl
->DoDrawRotatedText(text
, pt
.x
, pt
.y
, angle
); }
1021 // this version puts both optional bitmap and the text into the given
1022 // rectangle and aligns is as specified by alignment parameter; it also
1023 // will emphasize the character with the given index if it is != -1 and
1024 // return the bounding rectangle if required
1025 void DrawLabel(const wxString
& text
,
1026 const wxBitmap
& image
,
1028 int alignment
= wxALIGN_LEFT
| wxALIGN_TOP
,
1029 int indexAccel
= -1,
1030 wxRect
*rectBounding
= NULL
);
1032 void DrawLabel(const wxString
& text
, const wxRect
& rect
,
1033 int alignment
= wxALIGN_LEFT
| wxALIGN_TOP
,
1034 int indexAccel
= -1)
1035 { DrawLabel(text
, wxNullBitmap
, rect
, alignment
, indexAccel
); }
1037 bool Blit(wxCoord xdest
, wxCoord ydest
, wxCoord width
, wxCoord height
,
1038 wxDC
*source
, wxCoord xsrc
, wxCoord ysrc
,
1039 int rop
= wxCOPY
, bool useMask
= false, wxCoord xsrcMask
= wxDefaultCoord
, wxCoord ysrcMask
= wxDefaultCoord
)
1041 return m_pimpl
->DoBlit(xdest
, ydest
, width
, height
,
1042 source
, xsrc
, ysrc
, rop
, useMask
, xsrcMask
, ysrcMask
);
1044 bool Blit(const wxPoint
& destPt
, const wxSize
& sz
,
1045 wxDC
*source
, const wxPoint
& srcPt
,
1046 int rop
= wxCOPY
, bool useMask
= false, const wxPoint
& srcPtMask
= wxDefaultPosition
)
1048 return m_pimpl
->DoBlit(destPt
.x
, destPt
.y
, sz
.x
, sz
.y
,
1049 source
, srcPt
.x
, srcPt
.y
, rop
, useMask
, srcPtMask
.x
, srcPtMask
.y
);
1052 bool StretchBlit(wxCoord dstX
, wxCoord dstY
,
1053 wxCoord dstWidth
, wxCoord dstHeight
,
1055 wxCoord srcX
, wxCoord srcY
,
1056 wxCoord srcWidth
, wxCoord srcHeight
,
1057 int rop
= wxCOPY
, bool useMask
= false,
1058 wxCoord srcMaskX
= wxDefaultCoord
, wxCoord srcMaskY
= wxDefaultCoord
)
1060 return m_pimpl
->DoStretchBlit(dstX
, dstY
, dstWidth
, dstHeight
,
1061 source
, srcX
, srcY
, srcWidth
, srcHeight
, rop
, useMask
, srcMaskX
, srcMaskY
);
1063 bool StretchBlit(const wxPoint
& dstPt
, const wxSize
& dstSize
,
1064 wxDC
*source
, const wxPoint
& srcPt
, const wxSize
& srcSize
,
1065 int rop
= wxCOPY
, bool useMask
= false, const wxPoint
& srcMaskPt
= wxDefaultPosition
)
1067 return m_pimpl
->DoStretchBlit(dstPt
.x
, dstPt
.y
, dstSize
.x
, dstSize
.y
,
1068 source
, srcPt
.x
, srcPt
.y
, srcSize
.x
, srcSize
.y
, rop
, useMask
, srcMaskPt
.x
, srcMaskPt
.y
);
1071 wxBitmap
GetAsBitmap(const wxRect
*subrect
= (const wxRect
*) NULL
) const
1073 return m_pimpl
->DoGetAsBitmap(subrect
);
1077 void DrawSpline(wxCoord x1
, wxCoord y1
,
1078 wxCoord x2
, wxCoord y2
,
1079 wxCoord x3
, wxCoord y3
)
1080 { m_pimpl
->DoDrawSpline(x1
,y1
,x2
,y2
,x3
,y3
); }
1081 void DrawSpline(int n
, wxPoint points
[])
1082 { m_pimpl
->DoDrawSpline(n
,points
); }
1083 void DrawSpline(const wxPointList
*points
)
1084 { m_pimpl
->DoDrawSpline(points
); }
1085 #endif // wxUSE_SPLINES
1088 #if WXWIN_COMPATIBILITY_2_8
1089 // for compatibility with the old code when wxCoord was long everywhere
1090 wxDEPRECATED( void GetTextExtent(const wxString
& string
,
1092 long *descent
= NULL
,
1093 long *externalLeading
= NULL
,
1094 const wxFont
*theFont
= NULL
) const );
1095 wxDEPRECATED( void GetLogicalOrigin(long *x
, long *y
) const );
1096 wxDEPRECATED( void GetDeviceOrigin(long *x
, long *y
) const );
1097 wxDEPRECATED( void GetClippingBox(long *x
, long *y
, long *w
, long *h
) const );
1098 #endif // WXWIN_COMPATIBILITY_2_8
1102 // ctor takes ownership of the pointer
1103 wxDC(wxDCImpl
*pimpl
) : m_pimpl(pimpl
) { }
1105 wxDCImpl
* const m_pimpl
;
1108 DECLARE_ABSTRACT_CLASS(wxDC
)
1109 DECLARE_NO_COPY_CLASS(wxDC
)
1112 // ----------------------------------------------------------------------------
1113 // helper class: you can use it to temporarily change the DC text colour and
1114 // restore it automatically when the object goes out of scope
1115 // ----------------------------------------------------------------------------
1117 class WXDLLIMPEXP_CORE wxDCTextColourChanger
1120 wxDCTextColourChanger(wxDC
& dc
) : m_dc(dc
), m_colFgOld() { }
1122 wxDCTextColourChanger(wxDC
& dc
, const wxColour
& col
) : m_dc(dc
)
1127 ~wxDCTextColourChanger()
1129 if ( m_colFgOld
.Ok() )
1130 m_dc
.SetTextForeground(m_colFgOld
);
1133 void Set(const wxColour
& col
)
1135 if ( !m_colFgOld
.Ok() )
1136 m_colFgOld
= m_dc
.GetTextForeground();
1137 m_dc
.SetTextForeground(col
);
1143 wxColour m_colFgOld
;
1145 DECLARE_NO_COPY_CLASS(wxDCTextColourChanger
)
1148 // ----------------------------------------------------------------------------
1149 // helper class: you can use it to temporarily change the DC pen and
1150 // restore it automatically when the object goes out of scope
1151 // ----------------------------------------------------------------------------
1153 class WXDLLIMPEXP_CORE wxDCPenChanger
1156 wxDCPenChanger(wxDC
& dc
, const wxPen
& pen
) : m_dc(dc
), m_penOld(dc
.GetPen())
1163 if ( m_penOld
.Ok() )
1164 m_dc
.SetPen(m_penOld
);
1172 DECLARE_NO_COPY_CLASS(wxDCPenChanger
)
1175 // ----------------------------------------------------------------------------
1176 // helper class: you can use it to temporarily change the DC brush and
1177 // restore it automatically when the object goes out of scope
1178 // ----------------------------------------------------------------------------
1180 class WXDLLIMPEXP_CORE wxDCBrushChanger
1183 wxDCBrushChanger(wxDC
& dc
, const wxBrush
& brush
) : m_dc(dc
), m_brushOld(dc
.GetBrush())
1185 m_dc
.SetBrush(brush
);
1190 if ( m_brushOld
.Ok() )
1191 m_dc
.SetBrush(m_brushOld
);
1199 DECLARE_NO_COPY_CLASS(wxDCBrushChanger
)
1202 // ----------------------------------------------------------------------------
1203 // another small helper class: sets the clipping region in its ctor and
1204 // destroys it in the dtor
1205 // ----------------------------------------------------------------------------
1207 class WXDLLIMPEXP_CORE wxDCClipper
1210 wxDCClipper(wxDC
& dc
, const wxRegion
& r
) : m_dc(dc
)
1211 { dc
.SetClippingRegion(r
); }
1212 wxDCClipper(wxDC
& dc
, const wxRect
& r
) : m_dc(dc
)
1213 { dc
.SetClippingRegion(r
.x
, r
.y
, r
.width
, r
.height
); }
1214 wxDCClipper(wxDC
& dc
, wxCoord x
, wxCoord y
, wxCoord w
, wxCoord h
) : m_dc(dc
)
1215 { dc
.SetClippingRegion(x
, y
, w
, h
); }
1217 ~wxDCClipper() { m_dc
.DestroyClippingRegion(); }
1222 DECLARE_NO_COPY_CLASS(wxDCClipper
)
1225 #endif // _WX_DC_H_BASE_