2004-03-23 12:35:05 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: region.h
|
|
|
|
// Purpose: wxRegion class
|
|
|
|
// Author: Stefan Csomor
|
|
|
|
// Modified by:
|
|
|
|
// Created: 1998-01-01
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
// Copyright: (c) Stefan Csomor
|
2004-05-23 16:53:33 -04:00
|
|
|
// Licence: wxWindows licence
|
2004-03-23 12:35:05 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2006-09-25 07:47:23 -04:00
|
|
|
#ifndef _WX_MAC_CARBON_REGION_H_
|
|
|
|
#define _WX_MAC_CARBON_REGION_H_
|
2004-03-23 12:35:05 -05:00
|
|
|
|
|
|
|
#include "wx/list.h"
|
|
|
|
|
2006-09-25 07:47:23 -04:00
|
|
|
class WXDLLEXPORT wxRegion : public wxRegionWithCombine
|
|
|
|
{
|
2004-03-23 12:35:05 -05:00
|
|
|
public:
|
|
|
|
wxRegion(long x, long y, long w, long h);
|
|
|
|
wxRegion(const wxPoint& topLeft, const wxPoint& bottomRight);
|
|
|
|
wxRegion(const wxRect& rect);
|
|
|
|
wxRegion( WXHRGN hRegion );
|
2004-07-27 07:28:20 -04:00
|
|
|
wxRegion(size_t n, const wxPoint *points, int fillStyle = wxODDEVEN_RULE );
|
2004-03-23 12:35:05 -05:00
|
|
|
wxRegion();
|
2004-06-03 17:13:52 -04:00
|
|
|
wxRegion(const wxBitmap& bmp)
|
|
|
|
{
|
|
|
|
Union(bmp);
|
|
|
|
}
|
|
|
|
wxRegion(const wxBitmap& bmp,
|
|
|
|
const wxColour& transColour, int tolerance = 0)
|
2004-03-23 12:35:05 -05:00
|
|
|
{
|
|
|
|
Union(bmp, transColour, tolerance);
|
|
|
|
}
|
|
|
|
|
2006-09-05 16:47:48 -04:00
|
|
|
virtual ~wxRegion();
|
2004-03-23 12:35:05 -05:00
|
|
|
|
2006-09-25 07:47:23 -04:00
|
|
|
// wxRegionBase methods
|
|
|
|
virtual void Clear();
|
|
|
|
virtual bool IsEmpty() const;
|
2004-03-23 12:35:05 -05:00
|
|
|
|
|
|
|
// Internal
|
|
|
|
const WXHRGN GetWXHRGN() const ;
|
2006-09-25 07:47:23 -04:00
|
|
|
|
|
|
|
protected:
|
|
|
|
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);
|
|
|
|
|
|
|
|
private:
|
|
|
|
DECLARE_DYNAMIC_CLASS(wxRegion)
|
|
|
|
friend class WXDLLEXPORT wxRegionIterator;
|
2004-03-23 12:35:05 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
class WXDLLEXPORT wxRegionIterator : public wxObject
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
wxRegionIterator();
|
|
|
|
wxRegionIterator(const wxRegion& region);
|
|
|
|
wxRegionIterator(const wxRegionIterator& iterator);
|
2006-09-05 16:47:48 -04:00
|
|
|
virtual ~wxRegionIterator();
|
2004-03-23 12:35:05 -05:00
|
|
|
|
|
|
|
wxRegionIterator& operator=(const wxRegionIterator& iterator);
|
|
|
|
|
|
|
|
void Reset() { m_current = 0; }
|
|
|
|
void Reset(const wxRegion& region);
|
|
|
|
|
|
|
|
operator bool () const { return m_current < m_numRects; }
|
|
|
|
bool HaveRects() const { return m_current < m_numRects; }
|
|
|
|
|
|
|
|
wxRegionIterator& operator++();
|
|
|
|
wxRegionIterator operator++(int);
|
|
|
|
|
|
|
|
long GetX() const;
|
|
|
|
long GetY() const;
|
|
|
|
long GetW() const;
|
|
|
|
long GetWidth() const { return GetW(); }
|
|
|
|
long GetH() const;
|
|
|
|
long GetHeight() const { return GetH(); }
|
|
|
|
wxRect GetRect() const { return wxRect(GetX(), GetY(), GetWidth(), GetHeight()); }
|
2006-09-25 07:47:23 -04:00
|
|
|
|
2004-03-23 12:35:05 -05:00
|
|
|
private:
|
|
|
|
void SetRects(long numRects, wxRect *rects);
|
|
|
|
|
|
|
|
long m_current;
|
|
|
|
long m_numRects;
|
|
|
|
wxRegion m_region;
|
|
|
|
wxRect* m_rects;
|
2006-09-25 07:47:23 -04:00
|
|
|
|
|
|
|
DECLARE_DYNAMIC_CLASS(wxRegionIterator)
|
2004-03-23 12:35:05 -05:00
|
|
|
};
|
|
|
|
|
2006-09-25 07:47:23 -04:00
|
|
|
#endif // _WX_MAC_CARBON_REGION_H_
|