]> git.saurik.com Git - wxWidgets.git/blob - wxPython/src/_region.i
fix bug
[wxWidgets.git] / wxPython / src / _region.i
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: _imaglist.i
3 // Purpose: SWIG interface defs for wxImageList and releated classes
4 //
5 // Author: Robin Dunn
6 //
7 // Created: 7-July-1997
8 // RCS-ID: $Id$
9 // Copyright: (c) 2003 by Total Control Software
10 // Licence: wxWindows license
11 /////////////////////////////////////////////////////////////////////////////
12
13 // Not a %module
14
15
16 //---------------------------------------------------------------------------
17
18 %{
19 %}
20
21 //---------------------------------------------------------------------------
22
23 %typemap(in) (int points, wxPoint* points_array ) {
24 $2 = wxPoint_LIST_helper($input, &$1);
25 if ($2 == NULL) SWIG_fail;
26 }
27 %typemap(freearg) (int points, wxPoint* points_array ) {
28 if ($2) delete [] $2;
29 }
30
31 //---------------------------------------------------------------------------
32 %newgroup
33
34
35 enum wxRegionContain
36 {
37 wxOutRegion = 0,
38 wxPartRegion = 1,
39 wxInRegion = 2
40 };
41
42
43
44 MustHaveApp(wxRegion);
45
46 class wxRegion : public wxGDIObject {
47 public:
48 wxRegion(wxCoord x=0, wxCoord y=0, wxCoord width=0, wxCoord height=0);
49 %name(RegionFromBitmap)wxRegion(const wxBitmap& bmp);
50 %name(RegionFromBitmapColour)wxRegion(const wxBitmap& bmp,
51 const wxColour& transColour,
52 int tolerance = 0);
53 %name(RegionFromPoints)wxRegion(int points, wxPoint* points_array,
54 int fillStyle = wxWINDING_RULE);
55
56 ~wxRegion();
57
58
59 void Clear();
60 #ifndef __WXMAC__
61 bool Offset(wxCoord x, wxCoord y);
62 #endif
63
64 wxRegionContain Contains(wxCoord x, wxCoord y);
65 %name(ContainsPoint)wxRegionContain Contains(const wxPoint& pt);
66 %name(ContainsRect)wxRegionContain Contains(const wxRect& rect);
67 %name(ContainsRectDim)wxRegionContain Contains(wxCoord x, wxCoord y, wxCoord w, wxCoord h);
68
69 wxRect GetBox();
70
71 bool Intersect(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
72 %name(IntersectRect)bool Intersect(const wxRect& rect);
73 %name(IntersectRegion)bool Intersect(const wxRegion& region);
74
75 bool IsEmpty();
76
77 bool Union(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
78 %name(UnionRect)bool Union(const wxRect& rect);
79 %name(UnionRegion)bool Union(const wxRegion& region);
80
81 bool Subtract(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
82 %name(SubtractRect)bool Subtract(const wxRect& rect);
83 %name(SubtractRegion)bool Subtract(const wxRegion& region);
84
85 bool Xor(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
86 %name(XorRect)bool Xor(const wxRect& rect);
87 %name(XorRegion)bool Xor(const wxRegion& region);
88
89 // Convert the region to a B&W bitmap with the white pixels being inside
90 // the region.
91 wxBitmap ConvertToBitmap();
92
93 // Use the non-transparent pixels of a wxBitmap for the region to combine
94 // with this region. If the bitmap has a mask then it will be used,
95 // otherwise the colour to be treated as transparent may be specified,
96 // along with an optional tolerance value.
97 %name(UnionBitmap)bool Union(const wxBitmap& bmp);
98 %name(UnionBitmapColour)bool Union(const wxBitmap& bmp,
99 const wxColour& transColour,
100 int tolerance = 0);
101 };
102
103
104
105 MustHaveApp(wxRegionIterator);
106
107 class wxRegionIterator : public wxObject {
108 public:
109 wxRegionIterator(const wxRegion& region);
110 ~wxRegionIterator();
111
112 wxCoord GetX();
113 wxCoord GetY();
114 wxCoord GetW();
115 wxCoord GetWidth();
116 wxCoord GetH();
117 wxCoord GetHeight();
118 wxRect GetRect();
119 bool HaveRects();
120 void Reset();
121
122 %extend {
123 void Next() {
124 (*self) ++;
125 }
126
127 bool __nonzero__() {
128 return self->operator bool();
129 }
130 };
131 };
132
133
134
135 //---------------------------------------------------------------------------
136 //---------------------------------------------------------------------------