#include "wx/region.h"
-#include "gdk/gdk.h"
-#include "gtk/gtk.h"
+#include <gdk/gdk.h>
+#include <gtk/gtk.h>
-#ifdef __WXDEBUG__
-#ifdef NULL
-#undef NULL
-#endif
-#define NULL ((void*)0L)
-#endif
//-----------------------------------------------------------------------------
// wxRegion
class wxRegionRefData: public wxObjectRefData
{
- public:
-
- wxRegionRefData(void);
- ~wxRegionRefData(void);
+public:
+ wxRegionRefData();
+ ~wxRegionRefData();
- public:
-
GdkRegion *m_region;
wxList m_rects;
};
-wxRegionRefData::wxRegionRefData(void)
+wxRegionRefData::wxRegionRefData()
{
m_region = (GdkRegion *) NULL;
}
-wxRegionRefData::~wxRegionRefData(void)
+wxRegionRefData::~wxRegionRefData()
{
if (m_region) gdk_region_destroy( m_region );
}
}
-wxRegion::wxRegion(void)
+wxRegion::wxRegion()
{
m_refData = new wxRegionRefData();
M_REGIONDATA->m_region = gdk_region_new();
}
-wxRegion::~wxRegion(void)
+wxRegion::~wxRegion()
{
}
return m_refData != region.m_refData;
}
-void wxRegion::Clear(void)
+void wxRegion::Clear()
{
UnRef();
m_refData = new wxRegionRefData();
y = 0;
w = -1;
h = -1;
- wxNode *node = GetRectList()->First();
- while (node)
- {
- wxRect *r = (wxRect*)node->Data();
- if (node == GetRectList()->First())
- {
- x = r->x;
- y = r->y;
- w = r->width;
- h = r->height;
- }
- else
- {
- if (r->x < x)
- {
- x = r->x;
- w += x - r->x;
- }
- if (r->y < y)
- {
- y = r->y;
- h += y - r->y;
- }
- if (r->width+r->x > x+w)
- {
- w = r->x + r->width - x;
- }
- if (r->height+r->y > y+h)
- {
- h = r->y + r->height - y;
- }
- }
- node = node->Next();
- }
+ GdkRectangle rect;
+ gdk_region_get_clipbox( M_REGIONDATA->m_region, &rect );
+ x = rect.x;
+ y = rect.y;
+ w = rect.width;
+ h = rect.height;
}
-wxRect wxRegion::GetBox(void) const
+wxRect wxRegion::GetBox() const
{
long x = 0;
long y = 0;
return wxRect( x, y, w, h );
}
-bool wxRegion::Empty(void) const
+bool wxRegion::Empty() const
{
return gdk_region_empty( M_REGIONDATA->m_region );
}
return Contains( rect.x, rect.y, rect.width, rect.height );
}
-GdkRegion *wxRegion::GetRegion(void) const
+GdkRegion *wxRegion::GetRegion() const
{
return M_REGIONDATA->m_region;
}
IMPLEMENT_DYNAMIC_CLASS(wxRegionIterator,wxObject);
-wxRegionIterator::wxRegionIterator(void)
+wxRegionIterator::wxRegionIterator()
{
m_current = 0;
}
m_current = 0;
}
-wxRegionIterator::operator bool (void) const
+wxRegionIterator::operator bool () const
{
return m_current < m_region.GetRectList()->Number();
}
-bool wxRegionIterator::HaveRects(void) const
+bool wxRegionIterator::HaveRects() const
{
return m_current < m_region.GetRectList()->Number();
}
-void wxRegionIterator::operator ++ (void)
+void wxRegionIterator::operator ++ ()
{
if (m_current < m_region.GetRectList()->Number()) ++m_current;
}
if (m_current < m_region.GetRectList()->Number()) ++m_current;
}
-long wxRegionIterator::GetX(void) const
+wxCoord wxRegionIterator::GetX() const
{
wxNode *node = m_region.GetRectList()->Nth( m_current );
if (!node) return 0;
return r->x;
}
-long wxRegionIterator::GetY(void) const
+wxCoord wxRegionIterator::GetY() const
{
wxNode *node = m_region.GetRectList()->Nth( m_current );
if (!node) return 0;
return r->y;
}
-long wxRegionIterator::GetW(void) const
+wxCoord wxRegionIterator::GetW() const
{
wxNode *node = m_region.GetRectList()->Nth( m_current );
if (!node) return 0;
return r->width;
}
-long wxRegionIterator::GetH(void) const
+wxCoord wxRegionIterator::GetH() const
{
wxNode *node = m_region.GetRectList()->Nth( m_current );
if (!node) return 0;