2001-06-26 21:05:06 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: region.h
|
|
|
|
// Purpose: wxRegion class
|
|
|
|
// Author: Vaclav Slavik
|
|
|
|
// Created: 2001/03/12
|
|
|
|
// RCS-ID: $Id$
|
2002-02-14 20:30:34 +00:00
|
|
|
// Copyright: (c) 2001-2002 SciTech Software, Inc. (www.scitechsoft.com)
|
2004-05-23 20:53:33 +00:00
|
|
|
// Licence: wxWindows licence
|
2001-06-26 21:05:06 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2006-09-25 11:47:23 +00:00
|
|
|
#ifndef _WX_MGL_REGION_H_
|
|
|
|
#define _WX_MGL_REGION_H_
|
2001-06-26 21:05:06 +00:00
|
|
|
|
|
|
|
#include "wx/list.h"
|
|
|
|
|
|
|
|
class MGLRegion;
|
|
|
|
|
2006-09-25 11:47:23 +00:00
|
|
|
class WXDLLEXPORT wxRegion : public wxRegionBase
|
2001-06-26 21:05:06 +00:00
|
|
|
{
|
|
|
|
public:
|
2006-09-25 11:47:23 +00:00
|
|
|
wxRegion();
|
2001-06-26 21:05:06 +00:00
|
|
|
wxRegion(wxCoord x, wxCoord y, wxCoord w, wxCoord h);
|
|
|
|
wxRegion(const wxPoint& topLeft, const wxPoint& bottomRight);
|
|
|
|
wxRegion(const wxRect& rect);
|
|
|
|
wxRegion(const MGLRegion& region);
|
2004-06-03 21:13:52 +00:00
|
|
|
wxRegion( const wxBitmap& bmp)
|
|
|
|
{
|
|
|
|
Union(bmp);
|
|
|
|
}
|
2003-03-28 23:05:05 +00:00
|
|
|
wxRegion( const wxBitmap& bmp,
|
2004-06-03 21:13:52 +00:00
|
|
|
const wxColour& transColour, int tolerance = 0)
|
2003-03-28 23:05:05 +00:00
|
|
|
{
|
|
|
|
Union(bmp, transColour, tolerance);
|
|
|
|
}
|
2001-06-26 21:05:06 +00:00
|
|
|
|
2006-09-05 20:47:48 +00:00
|
|
|
virtual ~wxRegion();
|
2001-06-26 21:05:06 +00:00
|
|
|
|
2006-09-25 11:47:23 +00:00
|
|
|
// wxRegionBase methods
|
|
|
|
virtual void Clear();
|
|
|
|
virtual bool IsEmpty() const;
|
2003-03-28 23:05:05 +00:00
|
|
|
|
2001-06-26 21:05:06 +00:00
|
|
|
// implementation from now on:
|
|
|
|
const MGLRegion& GetMGLRegion() const;
|
2002-02-09 23:29:05 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
// ref counting code
|
|
|
|
virtual wxObjectRefData *CreateRefData() const;
|
|
|
|
virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const;
|
2006-09-25 11:47:23 +00:00
|
|
|
|
|
|
|
// wxRegionBase pure virtuals
|
|
|
|
virtual bool DoIsEqual(const wxRegion& region) const;
|
|
|
|
virtual bool DoGetBox(wxCoord& x, wxCoord& y, wxCoord& w, wxCoord& h) const;
|
|
|
|
virtual wxRegionContain DoContainsPoint(wxCoord x, wxCoord y) const;
|
|
|
|
virtual wxRegionContain DoContainsRect(const wxRect& rect) const;
|
|
|
|
|
|
|
|
virtual bool DoOffset(wxCoord x, wxCoord y);
|
|
|
|
virtual bool DoUnionWithRect(const wxRect& rect);
|
|
|
|
virtual bool DoUnionWithRegion(const wxRegion& region);
|
|
|
|
virtual bool DoIntersect(const wxRegion& region);
|
|
|
|
virtual bool DoSubtract(const wxRegion& region);
|
|
|
|
virtual bool DoXor(const wxRegion& region);
|
|
|
|
|
|
|
|
private:
|
|
|
|
DECLARE_DYNAMIC_CLASS(wxRegion);
|
|
|
|
friend class WXDLLEXPORT wxRegionIterator;
|
2001-06-26 21:05:06 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
WX_DECLARE_EXPORTED_LIST(wxRect, wxRegionRectList);
|
|
|
|
|
2003-03-28 23:05:05 +00:00
|
|
|
class WXDLLEXPORT wxRegionIterator : public wxObject
|
2001-06-26 21:05:06 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
wxRegionIterator(void);
|
|
|
|
wxRegionIterator(const wxRegion& region);
|
2006-09-05 20:47:48 +00:00
|
|
|
virtual ~wxRegionIterator(void);
|
2001-06-26 21:05:06 +00:00
|
|
|
|
|
|
|
void Reset(void) { m_currentNode = NULL; }
|
|
|
|
void Reset(const wxRegion& region);
|
|
|
|
|
|
|
|
operator bool (void) const { return (m_currentNode != NULL); }
|
|
|
|
|
|
|
|
bool HaveRects(void) const { return (m_currentNode != NULL); }
|
|
|
|
|
|
|
|
void operator ++ (void);
|
|
|
|
void operator ++ (int);
|
|
|
|
|
|
|
|
wxCoord GetX(void) const;
|
|
|
|
wxCoord GetY(void) const;
|
|
|
|
wxCoord GetW(void) const;
|
|
|
|
wxCoord GetWidth(void) const { return GetW(); }
|
|
|
|
wxCoord GetH(void) const;
|
|
|
|
wxCoord GetHeight(void) const { return GetH(); }
|
|
|
|
wxRect GetRect() const { return wxRect(GetX(), GetY(), GetWidth(), GetHeight()); }
|
|
|
|
|
|
|
|
private:
|
|
|
|
wxRegionRectList m_rects;
|
|
|
|
wxRegionRectList::Node *m_currentNode;
|
2006-09-25 11:47:23 +00:00
|
|
|
|
|
|
|
DECLARE_DYNAMIC_CLASS(wxRegionIterator);
|
2001-06-26 21:05:06 +00:00
|
|
|
};
|
|
|
|
|
2006-09-25 11:47:23 +00:00
|
|
|
#endif // _WX_MGL_REGION_H_
|