// headers
// ----------------------------------------------------------------------------
-#include "wx/region.h"
+#include "wx/log.h"
-#include <gdk/gdk.h>
-#include <gtk/gtk.h>
+#include "wx/region.h"
-#include "wx/log.h"
+#include "wx/gtk/private.h"
// ----------------------------------------------------------------------------
// wxRegionRefData: private class containing the information about the region
m_refData = new wxRegionRefData();
#ifdef __WXGTK20__
- M_REGIONDATA->m_region = gdk_region_rectangle( rect );
+ M_REGIONDATA->m_region = gdk_region_rectangle( &rect );
#else
GdkRegion *reg = gdk_region_new();
M_REGIONDATA->m_region = gdk_region_union_with_rect( reg, &rect );
{
return new wxRegionRefData(*(wxRegionRefData *)data);
}
+
// ----------------------------------------------------------------------------
// wxRegion comparison
// ----------------------------------------------------------------------------
bool wxRegion::operator==( const wxRegion& region )
{
+ if (m_refData == region.m_refData) return TRUE;
+
+ if (!m_refData || !region.m_refData) return FALSE;
+
// compare the regions themselves, not the pointers to ref data!
return gdk_region_equal(M_REGIONDATA->m_region,
M_REGIONDATA_OF(region)->m_region);
}
-bool wxRegion::operator != ( const wxRegion& region )
-{
- return !(*this == region);
-}
-
// ----------------------------------------------------------------------------
// wxRegion operations
// ----------------------------------------------------------------------------
{
m_refData = new wxRegionRefData();
#ifdef __WXGTK20__
- M_REGIONDATA->m_region = gdk_region_rectangle( rect );
+ M_REGIONDATA->m_region = gdk_region_rectangle( &rect );
#else
GdkRegion *reg = gdk_region_new();
M_REGIONDATA->m_region = gdk_region_union_with_rect( reg, &rect );
if (!gdkregion) return;
#ifdef __WXGTK20__
- GdkRectangles *gdkrects = NULL;
+ GdkRectangle *gdkrects = NULL;
gint numRects = 0;
- gdk_region_get_rectangles( gdkregion, &gdkrect, &numRects );
+ gdk_region_get_rectangles( gdkregion, &gdkrects, &numRects );
m_numRects = numRects;
if (numRects)
wr.height = gr.height;
}
}
- g_delete( gdkrects ); // delete []
-#else
+ g_free( gdkrects );
+#else // GTK+ 1.x
Region r = ((GdkRegionPrivate *)gdkregion)->xregion;
if (r)
{
}
}
}
-#endif
+#endif // GTK+ 2.0/1.x
}
wxRegionIterator::wxRegionIterator()