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