m_region = regCopy;
#endif
+#if OLDCODE
wxNode *node = refData.m_rects.First();
while (node)
{
m_rects.Append( (wxObject*) new wxRect(*r) );
node = node->Next();
}
+#endif
}
wxRegionRefData::~wxRegionRefData()
#define M_REGIONDATA ((wxRegionRefData *)m_refData)
-IMPLEMENT_DYNAMIC_CLASS(wxRegion,wxGDIObject);
-
wxRegion::wxRegion()
{
}
#endif
}
+wxRegion::wxRegion( size_t n, const wxPoint *points, int fillStyle )
+{
+ GdkPoint *gdkpoints = new GdkPoint[n];
+ for ( size_t i = 0 ; i < n ; i++ )
+ {
+ gdkpoints[i].x = points[i].x;
+ gdkpoints[i].y = points[i].y;
+ }
+
+ m_refData = new wxRegionRefData();
+
+ GdkRegion* reg = gdk_region_polygon
+ (
+ gdkpoints,
+ n,
+ fillStyle == wxWINDING_RULE ? GDK_WINDING_RULE
+ : GDK_EVEN_ODD_RULE
+ );
+
+ M_REGIONDATA->m_region = reg;
+
+ delete [] gdkpoints;
+}
+
wxRegion::~wxRegion()
{
}
}
// we need to update the rect list as well
+#if OLDCODE
wxList& list = *GetRectList();
wxNode *node = list.First();
while (node)
node = node->Next();
}
-
+#endif
return TRUE;
}
#if OLDCODE
-IMPLEMENT_DYNAMIC_CLASS(wxRegionIterator,wxObject);
-
wxRegionIterator::wxRegionIterator()
{
Reset();
}
}
-IMPLEMENT_DYNAMIC_CLASS(wxRegionIterator,wxObject);
-
wxRegionIterator::wxRegionIterator()
{
m_refData = new wxRIRefData();
wxRect wxRegionIterator::GetRect() const
{
wxRect r;
- wxNode *node = m_region.GetRectList()->Nth( m_current );
-
- if (node)
- r = *((wxRect*)node->Data());
+ if( HaveRects() )
+ r = ((wxRIRefData*)m_refData)->m_rects[m_current];
return r;
}