]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msw/region.h
Fix wxPropertyGrid::GetPropertyRect when the last item is collapsed.
[wxWidgets.git] / include / wx / msw / region.h
CommitLineData
2bda0e17 1/////////////////////////////////////////////////////////////////////////////
5549e9f7 2// Name: wx/msw/region.h
2bda0e17 3// Purpose: wxRegion class
371a5b4e 4// Author: Julian Smart
2bda0e17
KB
5// Modified by:
6// Created: 01/02/97
77ffb593 7// Copyright: (c) 1997-2002 wxWidgets team
65571936 8// Licence: wxWindows licence
2bda0e17
KB
9/////////////////////////////////////////////////////////////////////////////
10
8a16d737
VZ
11#ifndef _WX_MSW_REGION_H_
12#define _WX_MSW_REGION_H_
2bda0e17 13
53a2db12 14class WXDLLIMPEXP_CORE wxRegion : public wxRegionWithCombine
5549e9f7 15{
2bda0e17 16public:
5549e9f7 17 wxRegion();
9b1801c1 18 wxRegion(wxCoord x, wxCoord y, wxCoord w, wxCoord h);
2bda0e17
KB
19 wxRegion(const wxPoint& topLeft, const wxPoint& bottomRight);
20 wxRegion(const wxRect& rect);
81d66cf3 21 wxRegion(WXHRGN hRegion); // Hangs on to this region
94a007ec 22 wxRegion(size_t n, const wxPoint *points, wxPolygonFillMode fillStyle = wxODDEVEN_RULE );
a8ff046b 23#if wxUSE_IMAGE
85f6b408
VS
24 wxRegion( const wxBitmap& bmp)
25 {
26 Union(bmp);
27 }
1542ea39 28 wxRegion( const wxBitmap& bmp,
85f6b408 29 const wxColour& transColour, int tolerance = 0)
1542ea39
RD
30 {
31 Union(bmp, transColour, tolerance);
32 }
a8ff046b 33#endif // wxUSE_IMAGE
2bda0e17 34
5549e9f7 35 virtual ~wxRegion();
2bda0e17 36
8a16d737
VZ
37 // wxRegionBase methods
38 virtual void Clear();
39 virtual bool IsEmpty() const;
a724d789
JS
40
41 // Get internal region handle
42 WXHRGN GetHRGN() const;
5549e9f7 43
0fb067bb 44protected:
8f884a0d
VZ
45 virtual wxGDIRefData *CreateGDIRefData() const;
46 virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const;
0fb067bb 47
8a16d737
VZ
48 virtual bool DoIsEqual(const wxRegion& region) const;
49 virtual bool DoGetBox(wxCoord& x, wxCoord& y, wxCoord& w, wxCoord& h) const;
50 virtual wxRegionContain DoContainsPoint(wxCoord x, wxCoord y) const;
51 virtual wxRegionContain DoContainsRect(const wxRect& rect) const;
52
53 virtual bool DoOffset(wxCoord x, wxCoord y);
54 virtual bool DoCombine(const wxRegion& region, wxRegionOp op);
55
b5dbe15d 56 friend class WXDLLIMPEXP_FWD_CORE wxRegionIterator;
0fb067bb
VZ
57
58 DECLARE_DYNAMIC_CLASS(wxRegion)
2bda0e17
KB
59};
60
53a2db12 61class WXDLLIMPEXP_CORE wxRegionIterator : public wxObject
5549e9f7 62{
2bda0e17 63public:
2b5f62a0 64 wxRegionIterator() { Init(); }
5549e9f7 65 wxRegionIterator(const wxRegion& region);
4dddb8a2 66 wxRegionIterator(const wxRegionIterator& ri) : wxObject(ri) { Init(); *this = ri; }
2bda0e17 67
2b5f62a0
VZ
68 wxRegionIterator& operator=(const wxRegionIterator& ri);
69
70 virtual ~wxRegionIterator();
71
72 void Reset() { m_current = 0; }
5549e9f7 73 void Reset(const wxRegion& region);
2bda0e17 74
2b5f62a0
VZ
75 bool HaveRects() const { return (m_current < m_numRects); }
76
2b5f62a0 77 operator bool () const { return HaveRects(); }
a3ef5bf5 78
2b5f62a0
VZ
79 wxRegionIterator& operator++();
80 wxRegionIterator operator++(int);
2bda0e17 81
2b5f62a0
VZ
82 wxCoord GetX() const;
83 wxCoord GetY() const;
84 wxCoord GetW() const;
85 wxCoord GetWidth() const { return GetW(); }
86 wxCoord GetH() const;
87 wxCoord GetHeight() const { return GetH(); }
2bda0e17 88
2b5f62a0 89 wxRect GetRect() const { return wxRect(GetX(), GetY(), GetW(), GetH()); }
2bda0e17
KB
90
91private:
2b5f62a0
VZ
92 // common part of all ctors
93 void Init();
94
5549e9f7
VZ
95 long m_current;
96 long m_numRects;
97 wxRegion m_region;
2bda0e17 98 wxRect* m_rects;
5549e9f7 99
57de2373 100 DECLARE_DYNAMIC_CLASS(wxRegionIterator)
2bda0e17
KB
101};
102
8a16d737 103#endif // _WX_MSW_REGION_H_