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