]> git.saurik.com Git - wxWidgets.git/blob - wxPython/src/_region.i
Committing in .
[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 #ifndef __WXMAC__
54 %name(RegionFromPoints)wxRegion(int points, wxPoint* points_array,
55 int fillStyle = wxWINDING_RULE);
56 #else
57 %extend {
58 %name(RegionFromPoints)wxRegion(int points, wxPoint* points_array,
59 int fillStyle = wxWINDING_RULE) {
60 wxPyRaiseNotImplemented();
61 return NULL;
62 }
63 }
64 #endif
65
66 ~wxRegion();
67
68
69 void Clear();
70 #ifndef __WXMAC__
71 bool Offset(wxCoord x, wxCoord y);
72 #endif
73
74 wxRegionContain Contains(wxCoord x, wxCoord y);
75 %name(ContainsPoint)wxRegionContain Contains(const wxPoint& pt);
76 %name(ContainsRect)wxRegionContain Contains(const wxRect& rect);
77 %name(ContainsRectDim)wxRegionContain Contains(wxCoord x, wxCoord y, wxCoord w, wxCoord h);
78
79 wxRect GetBox();
80
81 bool Intersect(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
82 %name(IntersectRect)bool Intersect(const wxRect& rect);
83 %name(IntersectRegion)bool Intersect(const wxRegion& region);
84
85 bool IsEmpty();
86
87 bool Union(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
88 %name(UnionRect)bool Union(const wxRect& rect);
89 %name(UnionRegion)bool Union(const wxRegion& region);
90
91 bool Subtract(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
92 %name(SubtractRect)bool Subtract(const wxRect& rect);
93 %name(SubtractRegion)bool Subtract(const wxRegion& region);
94
95 bool Xor(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
96 %name(XorRect)bool Xor(const wxRect& rect);
97 %name(XorRegion)bool Xor(const wxRegion& region);
98
99 // Convert the region to a B&W bitmap with the white pixels being inside
100 // the region.
101 wxBitmap ConvertToBitmap();
102
103 // Use the non-transparent pixels of a wxBitmap for the region to combine
104 // with this region. If the bitmap has a mask then it will be used,
105 // otherwise the colour to be treated as transparent may be specified,
106 // along with an optional tolerance value.
107 %name(UnionBitmap)bool Union(const wxBitmap& bmp);
108 %name(UnionBitmapColour)bool Union(const wxBitmap& bmp,
109 const wxColour& transColour,
110 int tolerance = 0);
111 };
112
113
114
115 MustHaveApp(wxRegionIterator);
116
117 class wxRegionIterator : public wxObject {
118 public:
119 wxRegionIterator(const wxRegion& region);
120 ~wxRegionIterator();
121
122 wxCoord GetX();
123 wxCoord GetY();
124 wxCoord GetW();
125 wxCoord GetWidth();
126 wxCoord GetH();
127 wxCoord GetHeight();
128 wxRect GetRect();
129 bool HaveRects();
130 void Reset();
131
132 %extend {
133 void Next() {
134 (*self) ++;
135 }
136
137 bool __nonzero__() {
138 return self->operator bool();
139 }
140 };
141 };
142
143
144
145 //---------------------------------------------------------------------------
146 //---------------------------------------------------------------------------