+wxRegionContain wxRegion::Contains(const wxPoint& pt) const
+{
+ return Contains( pt.x, pt.y );
+}
+
+wxRegionContain wxRegion::Contains(const wxRect& rect) const
+{
+ return Contains( rect.x, rect.y, rect.width, rect.height );
+}
+
+GdkRegion *wxRegion::GetRegion() const
+{
+ if (!m_refData)
+ return (GdkRegion*) NULL;
+
+ return M_REGIONDATA->m_region;
+}
+
+wxList *wxRegion::GetRectList() const
+{
+#if OLDCODE
+ if (!m_refData)
+ return (wxList*) NULL;
+
+ return &(M_REGIONDATA->m_rects);
+#else
+ return (wxList*) NULL;
+#endif
+}
+
+// ----------------------------------------------------------------------------
+// wxRegionIterator
+// ----------------------------------------------------------------------------
+
+#if OLDCODE
+
+wxRegionIterator::wxRegionIterator()
+{
+ Reset();
+}
+
+wxRegionIterator::wxRegionIterator( const wxRegion& region )
+{
+ Reset(region);
+}
+
+void wxRegionIterator::Reset( const wxRegion& region )
+{
+ m_region = region;
+ Reset();
+}
+
+wxRegionIterator::operator bool () const
+{
+ return m_region.GetRectList() && m_current < (size_t)m_region.GetRectList()->Number();
+}
+
+bool wxRegionIterator::HaveRects() const
+{
+ return m_region.GetRectList() && m_current < (size_t)m_region.GetRectList()->Number();
+}
+
+void wxRegionIterator::operator ++ ()
+{
+ if (HaveRects()) ++m_current;
+}
+
+void wxRegionIterator::operator ++ (int)
+{
+ if (HaveRects()) ++m_current;
+}
+
+wxCoord wxRegionIterator::GetX() const
+{
+ wxNode *node = m_region.GetRectList()->Nth( m_current );
+ if (!node) return 0;
+ wxRect *r = (wxRect*)node->Data();
+ return r->x;
+}
+
+wxCoord wxRegionIterator::GetY() const
+{
+ wxNode *node = m_region.GetRectList()->Nth( m_current );
+ if (!node) return 0;
+ wxRect *r = (wxRect*)node->Data();
+ return r->y;
+}
+
+wxCoord wxRegionIterator::GetW() const
+{
+ wxNode *node = m_region.GetRectList()->Nth( m_current );
+ if (!node) return 0;
+ wxRect *r = (wxRect*)node->Data();
+ return r->width;
+}
+
+wxCoord wxRegionIterator::GetH() const
+{
+ wxNode *node = m_region.GetRectList()->Nth( m_current );
+ if (!node) return 0;
+ wxRect *r = (wxRect*)node->Data();
+ return r->height;
+}
+
+#else
+
+// the following structures must match the private structures
+// in X11 region code ( xc/lib/X11/region.h )
+
+// this makes the Region type transparent
+// and we have access to the region rectangles
+
+struct _XBox {
+ short x1, x2, y1, y2;
+};
+
+struct _XRegion {
+ long size , numRects;
+ _XBox *rects, extents;
+};
+
+class wxRIRefData: public wxObjectRefData
+{
+public:
+
+ wxRIRefData() : m_rects(0), m_numRects(0){}
+ ~wxRIRefData();
+
+ wxRect *m_rects;
+ size_t m_numRects;
+
+ void CreateRects( const wxRegion& r );
+};
+
+wxRIRefData::~wxRIRefData()
+{
+ delete m_rects;
+}
+
+#include <gdk/gdkprivate.h>
+
+void wxRIRefData::CreateRects( const wxRegion& region )