]> git.saurik.com Git - wxWidgets.git/blob - utils/wxPython/src/misc.i
Fixed a multiple define problem for strnicmp and stricmp by using the definition...
[wxWidgets.git] / utils / wxPython / src / misc.i
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: misc.i
3 // Purpose: Definitions of miscelaneous functions and classes
4 //
5 // Author: Robin Dunn
6 //
7 // Created: 7/3/97
8 // RCS-ID: $Id$
9 // Copyright: (c) 1998 by Total Control Software
10 // Licence: wxWindows license
11 /////////////////////////////////////////////////////////////////////////////
12
13 %module misc
14
15 %{
16 #include "helpers.h"
17 #include <wx/resource.h>
18 #include <wx/tooltip.h>
19 #include <wx/busyinfo.h>
20 %}
21
22 //----------------------------------------------------------------------
23
24 %include typemaps.i
25 %include my_typemaps.i
26
27 // Import some definitions of other classes, etc.
28 %import _defs.i
29
30
31 //---------------------------------------------------------------------------
32
33
34 class wxSize {
35 public:
36 long x;
37 long y;
38 %name(width) long x;
39 %name(height)long y;
40
41 wxSize(long w=0, long h=0);
42 ~wxSize();
43 void Set(long w, long h);
44 long GetX();
45 long GetY();
46 long GetWidth();
47 long GetHeight();
48 void SetWidth(long w);
49 void SetHeight(long h);
50
51 %addmethods {
52 PyObject* asTuple() {
53 PyObject* tup = PyTuple_New(2);
54 PyTuple_SET_ITEM(tup, 0, PyInt_FromLong(self->x));
55 PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(self->y));
56 return tup;
57 }
58 }
59 %pragma(python) addtoclass = "def __str__(self): return str(self.asTuple())"
60 %pragma(python) addtoclass = "def __repr__(self): return str(self.asTuple())"
61
62 };
63
64 //---------------------------------------------------------------------------
65
66 class wxRealPoint {
67 public:
68 double x;
69 double y;
70 wxRealPoint(double x=0.0, double y=0.0);
71 ~wxRealPoint();
72
73 %addmethods {
74 void Set(double x, double y) {
75 self->x = x;
76 self->y = y;
77 }
78 PyObject* asTuple() {
79 PyObject* tup = PyTuple_New(2);
80 PyTuple_SET_ITEM(tup, 0, PyFloat_FromDouble(self->x));
81 PyTuple_SET_ITEM(tup, 1, PyFloat_FromDouble(self->y));
82 return tup;
83 }
84 }
85 %pragma(python) addtoclass = "def __str__(self): return str(self.asTuple())"
86 %pragma(python) addtoclass = "def __repr__(self): return str(self.asTuple())"
87 };
88
89
90 class wxPoint {
91 public:
92 long x;
93 long y;
94 wxPoint(long x=0, long y=0);
95 ~wxPoint();
96
97 %addmethods {
98 void Set(long x, long y) {
99 self->x = x;
100 self->y = y;
101 }
102 PyObject* asTuple() {
103 PyObject* tup = PyTuple_New(2);
104 PyTuple_SET_ITEM(tup, 0, PyInt_FromLong(self->x));
105 PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(self->y));
106 return tup;
107 }
108 }
109 %pragma(python) addtoclass = "def __str__(self): return str(self.asTuple())"
110 %pragma(python) addtoclass = "def __repr__(self): return str(self.asTuple())"
111 };
112
113 //---------------------------------------------------------------------------
114
115 class wxRect {
116 public:
117 wxRect(long x=0, long y=0, long w=0, long h=0);
118 // TODO: do this one too... wxRect(const wxPoint& pos, const wxSize& size);
119 ~wxRect();
120
121 long GetX();
122 void SetX(long X);
123 long GetY();
124 void SetY(long Y);
125 long GetWidth();
126 void SetWidth(long w);
127 long GetHeight();
128 void SetHeight(long h);
129
130
131 wxPoint GetPosition();
132 wxSize GetSize();
133
134 long GetLeft();
135 long GetTop();
136 long GetBottom();
137 long GetRight();
138
139 long x, y, width, height;
140
141 %addmethods {
142 PyObject* asTuple() {
143 PyObject* tup = PyTuple_New(4);
144 PyTuple_SET_ITEM(tup, 0, PyInt_FromLong(self->x));
145 PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(self->y));
146 PyTuple_SET_ITEM(tup, 2, PyInt_FromLong(self->width));
147 PyTuple_SET_ITEM(tup, 3, PyInt_FromLong(self->height));
148 return tup;
149 }
150 }
151 %pragma(python) addtoclass = "def __str__(self): return str(self.asTuple())"
152 %pragma(python) addtoclass = "def __repr__(self): return str(self.asTuple())"
153 };
154
155
156
157
158 //---------------------------------------------------------------------------
159 // Miscellaneous functions
160
161 long wxNewId();
162 void wxRegisterId(long id);
163 %name(NewId) long wxNewId();
164 %name(RegisterId) void wxRegisterId(long id);
165
166 void wxBell();
167 void wxDisplaySize(int *OUTPUT, int *OUTPUT);
168 void wxEndBusyCursor();
169 long wxExecute(const wxString& command, bool sync = FALSE);
170 long wxGetElapsedTime(bool resetTimer = TRUE);
171 #ifdef __WXMSW__
172 long wxGetFreeMemory();
173 #endif
174 void wxGetMousePosition(int* OUTPUT, int* OUTPUT);
175 bool wxIsBusy();
176 wxString wxNow();
177 bool wxShell(const wxString& command = wxPyEmptyStr);
178 void wxStartTimer();
179 int wxGetOsVersion(int *OUTPUT, int *OUTPUT);
180
181 void wxSleep(int secs);
182 bool wxYield();
183 bool wxSafeYield();
184 void wxEnableTopLevelWindows(bool enable);
185
186 %inline %{
187 char* wxGetResource(char *section, char *entry, char *file = NULL) {
188 char * retval;
189 wxGetResource(section, entry, &retval, file);
190 return retval;
191 }
192 %}
193
194
195 //----------------------------------------------------------------------
196
197 class wxPyTimer {
198 public:
199 wxPyTimer(PyObject* notify);
200 ~wxPyTimer();
201 int Interval();
202 void Start(int milliseconds=-1, int oneShot=FALSE);
203 void Stop();
204 };
205
206 //---------------------------------------------------------------------------
207
208 enum wxEdge { wxLeft, wxTop, wxRight, wxBottom, wxWidth, wxHeight,
209 wxCentre, wxCenter = wxCentre, wxCentreX, wxCentreY };
210 enum wxRelationship { wxUnconstrained = 0,
211 wxAsIs,
212 wxPercentOf,
213 wxAbove,
214 wxBelow,
215 wxLeftOf,
216 wxRightOf,
217 wxSameAs,
218 wxAbsolute };
219
220
221 class wxIndividualLayoutConstraint {
222 public:
223 // wxIndividualLayoutConstraint();
224 // ~wxIndividualLayoutConstraint();
225
226 void Above(wxWindow *otherWin, int margin=0);
227 void Absolute(int value);
228 void AsIs();
229 void Below(wxWindow *otherWin, int margin=0);
230 void Unconstrained();
231 void LeftOf(wxWindow *otherWin, int margin=0);
232 void PercentOf(wxWindow *otherWin, wxEdge edge, int percent);
233 void RightOf(wxWindow *otherWin, int margin=0);
234 void SameAs(wxWindow *otherWin, wxEdge edge, int margin=0);
235 void Set(wxRelationship rel, wxWindow *otherWin, wxEdge otherEdge, int value=0, int margin=0);
236 };
237
238
239 class wxLayoutConstraints {
240 public:
241 wxLayoutConstraints();
242
243 %readonly
244 wxIndividualLayoutConstraint bottom;
245 wxIndividualLayoutConstraint centreX;
246 wxIndividualLayoutConstraint centreY;
247 wxIndividualLayoutConstraint height;
248 wxIndividualLayoutConstraint left;
249 wxIndividualLayoutConstraint right;
250 wxIndividualLayoutConstraint top;
251 wxIndividualLayoutConstraint width;
252 %readwrite
253 }
254
255
256 //---------------------------------------------------------------------------
257 // Regions, etc.
258
259 enum wxRegionContain {
260 wxOutRegion, wxPartRegion, wxInRegion
261 };
262
263
264 class wxRegion {
265 public:
266 wxRegion();
267 ~wxRegion();
268
269 void Clear();
270 wxRegionContain Contains(long x, long y);
271 %name(ContainsPoint)wxRegionContain Contains(const wxPoint& pt);
272 %name(ContainsRect)wxRegionContain Contains(const wxRect& rect);
273
274 wxRect GetBox();
275 bool Intersect(const wxRect& rect);
276 bool IsEmpty();
277 bool Subtract(const wxRect& rect);
278 bool Union(const wxRect& rect);
279 bool Xor(const wxRect& rect);
280 };
281
282
283
284 class wxRegionIterator {
285 public:
286 wxRegionIterator(const wxRegion& region);
287 ~wxRegionIterator();
288
289 long GetX();
290 long GetY();
291 long GetW();
292 long GetWidth();
293 long GetH();
294 long GetHeight();
295 wxRect GetRect();
296 bool HaveRects();
297 void Reset();
298
299 %addmethods {
300 void Next() {
301 (*self) ++;
302 }
303 };
304 };
305
306
307
308 //---------------------------------------------------------------------------
309 // Accelerator Entry and Table
310
311 class wxAcceleratorEntry {
312 public:
313 wxAcceleratorEntry(int flags = 0, int keyCode = 0, int cmd = 0);
314 ~wxAcceleratorEntry();
315
316 void Set(int flags, int keyCode, int Cmd);
317 int GetFlags();
318 int GetKeyCode();
319 int GetCommand();
320 };
321
322
323 class wxAcceleratorTable {
324 public:
325 // Can also accept a list of 3-tuples
326 wxAcceleratorTable(int LCOUNT, wxAcceleratorEntry* LIST);
327 ~wxAcceleratorTable();
328
329 };
330
331 //---------------------------------------------------------------------------
332
333 class wxBusyInfo {
334 public:
335 wxBusyInfo(const wxString& message);
336 ~wxBusyInfo();
337 };
338
339
340
341 //---------------------------------------------------------------------------
342
343