diff --git a/docs/latex/wx/region.tex b/docs/latex/wx/region.tex index 5b2cb77be1..e65055db79 100644 --- a/docs/latex/wx/region.tex +++ b/docs/latex/wx/region.tex @@ -1,3 +1,13 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Name: region.tex +%% Purpose: wxRegion documentation +%% Author: wxTeam +%% Created: +%% RCS-ID: $Id$ +%% Copyright: (c) wxTeam +%% License: wxWindows license +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + \section{\class{wxRegion}}\label{wxregion} A wxRegion represents a simple or complex region on a device context or window. It uses @@ -47,8 +57,6 @@ Constructs a region corresponding to the polygon made of {\it n} points in the provided array. {\it fillStyle} parameter may have values {\tt wxWINDING\_RULE} or {\tt wxODDEVEN\_RULE}. -{\bf NB:} This constructor is only implemented for Win32 and GTK+ wxWidgets ports. - \func{}{wxRegion}{\param{const wxBitmap\&}{ bmp}} \func{}{wxRegion}{\param{const wxBitmap\&}{ bmp}, @@ -384,4 +392,3 @@ Increment operator. Increments the iterator to the next region. Returns {\tt true} if there are still some rectangles; otherwise returns {\tt false}. You can use this to test the iterator object as if it were of type bool. - diff --git a/include/wx/mgl/region.h b/include/wx/mgl/region.h index 1bfd468fe5..35f3137f34 100644 --- a/include/wx/mgl/region.h +++ b/include/wx/mgl/region.h @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: region.h +// Name: wx/mgl/region.h // Purpose: wxRegion class // Author: Vaclav Slavik // Created: 2001/03/12 @@ -23,12 +23,13 @@ public: wxRegion(const wxPoint& topLeft, const wxPoint& bottomRight); wxRegion(const wxRect& rect); wxRegion(const MGLRegion& region); - wxRegion( const wxBitmap& bmp) + wxRegion(size_t n, const wxPoint *points, int fillStyle = wxODDEVEN_RULE ); + wxRegion(const wxBitmap& bmp) { Union(bmp); } - wxRegion( const wxBitmap& bmp, - const wxColour& transColour, int tolerance = 0) + wxRegion(const wxBitmap& bmp, + const wxColour& transColour, int tolerance = 0) { Union(bmp, transColour, tolerance); } diff --git a/src/aui/auibook.cpp b/src/aui/auibook.cpp index 7a0386ece7..5516db55c7 100644 --- a/src/aui/auibook.cpp +++ b/src/aui/auibook.cpp @@ -408,11 +408,11 @@ void wxAuiDefaultTabArt::DrawTab(wxDC& dc, clip_points[5] = wxPoint(tab_x+clip_width+1, tab_y+tab_height-3); // FIXME: these ports don't provide wxRegion ctor from array of points -#if !defined(__WXMGL__) && !defined(__WXDFB__) +#if !defined(__WXDFB__) // set the clipping region for the tab -- wxRegion clipping_region(WXSIZEOF(clip_points), clip_points); dc.SetClippingRegion(clipping_region); -#endif // !wxMGL && !wxDFB +#endif // !wxDFB wxPoint border_points[6]; border_points[0] = wxPoint(tab_x, tab_y+tab_height-4); diff --git a/src/mgl/region.cpp b/src/mgl/region.cpp index 1211a7a954..2604513a1e 100644 --- a/src/mgl/region.cpp +++ b/src/mgl/region.cpp @@ -102,6 +102,24 @@ wxRegion::wxRegion(const MGLRegion& region) M_REGION = region; } +wxRegion::wxRegion(size_t n, const wxPoint *points, int WXUNUSED(fillStyle)) +{ + m_refData = new wxRegionRefData; + point_t *pts = new point_t[n]; + + for (size_t i = 0; i < n; i++) + { + pts[i].x = points[i].x; + pts[i].y = points[i].y; + } + + region_t* rgn = MGL_rgnPolygon(n, pts, 1, 0, 0); + + M_REGION = rgn; + + delete [] pts; +} + wxRegion::~wxRegion() { // m_refData unrefed in ~wxObject