2001-06-26 17:05:06 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
2006-11-10 14:58:43 -05:00
|
|
|
// Name: wx/mgl/region.h
|
2001-06-26 17:05:06 -04:00
|
|
|
// Purpose: wxRegion class
|
|
|
|
// Author: Vaclav Slavik
|
|
|
|
// Created: 2001/03/12
|
|
|
|
// RCS-ID: $Id$
|
2002-02-14 15:30:34 -05:00
|
|
|
// Copyright: (c) 2001-2002 SciTech Software, Inc. (www.scitechsoft.com)
|
2004-05-23 16:53:33 -04:00
|
|
|
// Licence: wxWindows licence
|
2001-06-26 17:05:06 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2006-09-25 07:47:23 -04:00
|
|
|
#ifndef _WX_MGL_REGION_H_
|
|
|
|
#define _WX_MGL_REGION_H_
|
2001-06-26 17:05:06 -04:00
|
|
|
|
|
|
|
#include "wx/list.h"
|
|
|
|
|
|
|
|
class MGLRegion;
|
|
|
|
|
2006-09-25 07:47:23 -04:00
|
|
|
class WXDLLEXPORT wxRegion : public wxRegionBase
|
2001-06-26 17:05:06 -04:00
|
|
|
{
|
|
|
|
public:
|
2006-09-25 07:47:23 -04:00
|
|
|
wxRegion();
|
2001-06-26 17:05:06 -04: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);
|
2006-11-10 14:58:43 -05:00
|
|
|
wxRegion(size_t n, const wxPoint *points, int fillStyle = wxODDEVEN_RULE );
|
|
|
|
wxRegion(const wxBitmap& bmp)
|
2004-06-03 17:13:52 -04:00
|
|
|
{
|
|
|
|
Union(bmp);
|
|
|
|
}
|
2006-11-10 14:58:43 -05:00
|
|
|
wxRegion(const wxBitmap& bmp,
|
|
|
|
const wxColour& transColour, int tolerance = 0)
|
2003-03-28 18:05:05 -05:00
|
|
|
{
|
|
|
|
Union(bmp, transColour, tolerance);
|
|
|
|
}
|
2001-06-26 17:05:06 -04:00
|
|
|
|
2006-09-05 16:47:48 -04:00
|
|
|
virtual ~wxRegion();
|
2001-06-26 17:05:06 -04:00
|
|
|
|
2006-09-25 07:47:23 -04:00
|
|
|
// wxRegionBase methods
|
|
|
|
virtual void Clear();
|
|
|
|
virtual bool IsEmpty() const;
|
2003-03-28 18:05:05 -05:00
|
|
|
|
2001-06-26 17:05:06 -04:00
|
|
|
// implementation from now on:
|
|
|
|
const MGLRegion& GetMGLRegion() const;
|
2002-02-09 18:29:05 -05:00
|
|
|
|
|
|
|
protected:
|
2007-12-15 12:54:20 -05:00
|
|
|
virtual wxGDIRefData *CreateGDIRefData() const;
|
|
|
|
virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const;
|
2006-09-25 07:47:23 -04: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);
|
2007-07-09 06:09:52 -04:00
|
|
|
friend class WXDLLIMPEXP_FWD_CORE wxRegionIterator;
|
2001-06-26 17:05:06 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
WX_DECLARE_EXPORTED_LIST(wxRect, wxRegionRectList);
|
|
|
|
|
2003-03-28 18:05:05 -05:00
|
|
|
class WXDLLEXPORT wxRegionIterator : public wxObject
|
2001-06-26 17:05:06 -04:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
wxRegionIterator(void);
|
|
|
|
wxRegionIterator(const wxRegion& region);
|
2006-09-05 16:47:48 -04:00
|
|
|
virtual ~wxRegionIterator(void);
|
2001-06-26 17:05:06 -04: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 07:47:23 -04:00
|
|
|
|
|
|
|
DECLARE_DYNAMIC_CLASS(wxRegionIterator);
|
2001-06-26 17:05:06 -04:00
|
|
|
};
|
|
|
|
|
2006-09-25 07:47:23 -04:00
|
|
|
#endif // _WX_MGL_REGION_H_
|