]> git.saurik.com Git - wxWidgets.git/blame - include/wx/mgl/region.h
Applied patch [ 1845819 ] wxMSW Top level window freeze fix for trunk
[wxWidgets.git] / include / wx / mgl / region.h
CommitLineData
32b8ec41 1/////////////////////////////////////////////////////////////////////////////
320bf9ce 2// Name: wx/mgl/region.h
32b8ec41
VZ
3// Purpose: wxRegion class
4// Author: Vaclav Slavik
5// Created: 2001/03/12
6// RCS-ID: $Id$
52750c2e 7// Copyright: (c) 2001-2002 SciTech Software, Inc. (www.scitechsoft.com)
65571936 8// Licence: wxWindows licence
32b8ec41
VZ
9/////////////////////////////////////////////////////////////////////////////
10
8a16d737
VZ
11#ifndef _WX_MGL_REGION_H_
12#define _WX_MGL_REGION_H_
32b8ec41 13
32b8ec41 14#include "wx/list.h"
32b8ec41 15
32b8ec41
VZ
16class MGLRegion;
17
8a16d737 18class WXDLLEXPORT wxRegion : public wxRegionBase
32b8ec41 19{
32b8ec41 20public:
8a16d737 21 wxRegion();
32b8ec41
VZ
22 wxRegion(wxCoord x, wxCoord y, wxCoord w, wxCoord h);
23 wxRegion(const wxPoint& topLeft, const wxPoint& bottomRight);
24 wxRegion(const wxRect& rect);
25 wxRegion(const MGLRegion& region);
320bf9ce
WS
26 wxRegion(size_t n, const wxPoint *points, int fillStyle = wxODDEVEN_RULE );
27 wxRegion(const wxBitmap& bmp)
85f6b408
VS
28 {
29 Union(bmp);
30 }
320bf9ce
WS
31 wxRegion(const wxBitmap& bmp,
32 const wxColour& transColour, int tolerance = 0)
1542ea39
RD
33 {
34 Union(bmp, transColour, tolerance);
35 }
32b8ec41 36
d3c7fc99 37 virtual ~wxRegion();
32b8ec41 38
8a16d737
VZ
39 // wxRegionBase methods
40 virtual void Clear();
41 virtual bool IsEmpty() const;
1542ea39 42
32b8ec41
VZ
43 // implementation from now on:
44 const MGLRegion& GetMGLRegion() const;
6d7ee9e8
VS
45
46protected:
47 // ref counting code
48 virtual wxObjectRefData *CreateRefData() const;
49 virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const;
8a16d737
VZ
50
51 // wxRegionBase pure virtuals
52 virtual bool DoIsEqual(const wxRegion& region) const;
53 virtual bool DoGetBox(wxCoord& x, wxCoord& y, wxCoord& w, wxCoord& h) const;
54 virtual wxRegionContain DoContainsPoint(wxCoord x, wxCoord y) const;
55 virtual wxRegionContain DoContainsRect(const wxRect& rect) const;
56
57 virtual bool DoOffset(wxCoord x, wxCoord y);
58 virtual bool DoUnionWithRect(const wxRect& rect);
59 virtual bool DoUnionWithRegion(const wxRegion& region);
60 virtual bool DoIntersect(const wxRegion& region);
61 virtual bool DoSubtract(const wxRegion& region);
62 virtual bool DoXor(const wxRegion& region);
63
64private:
65 DECLARE_DYNAMIC_CLASS(wxRegion);
b5dbe15d 66 friend class WXDLLIMPEXP_FWD_CORE wxRegionIterator;
32b8ec41
VZ
67};
68
69
70WX_DECLARE_EXPORTED_LIST(wxRect, wxRegionRectList);
71
1542ea39 72class WXDLLEXPORT wxRegionIterator : public wxObject
32b8ec41 73{
32b8ec41
VZ
74public:
75 wxRegionIterator(void);
76 wxRegionIterator(const wxRegion& region);
d3c7fc99 77 virtual ~wxRegionIterator(void);
32b8ec41
VZ
78
79 void Reset(void) { m_currentNode = NULL; }
80 void Reset(const wxRegion& region);
81
32b8ec41 82 operator bool (void) const { return (m_currentNode != NULL); }
32b8ec41
VZ
83
84 bool HaveRects(void) const { return (m_currentNode != NULL); }
85
86 void operator ++ (void);
87 void operator ++ (int);
88
89 wxCoord GetX(void) const;
90 wxCoord GetY(void) const;
91 wxCoord GetW(void) const;
92 wxCoord GetWidth(void) const { return GetW(); }
93 wxCoord GetH(void) const;
94 wxCoord GetHeight(void) const { return GetH(); }
95 wxRect GetRect() const { return wxRect(GetX(), GetY(), GetWidth(), GetHeight()); }
96
97private:
98 wxRegionRectList m_rects;
99 wxRegionRectList::Node *m_currentNode;
8a16d737
VZ
100
101 DECLARE_DYNAMIC_CLASS(wxRegionIterator);
32b8ec41
VZ
102};
103
8a16d737 104#endif // _WX_MGL_REGION_H_