]> git.saurik.com Git - wxWidgets.git/blob - include/wx/mac/carbon/region.h
wxMiniFrame's default style is without closebox on
[wxWidgets.git] / include / wx / mac / carbon / region.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: region.h
3 // Purpose: wxRegion class
4 // Author: Stefan Csomor
5 // Modified by:
6 // Created: 1998-01-01
7 // RCS-ID: $Id$
8 // Copyright: (c) Stefan Csomor
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_MAC_CARBON_REGION_H_
13 #define _WX_MAC_CARBON_REGION_H_
14
15 #include "wx/list.h"
16
17 class WXDLLEXPORT wxRegion : public wxRegionWithCombine
18 {
19 public:
20 wxRegion(long x, long y, long w, long h);
21 wxRegion(const wxPoint& topLeft, const wxPoint& bottomRight);
22 wxRegion(const wxRect& rect);
23 wxRegion( WXHRGN hRegion );
24 wxRegion(size_t n, const wxPoint *points, int fillStyle = wxODDEVEN_RULE );
25 wxRegion();
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
36 virtual ~wxRegion();
37
38 // wxRegionBase methods
39 virtual void Clear();
40 virtual bool IsEmpty() const;
41
42 // Internal
43 const WXHRGN GetWXHRGN() const ;
44
45 protected:
46 virtual bool DoIsEqual(const wxRegion& region) const;
47 virtual bool DoGetBox(wxCoord& x, wxCoord& y, wxCoord& w, wxCoord& h) const;
48 virtual wxRegionContain DoContainsPoint(wxCoord x, wxCoord y) const;
49 virtual wxRegionContain DoContainsRect(const wxRect& rect) const;
50
51 virtual bool DoOffset(wxCoord x, wxCoord y);
52 virtual bool DoCombine(const wxRegion& region, wxRegionOp op);
53
54 private:
55 DECLARE_DYNAMIC_CLASS(wxRegion)
56 friend class WXDLLEXPORT wxRegionIterator;
57 };
58
59 class WXDLLEXPORT wxRegionIterator : public wxObject
60 {
61 public:
62 wxRegionIterator();
63 wxRegionIterator(const wxRegion& region);
64 wxRegionIterator(const wxRegionIterator& iterator);
65 virtual ~wxRegionIterator();
66
67 wxRegionIterator& operator=(const wxRegionIterator& iterator);
68
69 void Reset() { m_current = 0; }
70 void Reset(const wxRegion& region);
71
72 operator bool () const { return m_current < m_numRects; }
73 bool HaveRects() const { return m_current < m_numRects; }
74
75 wxRegionIterator& operator++();
76 wxRegionIterator operator++(int);
77
78 long GetX() const;
79 long GetY() const;
80 long GetW() const;
81 long GetWidth() const { return GetW(); }
82 long GetH() const;
83 long GetHeight() const { return GetH(); }
84 wxRect GetRect() const { return wxRect(GetX(), GetY(), GetWidth(), GetHeight()); }
85
86 private:
87 void SetRects(long numRects, wxRect *rects);
88
89 long m_current;
90 long m_numRects;
91 wxRegion m_region;
92 wxRect* m_rects;
93
94 DECLARE_DYNAMIC_CLASS(wxRegionIterator)
95 };
96
97 #endif // _WX_MAC_CARBON_REGION_H_