1998-05-20 10:12:05 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
2001-08-27 10:56:55 -04:00
|
|
|
// Name: wx/msw/region.h
|
1998-05-20 10:12:05 -04:00
|
|
|
// Purpose: wxRegion class
|
2003-03-17 05:34:04 -05:00
|
|
|
// Author: Julian Smart
|
1998-05-20 10:12:05 -04:00
|
|
|
// Modified by:
|
|
|
|
// Created: 01/02/97
|
|
|
|
// RCS-ID: $Id$
|
2004-05-23 10:56:36 -04:00
|
|
|
// Copyright: (c) 1997-2002 wxWidgets team
|
2004-05-23 16:53:33 -04:00
|
|
|
// Licence: wxWindows licence
|
1998-05-20 10:12:05 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2006-09-25 07:47:23 -04:00
|
|
|
#ifndef _WX_MSW_REGION_H_
|
|
|
|
#define _WX_MSW_REGION_H_
|
1998-05-20 10:12:05 -04:00
|
|
|
|
2008-03-26 11:06:00 -04:00
|
|
|
class WXDLLIMPEXP_CORE wxRegion : public wxRegionWithCombine
|
2001-08-27 10:56:55 -04:00
|
|
|
{
|
1998-05-20 10:12:05 -04:00
|
|
|
public:
|
2001-08-27 10:56:55 -04:00
|
|
|
wxRegion();
|
2000-02-06 07:12:25 -05:00
|
|
|
wxRegion(wxCoord x, wxCoord y, wxCoord w, wxCoord h);
|
1998-05-20 10:12:05 -04:00
|
|
|
wxRegion(const wxPoint& topLeft, const wxPoint& bottomRight);
|
|
|
|
wxRegion(const wxRect& rect);
|
1998-07-27 05:47:57 -04:00
|
|
|
wxRegion(WXHRGN hRegion); // Hangs on to this region
|
2009-01-08 11:43:56 -05:00
|
|
|
wxRegion(size_t n, const wxPoint *points, wxPolygonFillMode fillStyle = wxODDEVEN_RULE );
|
2007-07-20 22:05:03 -04:00
|
|
|
#if wxUSE_IMAGE
|
2004-06-03 17:13:52 -04:00
|
|
|
wxRegion( const wxBitmap& bmp)
|
|
|
|
{
|
|
|
|
Union(bmp);
|
|
|
|
}
|
2003-03-28 18:05:05 -05:00
|
|
|
wxRegion( const wxBitmap& bmp,
|
2004-06-03 17:13:52 -04:00
|
|
|
const wxColour& transColour, int tolerance = 0)
|
2003-03-28 18:05:05 -05:00
|
|
|
{
|
|
|
|
Union(bmp, transColour, tolerance);
|
|
|
|
}
|
2007-07-20 22:05:03 -04:00
|
|
|
#endif // wxUSE_IMAGE
|
1998-05-20 10:12:05 -04:00
|
|
|
|
2001-08-27 10:56:55 -04:00
|
|
|
virtual ~wxRegion();
|
1998-05-20 10:12:05 -04:00
|
|
|
|
2006-09-25 07:47:23 -04:00
|
|
|
// wxRegionBase methods
|
|
|
|
virtual void Clear();
|
|
|
|
virtual bool IsEmpty() const;
|
1998-12-02 15:02:01 -05:00
|
|
|
|
|
|
|
// Get internal region handle
|
|
|
|
WXHRGN GetHRGN() const;
|
2001-08-27 10:56:55 -04:00
|
|
|
|
2002-01-31 11:00:13 -05:00
|
|
|
protected:
|
2007-12-15 12:54:20 -05:00
|
|
|
virtual wxGDIRefData *CreateGDIRefData() const;
|
|
|
|
virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const;
|
2002-01-31 11:00:13 -05:00
|
|
|
|
2006-09-25 07:47:23 -04:00
|
|
|
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 DoCombine(const wxRegion& region, wxRegionOp op);
|
|
|
|
|
2007-07-09 06:09:52 -04:00
|
|
|
friend class WXDLLIMPEXP_FWD_CORE wxRegionIterator;
|
2002-01-31 11:00:13 -05:00
|
|
|
|
|
|
|
DECLARE_DYNAMIC_CLASS(wxRegion)
|
1998-05-20 10:12:05 -04:00
|
|
|
};
|
|
|
|
|
2008-03-26 11:06:00 -04:00
|
|
|
class WXDLLIMPEXP_CORE wxRegionIterator : public wxObject
|
2001-08-27 10:56:55 -04:00
|
|
|
{
|
1998-05-20 10:12:05 -04:00
|
|
|
public:
|
2002-12-04 09:11:26 -05:00
|
|
|
wxRegionIterator() { Init(); }
|
2001-08-27 10:56:55 -04:00
|
|
|
wxRegionIterator(const wxRegion& region);
|
2004-09-16 18:36:12 -04:00
|
|
|
wxRegionIterator(const wxRegionIterator& ri) : wxObject(ri) { Init(); *this = ri; }
|
1998-05-20 10:12:05 -04:00
|
|
|
|
2002-12-04 09:11:26 -05:00
|
|
|
wxRegionIterator& operator=(const wxRegionIterator& ri);
|
|
|
|
|
|
|
|
virtual ~wxRegionIterator();
|
|
|
|
|
|
|
|
void Reset() { m_current = 0; }
|
2001-08-27 10:56:55 -04:00
|
|
|
void Reset(const wxRegion& region);
|
1998-05-20 10:12:05 -04:00
|
|
|
|
2002-12-04 09:11:26 -05:00
|
|
|
bool HaveRects() const { return (m_current < m_numRects); }
|
|
|
|
|
|
|
|
operator bool () const { return HaveRects(); }
|
1999-01-15 19:13:58 -05:00
|
|
|
|
2002-12-04 09:11:26 -05:00
|
|
|
wxRegionIterator& operator++();
|
|
|
|
wxRegionIterator operator++(int);
|
1998-05-20 10:12:05 -04:00
|
|
|
|
2002-12-04 09:11:26 -05:00
|
|
|
wxCoord GetX() const;
|
|
|
|
wxCoord GetY() const;
|
|
|
|
wxCoord GetW() const;
|
|
|
|
wxCoord GetWidth() const { return GetW(); }
|
|
|
|
wxCoord GetH() const;
|
|
|
|
wxCoord GetHeight() const { return GetH(); }
|
1998-05-20 10:12:05 -04:00
|
|
|
|
2002-12-04 09:11:26 -05:00
|
|
|
wxRect GetRect() const { return wxRect(GetX(), GetY(), GetW(), GetH()); }
|
1998-05-20 10:12:05 -04:00
|
|
|
|
|
|
|
private:
|
2002-12-04 09:11:26 -05:00
|
|
|
// common part of all ctors
|
|
|
|
void Init();
|
|
|
|
|
2001-08-27 10:56:55 -04:00
|
|
|
long m_current;
|
|
|
|
long m_numRects;
|
|
|
|
wxRegion m_region;
|
1998-05-20 10:12:05 -04:00
|
|
|
wxRect* m_rects;
|
2001-08-27 10:56:55 -04:00
|
|
|
|
2003-08-05 15:20:51 -04:00
|
|
|
DECLARE_DYNAMIC_CLASS(wxRegionIterator)
|
1998-05-20 10:12:05 -04:00
|
|
|
};
|
|
|
|
|
2006-09-25 07:47:23 -04:00
|
|
|
#endif // _WX_MSW_REGION_H_
|