X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/2bda0e173844e8e0f8acf4e8ad8b5c26e5c6fe5d..71b8c213cb2c676b4715ef37e6155da3601f7881:/src/msw/region.cpp diff --git a/src/msw/region.cpp b/src/msw/region.cpp index b5e7227e1a..56846e68dd 100644 --- a/src/msw/region.cpp +++ b/src/msw/region.cpp @@ -1,7 +1,8 @@ ///////////////////////////////////////////////////////////////////////////// -// File: region.cpp +// Name: msw/region.cpp // Purpose: Region handling for wxWindows/X11 // Author: Markus Holzem +// Modified by: // Created: Fri Oct 24 10:46:34 MET 1997 // RCS-ID: $Id$ // Copyright: (c) 1997 Julian Smart and Markus Holzem @@ -12,6 +13,7 @@ #pragma implementation "region.h" #endif +// For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" #ifdef __BORLANDC__ @@ -36,6 +38,7 @@ class WXDLLEXPORT wxRegionRefData : public wxGDIRefData { public: wxRegionRefData(void) { + m_region = 0; } wxRegionRefData(const wxRegionRefData& data) @@ -77,6 +80,12 @@ wxRegion::wxRegion(void) M_REGION = ::CreateRectRgn(0, 0, 0, 0); } +wxRegion::wxRegion(WXHRGN hRegion) +{ + m_refData = new wxRegionRefData; + M_REGION = (HRGN) hRegion; +} + wxRegion::wxRegion(long x, long y, long w, long h) { m_refData = new wxRegionRefData; @@ -279,6 +288,14 @@ wxRegionContain wxRegion::Contains(const wxRect& rect) const return Contains(x, y, w, h); } +// Get internal region handle +WXHRGN wxRegion::GetHRGN() const +{ + if (!m_refData) + return (WXHRGN) 0; + return (WXHRGN) M_REGION; +} + /////////////////////////////////////////////////////////////////////////////// // // // wxRegionIterator // @@ -334,13 +351,13 @@ void wxRegionIterator::Reset(const wxRegion& region) m_rects = new wxRect[header->nCount]; - RECT* rect = (RECT*) (rgnData + sizeof(RGNDATAHEADER)) ; - uint i; + RECT* rect = (RECT*) ((char*)rgnData + sizeof(RGNDATAHEADER)) ; + size_t i; for (i = 0; i < header->nCount; i++) { m_rects[i] = wxRect(rect->left, rect->top, rect->right - rect->left, rect->bottom - rect->top); - rect += sizeof(RECT); + rect ++; // Advances pointer by sizeof(RECT) } m_numRects = header->nCount;