]> git.saurik.com Git - wxWidgets.git/blame_incremental - include/wx/msw/region.h
Don't define __STRICT_ANSI__, we should build both with and without it.
[wxWidgets.git] / include / wx / msw / region.h
... / ...
CommitLineData
1/////////////////////////////////////////////////////////////////////////////
2// Name: wx/msw/region.h
3// Purpose: wxRegion class
4// Author: Julian Smart
5// Modified by:
6// Created: 01/02/97
7// Copyright: (c) 1997-2002 wxWidgets team
8// Licence: wxWindows licence
9/////////////////////////////////////////////////////////////////////////////
10
11#ifndef _WX_MSW_REGION_H_
12#define _WX_MSW_REGION_H_
13
14class WXDLLIMPEXP_CORE wxRegion : public wxRegionWithCombine
15{
16public:
17 wxRegion();
18 wxRegion(wxCoord x, wxCoord y, wxCoord w, wxCoord h);
19 wxRegion(const wxPoint& topLeft, const wxPoint& bottomRight);
20 wxRegion(const wxRect& rect);
21 wxRegion(WXHRGN hRegion); // Hangs on to this region
22 wxRegion(size_t n, const wxPoint *points, wxPolygonFillMode fillStyle = wxODDEVEN_RULE );
23#if wxUSE_IMAGE
24 wxRegion( const wxBitmap& bmp)
25 {
26 Union(bmp);
27 }
28 wxRegion( const wxBitmap& bmp,
29 const wxColour& transColour, int tolerance = 0)
30 {
31 Union(bmp, transColour, tolerance);
32 }
33#endif // wxUSE_IMAGE
34
35 virtual ~wxRegion();
36
37 // wxRegionBase methods
38 virtual void Clear();
39 virtual bool IsEmpty() const;
40
41 // Get internal region handle
42 WXHRGN GetHRGN() const;
43
44protected:
45 virtual wxGDIRefData *CreateGDIRefData() const;
46 virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const;
47
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
56 friend class WXDLLIMPEXP_FWD_CORE wxRegionIterator;
57
58 DECLARE_DYNAMIC_CLASS(wxRegion)
59};
60
61class WXDLLIMPEXP_CORE wxRegionIterator : public wxObject
62{
63public:
64 wxRegionIterator() { Init(); }
65 wxRegionIterator(const wxRegion& region);
66 wxRegionIterator(const wxRegionIterator& ri) : wxObject(ri) { Init(); *this = ri; }
67
68 wxRegionIterator& operator=(const wxRegionIterator& ri);
69
70 virtual ~wxRegionIterator();
71
72 void Reset() { m_current = 0; }
73 void Reset(const wxRegion& region);
74
75 bool HaveRects() const { return (m_current < m_numRects); }
76
77 operator bool () const { return HaveRects(); }
78
79 wxRegionIterator& operator++();
80 wxRegionIterator operator++(int);
81
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(); }
88
89 wxRect GetRect() const { return wxRect(GetX(), GetY(), GetW(), GetH()); }
90
91private:
92 // common part of all ctors
93 void Init();
94
95 long m_current;
96 long m_numRects;
97 wxRegion m_region;
98 wxRect* m_rects;
99
100 DECLARE_DYNAMIC_CLASS(wxRegionIterator)
101};
102
103#endif // _WX_MSW_REGION_H_