]> git.saurik.com Git - wxWidgets.git/blame_incremental - wxPython/src/_region.i
Buffered DCs now take non-const bitmaps
[wxWidgets.git] / wxPython / src / _region.i
... / ...
CommitLineData
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
35enum wxRegionContain
36{
37 wxOutRegion = 0,
38 wxPartRegion = 1,
39 wxInRegion = 2
40};
41
42
43// // these constants are used with wxRegion::Combine() in the ports which have
44// // this method
45// enum wxRegionOp
46// {
47// // Creates the intersection of the two combined regions.
48// wxRGN_AND,
49
50// // Creates a copy of the region
51// wxRGN_COPY,
52
53// // Combines the parts of first region that are not in the second one
54// wxRGN_DIFF,
55
56// // Creates the union of two combined regions.
57// wxRGN_OR,
58
59// // Creates the union of two regions except for any overlapping areas.
60// wxRGN_XOR
61// };
62
63
64
65MustHaveApp(wxRegion);
66
67class wxRegion : public wxGDIObject {
68public:
69 wxRegion(wxCoord x=0, wxCoord y=0, wxCoord width=0, wxCoord height=0);
70 %RenameCtor(RegionFromBitmap, wxRegion(const wxBitmap& bmp));
71 %RenameCtor(RegionFromBitmapColour, wxRegion(const wxBitmap& bmp,
72 const wxColour& transColour,
73 int tolerance = 0));
74 %RenameCtor(RegionFromPoints, wxRegion(int points, wxPoint* points_array,
75 int fillStyle = wxWINDING_RULE));
76
77 ~wxRegion();
78
79
80 void Clear();
81 bool Offset(wxCoord x, wxCoord y);
82
83 wxRegionContain Contains(wxCoord x, wxCoord y);
84 %Rename(ContainsPoint, wxRegionContain, Contains(const wxPoint& pt));
85 %Rename(ContainsRect, wxRegionContain, Contains(const wxRect& rect));
86 %Rename(ContainsRectDim, wxRegionContain, Contains(wxCoord x, wxCoord y, wxCoord w, wxCoord h));
87
88 wxRect GetBox();
89
90 bool Intersect(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
91 %Rename(IntersectRect, bool, Intersect(const wxRect& rect));
92 %Rename(IntersectRegion, bool, Intersect(const wxRegion& region));
93
94 bool IsEmpty();
95
96 // Is region equal (i.e. covers the same area as another one)?
97 bool IsEqual(const wxRegion& region) const;
98
99 bool Union(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
100 %Rename(UnionRect, bool, Union(const wxRect& rect));
101 %Rename(UnionRegion, bool, Union(const wxRegion& region));
102
103 bool Subtract(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
104 %Rename(SubtractRect, bool, Subtract(const wxRect& rect));
105 %Rename(SubtractRegion, bool, Subtract(const wxRegion& region));
106
107 bool Xor(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
108 %Rename(XorRect, bool, Xor(const wxRect& rect));
109 %Rename(XorRegion, bool, Xor(const wxRegion& region));
110
111 // Convert the region to a B&W bitmap with the white pixels being inside
112 // the region.
113 wxBitmap ConvertToBitmap();
114
115 // Use the non-transparent pixels of a wxBitmap for the region to combine
116 // with this region. If the bitmap has a mask then it will be used,
117 // otherwise the colour to be treated as transparent may be specified,
118 // along with an optional tolerance value.
119 %Rename(UnionBitmap, bool, Union(const wxBitmap& bmp));
120 %Rename(UnionBitmapColour, bool, Union(const wxBitmap& bmp,
121 const wxColour& transColour,
122 int tolerance = 0));
123
124
125// bool Combine(wxCoord x, wxCoord y, wxCoord w, wxCoord h, wxRegionOp op);
126// %Rename(CombineRect, bool , Combine(const wxRect& rect, wxRegionOp op));
127// %Rename(CombineRegion, bool , Combine(const wxRegion& region, wxRegionOp op));
128
129 %property(Box, GetBox, doc="See `GetBox`");
130};
131
132
133
134MustHaveApp(wxRegionIterator);
135
136class wxRegionIterator : public wxObject {
137public:
138 wxRegionIterator(const wxRegion& region);
139 ~wxRegionIterator();
140
141 wxCoord GetX();
142 wxCoord GetY();
143 wxCoord GetW();
144 wxCoord GetWidth();
145 wxCoord GetH();
146 wxCoord GetHeight();
147 wxRect GetRect();
148 bool HaveRects();
149 void Reset();
150
151 %extend {
152 void Next() {
153 (*self) ++;
154 }
155
156 bool __nonzero__() {
157 return self->operator bool();
158 }
159 };
160
161 %property(H, GetH, doc="See `GetH`");
162 %property(Height, GetHeight, doc="See `GetHeight`");
163 %property(Rect, GetRect, doc="See `GetRect`");
164 %property(W, GetW, doc="See `GetW`");
165 %property(Width, GetWidth, doc="See `GetWidth`");
166 %property(X, GetX, doc="See `GetX`");
167 %property(Y, GetY, doc="See `GetY`");
168};
169
170
171
172//---------------------------------------------------------------------------
173//---------------------------------------------------------------------------