From e26be42b5c22746f21885b84866791505620f628 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 9 Jul 2001 18:37:03 +0000 Subject: [PATCH] added wxDCClipper git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@10919 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/dc.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/include/wx/dc.h b/include/wx/dc.h index 667284b041..b856ef7f83 100644 --- a/include/wx/dc.h +++ b/include/wx/dc.h @@ -776,5 +776,24 @@ private: wxColour m_colFgOld; }; +// ---------------------------------------------------------------------------- +// another small helper class: sets the clipping region in its ctor and +// destroys it in the dtor +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxDCClipper +{ +public: + wxDCClipper(wxDC& dc, const wxRect& r) : m_dc(dc) + { dc.SetClippingRegion(r.x, r.y, r.width, r.height); } + wxDCClipper(wxDC& dc, wxCoord x, wxCoord y, wxCoord w, wxCoord h) : m_dc(dc) + { dc.SetClippingRegion(x, y, w, h); } + + ~wxDCClipper() { m_dc.DestroyClippingRegion(); } + +private: + wxDC& m_dc; +}; + #endif // _WX_DC_H_BASE_ -- 2.45.2