+wxRegion::~wxRegion()
+{
+ // m_refData unrefed in ~wxObject
+}
+
+wxObjectRefData *wxRegion::CreateRefData() const
+{
+ return new wxRegionRefData;
+}
+
+wxObjectRefData *wxRegion::CloneRefData(const wxObjectRefData *data) const
+{
+ return new wxRegionRefData(*(wxRegionRefData *)data);
+}
+
+// ----------------------------------------------------------------------------
+// wxRegion comparison
+// ----------------------------------------------------------------------------
+
+bool wxRegion::DoIsEqual(const wxRegion& region) const
+{
+ return gdk_region_equal(M_REGIONDATA->m_region,
+ M_REGIONDATA_OF(region)->m_region);
+}
+
+// ----------------------------------------------------------------------------
+// wxRegion operations
+// ----------------------------------------------------------------------------
+
+void wxRegion::Clear()
+{
+ UnRef();
+}
+
+bool wxRegion::DoUnionWithRect(const wxRect& r)
+{
+ // workaround for a strange GTK/X11 bug: taking union with an empty
+ // rectangle results in an empty region which is definitely not what we
+ // want
+ if ( r.IsEmpty() )
+ return true;
+
+ if ( !m_refData )
+ {
+ InitRect(r.x, r.y, r.width, r.height);
+ }
+ else
+ {
+ AllocExclusive();
+
+ GdkRectangle rect;
+ rect.x = r.x;
+ rect.y = r.y;
+ rect.width = r.width;
+ rect.height = r.height;
+
+ gdk_region_union_with_rect( M_REGIONDATA->m_region, &rect );
+ }
+
+ return true;
+}