]>
Commit | Line | Data |
---|---|---|
7bf85405 RD |
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 | ||
03e9bead | 13 | %module misc |
7bf85405 | 14 | |
03e9bead | 15 | %{ |
7bf85405 | 16 | #include "helpers.h" |
af309447 | 17 | #include <wx/tooltip.h> |
2abc0a0f | 18 | #include <wx/busyinfo.h> |
1e4a197e | 19 | #include <wx/geometry.h> |
7bf85405 RD |
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 | ||
7bf85405 | 30 | |
137b5242 RD |
31 | //--------------------------------------------------------------------------- |
32 | %{ | |
33 | // Put some wx default wxChar* values into wxStrings. | |
34 | static const wxString wxPyEmptyString(wxT("")); | |
35 | %} | |
bb0054cd | 36 | //--------------------------------------------------------------------------- |
7bf85405 RD |
37 | |
38 | ||
9416aa89 RD |
39 | class wxObject { |
40 | public: | |
41 | ||
42 | %addmethods { | |
c8bc7bb8 | 43 | wxString GetClassName() { |
9416aa89 RD |
44 | return self->GetClassInfo()->GetClassName(); |
45 | } | |
46 | ||
47 | void Destroy() { | |
48 | delete self; | |
49 | } | |
50 | } | |
51 | }; | |
52 | ||
53 | //--------------------------------------------------------------------------- | |
54 | ||
7bf85405 RD |
55 | class wxSize { |
56 | public: | |
af309447 RD |
57 | long x; |
58 | long y; | |
7bf85405 RD |
59 | %name(width) long x; |
60 | %name(height)long y; | |
61 | ||
62 | wxSize(long w=0, long h=0); | |
63 | ~wxSize(); | |
64 | void Set(long w, long h); | |
af309447 RD |
65 | long GetX(); |
66 | long GetY(); | |
bb0054cd RD |
67 | long GetWidth(); |
68 | long GetHeight(); | |
69 | void SetWidth(long w); | |
70 | void SetHeight(long h); | |
7bf85405 RD |
71 | |
72 | %addmethods { | |
af309447 | 73 | PyObject* asTuple() { |
7cdaed0b | 74 | wxPyBeginBlockThreads(); |
7bf85405 RD |
75 | PyObject* tup = PyTuple_New(2); |
76 | PyTuple_SET_ITEM(tup, 0, PyInt_FromLong(self->x)); | |
77 | PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(self->y)); | |
7cdaed0b | 78 | wxPyEndBlockThreads(); |
7bf85405 RD |
79 | return tup; |
80 | } | |
419c299a | 81 | |
1e4a197e RD |
82 | bool __eq__(PyObject* obj) { |
83 | wxSize tmp; | |
84 | wxSize* ptr = &tmp; | |
85 | if (obj == Py_None) return FALSE; | |
86 | wxPyBLOCK_THREADS(bool success = wxSize_helper(obj, &ptr); PyErr_Clear()); | |
87 | if (! success) return FALSE; | |
88 | return *self == *ptr; | |
419c299a | 89 | } |
1e4a197e RD |
90 | bool __ne__(PyObject* obj) { |
91 | wxSize tmp; | |
92 | wxSize* ptr = &tmp; | |
93 | if (obj == Py_None) return TRUE; | |
94 | wxPyBLOCK_THREADS(bool success = wxSize_helper(obj, &ptr); PyErr_Clear()); | |
95 | if (! success) return TRUE; | |
96 | return *self != *ptr; | |
97 | } | |
98 | ||
7bf85405 | 99 | } |
1b62f00d RD |
100 | |
101 | %pragma(python) addtoclass = " | |
102 | def __str__(self): return str(self.asTuple()) | |
1e4a197e | 103 | def __repr__(self): return 'wxSize'+str(self.asTuple()) |
211a46cf | 104 | def __len__(self): return len(self.asTuple()) |
1b62f00d RD |
105 | def __getitem__(self, index): return self.asTuple()[index] |
106 | def __setitem__(self, index, val): | |
107 | if index == 0: self.width = val | |
108 | elif index == 1: self.height = val | |
109 | else: raise IndexError | |
1e4a197e RD |
110 | def __nonzero__(self): return self.asTuple() != (0,0) |
111 | def __getinitargs__(self): return () | |
112 | def __getstate__(self): return self.asTuple() | |
113 | def __setstate__(self, state): self.Set(*state) | |
1b62f00d | 114 | " |
af309447 | 115 | |
7bf85405 RD |
116 | }; |
117 | ||
118 | //--------------------------------------------------------------------------- | |
119 | ||
120 | class wxRealPoint { | |
121 | public: | |
122 | double x; | |
123 | double y; | |
124 | wxRealPoint(double x=0.0, double y=0.0); | |
125 | ~wxRealPoint(); | |
efc5f224 RD |
126 | |
127 | %addmethods { | |
128 | void Set(double x, double y) { | |
129 | self->x = x; | |
130 | self->y = y; | |
131 | } | |
132 | PyObject* asTuple() { | |
7cdaed0b | 133 | wxPyBeginBlockThreads(); |
efc5f224 RD |
134 | PyObject* tup = PyTuple_New(2); |
135 | PyTuple_SET_ITEM(tup, 0, PyFloat_FromDouble(self->x)); | |
136 | PyTuple_SET_ITEM(tup, 1, PyFloat_FromDouble(self->y)); | |
7cdaed0b | 137 | wxPyEndBlockThreads(); |
efc5f224 RD |
138 | return tup; |
139 | } | |
c368d904 | 140 | |
1e4a197e RD |
141 | wxRealPoint __add__(const wxRealPoint& p) { |
142 | return *self + p; | |
c368d904 RD |
143 | } |
144 | ||
1e4a197e RD |
145 | wxRealPoint __sub__(const wxRealPoint& p) { |
146 | return *self - p; | |
c368d904 RD |
147 | } |
148 | ||
1e4a197e RD |
149 | bool __eq__(PyObject* obj) { |
150 | wxRealPoint tmp; | |
151 | wxRealPoint* ptr = &tmp; | |
152 | if (obj == Py_None) return FALSE; | |
153 | wxPyBLOCK_THREADS(bool success = wxRealPoint_helper(obj, &ptr); PyErr_Clear()); | |
154 | if (! success) return FALSE; | |
155 | return *self == *ptr; | |
c368d904 | 156 | } |
1e4a197e RD |
157 | bool __ne__(PyObject* obj) { |
158 | wxRealPoint tmp; | |
159 | wxRealPoint* ptr = &tmp; | |
160 | if (obj == Py_None) return TRUE; | |
161 | wxPyBLOCK_THREADS(bool success = wxRealPoint_helper(obj, &ptr); PyErr_Clear()); | |
162 | if (! success) return TRUE; | |
163 | return *self != *ptr; | |
164 | } | |
165 | ||
efc5f224 | 166 | } |
1e4a197e | 167 | |
1b62f00d RD |
168 | %pragma(python) addtoclass = " |
169 | def __str__(self): return str(self.asTuple()) | |
1e4a197e | 170 | def __repr__(self): return 'wxRealPoint'+str(self.asTuple()) |
211a46cf | 171 | def __len__(self): return len(self.asTuple()) |
1b62f00d RD |
172 | def __getitem__(self, index): return self.asTuple()[index] |
173 | def __setitem__(self, index, val): | |
174 | if index == 0: self.width = val | |
175 | elif index == 1: self.height = val | |
176 | else: raise IndexError | |
1e4a197e RD |
177 | def __nonzero__(self): return self.asTuple() != (0.0, 0.0) |
178 | def __getinitargs__(self): return () | |
179 | def __getstate__(self): return self.asTuple() | |
180 | def __setstate__(self, state): self.Set(*state) | |
1b62f00d | 181 | " |
7bf85405 RD |
182 | }; |
183 | ||
efc5f224 | 184 | |
7bf85405 RD |
185 | class wxPoint { |
186 | public: | |
187 | long x; | |
188 | long y; | |
189 | wxPoint(long x=0, long y=0); | |
190 | ~wxPoint(); | |
191 | ||
192 | %addmethods { | |
193 | void Set(long x, long y) { | |
194 | self->x = x; | |
195 | self->y = y; | |
196 | } | |
af309447 | 197 | PyObject* asTuple() { |
7cdaed0b | 198 | wxPyBeginBlockThreads(); |
7bf85405 RD |
199 | PyObject* tup = PyTuple_New(2); |
200 | PyTuple_SET_ITEM(tup, 0, PyInt_FromLong(self->x)); | |
201 | PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(self->y)); | |
7cdaed0b | 202 | wxPyEndBlockThreads(); |
7bf85405 RD |
203 | return tup; |
204 | } | |
c368d904 | 205 | |
1e4a197e RD |
206 | wxPoint __add__(const wxPoint& p) { |
207 | return *self + p; | |
c368d904 RD |
208 | } |
209 | ||
1e4a197e RD |
210 | wxPoint __sub__(const wxPoint& p) { |
211 | return *self - p; | |
c368d904 RD |
212 | } |
213 | ||
1e4a197e RD |
214 | bool __eq__(PyObject* obj) { |
215 | wxPoint tmp; | |
216 | wxPoint* ptr = &tmp; | |
217 | if (obj == Py_None) return FALSE; | |
218 | wxPyBLOCK_THREADS(bool success = wxPoint_helper(obj, &ptr); PyErr_Clear()); | |
219 | if (! success) return FALSE; | |
220 | return *self == *ptr; | |
221 | } | |
222 | bool __ne__(PyObject* obj) { | |
223 | wxPoint tmp; | |
224 | wxPoint* ptr = &tmp; | |
225 | if (obj == Py_None) return TRUE; | |
226 | wxPyBLOCK_THREADS(bool success = wxPoint_helper(obj, &ptr); PyErr_Clear()); | |
227 | if (! success) return TRUE; | |
228 | return *self != *ptr; | |
c368d904 | 229 | } |
1e4a197e | 230 | |
7bf85405 | 231 | } |
1e4a197e | 232 | |
1b62f00d RD |
233 | %pragma(python) addtoclass = " |
234 | def __str__(self): return str(self.asTuple()) | |
1e4a197e | 235 | def __repr__(self): return 'wxPoint'+str(self.asTuple()) |
211a46cf | 236 | def __len__(self): return len(self.asTuple()) |
1b62f00d RD |
237 | def __getitem__(self, index): return self.asTuple()[index] |
238 | def __setitem__(self, index, val): | |
239 | if index == 0: self.x = val | |
240 | elif index == 1: self.y = val | |
241 | else: raise IndexError | |
1e4a197e RD |
242 | def __nonzero__(self): return self.asTuple() != (0,0) |
243 | def __getinitargs__(self): return () | |
244 | def __getstate__(self): return self.asTuple() | |
245 | def __setstate__(self, state): self.Set(*state) | |
1b62f00d | 246 | " |
7bf85405 RD |
247 | }; |
248 | ||
249 | //--------------------------------------------------------------------------- | |
250 | ||
251 | class wxRect { | |
252 | public: | |
1e4a197e | 253 | wxRect(int x=0, int y=0, int width=0, int height=0); |
eb715945 RD |
254 | // TODO: do this one too... wxRect(const wxPoint& pos, const wxSize& size); |
255 | ~wxRect(); | |
7bf85405 | 256 | |
eb715945 RD |
257 | int GetX(); |
258 | void SetX(int X); | |
259 | int GetY(); | |
260 | void SetY(int Y); | |
261 | int GetWidth(); | |
262 | void SetWidth(int w); | |
263 | int GetHeight(); | |
264 | void SetHeight(int h); | |
7bf85405 RD |
265 | |
266 | ||
eb715945 RD |
267 | wxPoint GetPosition(); |
268 | wxSize GetSize(); | |
3b5ccda1 RD |
269 | void SetPosition( const wxPoint &p ); |
270 | void SetSize( const wxSize &s ); | |
7bf85405 | 271 | |
eb715945 RD |
272 | int GetLeft(); |
273 | int GetTop(); | |
274 | int GetBottom(); | |
275 | int GetRight(); | |
7bf85405 | 276 | |
eb715945 RD |
277 | void SetLeft(int left); |
278 | void SetRight(int right); | |
279 | void SetTop(int top); | |
280 | void SetBottom(int bottom); | |
281 | ||
1e4a197e | 282 | void Deflate(int dx, int dy); |
f6bcfd97 | 283 | void Inflate(int dx, int dy); |
1e4a197e RD |
284 | %name(InsideXY)bool Inside(int cx, int cy); |
285 | bool Inside(const wxPoint& pt); | |
286 | bool Intersects(const wxRect& rect); | |
287 | %name(OffsetXY) void Offset(int dx, int dy); | |
288 | void Offset(const wxPoint& pt); | |
eb715945 RD |
289 | |
290 | int x, y, width, height; | |
af309447 RD |
291 | |
292 | %addmethods { | |
1e4a197e RD |
293 | void Set(int x=0, int y=0, int width=0, int height=0) { |
294 | self->x = x; | |
295 | self->y = y; | |
296 | self->width = width; | |
297 | self->height = height; | |
298 | } | |
299 | ||
af309447 | 300 | PyObject* asTuple() { |
7cdaed0b | 301 | wxPyBeginBlockThreads(); |
af309447 RD |
302 | PyObject* tup = PyTuple_New(4); |
303 | PyTuple_SET_ITEM(tup, 0, PyInt_FromLong(self->x)); | |
304 | PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(self->y)); | |
f0261a72 RD |
305 | PyTuple_SET_ITEM(tup, 2, PyInt_FromLong(self->width)); |
306 | PyTuple_SET_ITEM(tup, 3, PyInt_FromLong(self->height)); | |
7cdaed0b | 307 | wxPyEndBlockThreads(); |
af309447 RD |
308 | return tup; |
309 | } | |
f6bcfd97 | 310 | |
1e4a197e RD |
311 | wxRect __add__(const wxRect& rect) { |
312 | return *self + rect; | |
f6bcfd97 BP |
313 | } |
314 | ||
1e4a197e RD |
315 | bool __eq__(PyObject* obj) { |
316 | wxRect tmp; | |
317 | wxRect* ptr = &tmp; | |
318 | if (obj == Py_None) return FALSE; | |
319 | wxPyBLOCK_THREADS(bool success = wxRect_helper(obj, &ptr); PyErr_Clear()); | |
320 | if (! success) return FALSE; | |
321 | return *self == *ptr; | |
322 | } | |
323 | bool __ne__(PyObject* obj) { | |
324 | wxRect tmp; | |
325 | wxRect* ptr = &tmp; | |
326 | if (obj == Py_None) return TRUE; | |
327 | wxPyBLOCK_THREADS(bool success = wxRect_helper(obj, &ptr); PyErr_Clear()); | |
328 | if (! success) return TRUE; | |
329 | return *self != *ptr; | |
f6bcfd97 | 330 | } |
1e4a197e | 331 | |
af309447 | 332 | } |
f6bcfd97 | 333 | |
9b3d3bc4 | 334 | %pragma(python) addtoclass = " |
1b62f00d | 335 | def __str__(self): return str(self.asTuple()) |
1e4a197e | 336 | def __repr__(self): return 'wxRect'+str(self.asTuple()) |
211a46cf | 337 | def __len__(self): return len(self.asTuple()) |
1b62f00d RD |
338 | def __getitem__(self, index): return self.asTuple()[index] |
339 | def __setitem__(self, index, val): | |
340 | if index == 0: self.x = val | |
341 | elif index == 1: self.y = val | |
342 | elif index == 2: self.width = val | |
343 | elif index == 3: self.height = val | |
344 | else: raise IndexError | |
1e4a197e RD |
345 | def __nonzero__(self): return self.asTuple() != (0,0,0,0) |
346 | def __getinitargs__(self): return () | |
347 | def __getstate__(self): return self.asTuple() | |
348 | def __setstate__(self, state): self.Set(*state) | |
1b62f00d | 349 | |
9b3d3bc4 RD |
350 | # override the __getattr__ made by SWIG |
351 | def __getattr__(self, name): | |
352 | d = { | |
353 | 'x' : miscc.wxRect_x_get, | |
354 | 'y' : miscc.wxRect_y_get, | |
355 | 'width' : miscc.wxRect_width_get, | |
356 | 'height' : miscc.wxRect_height_get, | |
357 | 'top' : miscc.wxRect_GetTop, | |
358 | 'bottom' : miscc.wxRect_GetBottom, | |
359 | 'left' : miscc.wxRect_GetLeft, | |
360 | 'right' : miscc.wxRect_GetRight, | |
361 | } | |
362 | try: | |
363 | func = d[name] | |
364 | except KeyError: | |
365 | raise AttributeError,name | |
366 | return func(self) | |
367 | ||
368 | # and also the __setattr__ | |
369 | def __setattr__(self, name, value): | |
370 | d = { | |
371 | 'x' : miscc.wxRect_x_set, | |
372 | 'y' : miscc.wxRect_y_set, | |
373 | 'width' : miscc.wxRect_width_set, | |
374 | 'height' : miscc.wxRect_height_set, | |
375 | 'top' : miscc.wxRect_SetTop, | |
376 | 'bottom' : miscc.wxRect_SetBottom, | |
377 | 'left' : miscc.wxRect_SetLeft, | |
378 | 'right' : miscc.wxRect_SetRight, | |
379 | } | |
380 | try: | |
381 | func = d[name] | |
382 | except KeyError: | |
383 | self.__dict__[name] = value | |
384 | return | |
385 | func(self, value) | |
386 | " | |
387 | ||
7bf85405 RD |
388 | }; |
389 | ||
390 | ||
eb715945 RD |
391 | %inline %{ |
392 | PyObject* wxIntersectRect(wxRect* r1, wxRect* r2) { | |
393 | wxRegion reg1(*r1); | |
394 | wxRegion reg2(*r2); | |
395 | wxRect dest(0,0,0,0); | |
396 | PyObject* obj; | |
397 | ||
398 | reg1.Intersect(reg2); | |
399 | dest = reg1.GetBox(); | |
400 | ||
401 | if (dest != wxRect(0,0,0,0)) { | |
4268f798 | 402 | wxPyBeginBlockThreads(); |
eb715945 | 403 | wxRect* newRect = new wxRect(dest); |
1e4a197e | 404 | obj = wxPyConstructObject((void*)newRect, wxT("wxRect")); |
de20db99 RD |
405 | PyObject* one = PyInt_FromLong(1); |
406 | PyObject_SetAttrString(obj, "thisown", one); | |
407 | Py_DECREF(one); | |
4268f798 | 408 | wxPyEndBlockThreads(); |
eb715945 RD |
409 | return obj; |
410 | } | |
411 | Py_INCREF(Py_None); | |
412 | return Py_None; | |
413 | } | |
414 | %} | |
7bf85405 | 415 | |
7bf85405 | 416 | |
1e4a197e RD |
417 | |
418 | //--------------------------------------------------------------------------- | |
419 | // wxPoint2Ds represent a point or a vector in a 2d coordinate system | |
420 | ||
421 | class wxPoint2DDouble | |
422 | { | |
423 | public: | |
424 | double m_x; | |
425 | double m_y; | |
426 | ||
427 | %name(x)double m_x; | |
428 | %name(y)double m_y; | |
429 | ||
430 | wxPoint2DDouble( double x=0 , double y=0 ); | |
431 | %name(wxPoint2DDoubleCopy)wxPoint2DDouble( const wxPoint2DDouble &pt ); | |
432 | %name(wxPoint2DDoubleFromPoint)wxPoint2DDouble( const wxPoint &pt ); | |
433 | ||
434 | // two different conversions to integers, floor and rounding | |
435 | void GetFloor( int* OUTPUT , int* OUTPUT ) const; | |
436 | void GetRounded( int* OUTPUT , int* OUTPUT ) const; | |
437 | ||
438 | double GetVectorLength() const; | |
439 | double GetVectorAngle() const ; | |
440 | void SetVectorLength( double length ); | |
441 | void SetVectorAngle( double degrees ); | |
442 | // LinkError: void SetPolarCoordinates( double angle , double length ); | |
443 | // LinkError: void Normalize(); | |
444 | %pragma(python) addtoclass = " | |
445 | def SetPolarCoordinates(self, angle, length): | |
446 | self.SetVectorLength(length) | |
447 | self.SetVectorAngle(angle) | |
448 | def Normalize(self): | |
449 | self.SetVectorLength(1.0) | |
450 | " | |
451 | ||
452 | double GetDistance( const wxPoint2DDouble &pt ) const; | |
453 | double GetDistanceSquare( const wxPoint2DDouble &pt ) const; | |
454 | double GetDotProduct( const wxPoint2DDouble &vec ) const; | |
455 | double GetCrossProduct( const wxPoint2DDouble &vec ) const; | |
456 | ||
457 | %addmethods { | |
458 | void Set( double x=0 , double y=0 ) { | |
459 | self->m_x = x; | |
460 | self->m_y = y; | |
461 | } | |
462 | ||
463 | // the reflection of this point | |
464 | wxPoint2DDouble __neg__() { return -(*self); } | |
465 | ||
466 | wxPoint2DDouble& __iadd__(const wxPoint2DDouble& pt) { return (*self) += pt; } | |
467 | wxPoint2DDouble& __isub__(const wxPoint2DDouble& pt) { return (*self) -= pt; } | |
468 | wxPoint2DDouble& __imul__(const wxPoint2DDouble& pt) { return (*self) *= pt; } | |
469 | wxPoint2DDouble& __idiv__(const wxPoint2DDouble& pt) { return (*self) /= pt; } | |
470 | ||
471 | // TODO: | |
472 | //wxPoint2DDouble& operator*=(double n); | |
473 | //wxPoint2DDouble& operator*=(int n); | |
474 | //wxPoint2DDouble& operator/=(double n); | |
475 | //wxPoint2DDouble& operator/=(int n); | |
476 | ||
477 | bool __eq__(PyObject* obj) { | |
478 | wxPoint2DDouble tmp; | |
479 | wxPoint2DDouble* ptr = &tmp; | |
480 | if (obj == Py_None) return FALSE; | |
481 | wxPyBLOCK_THREADS(bool success = wxPoint2DDouble_helper(obj, &ptr); PyErr_Clear()); | |
482 | if (! success) return FALSE; | |
483 | return *self == *ptr; | |
484 | } | |
485 | bool __ne__(PyObject* obj) { | |
486 | wxPoint2DDouble tmp; | |
487 | wxPoint2DDouble* ptr = &tmp; | |
488 | if (obj == Py_None) return TRUE; | |
489 | wxPyBLOCK_THREADS(bool success = wxPoint2DDouble_helper(obj, &ptr); PyErr_Clear()); | |
490 | if (! success) return TRUE; | |
491 | return *self != *ptr; | |
492 | } | |
493 | ||
494 | ||
495 | PyObject* asTuple() { | |
496 | wxPyBeginBlockThreads(); | |
497 | PyObject* tup = PyTuple_New(2); | |
498 | PyTuple_SET_ITEM(tup, 0, PyFloat_FromDouble(self->m_x)); | |
499 | PyTuple_SET_ITEM(tup, 1, PyFloat_FromDouble(self->m_y)); | |
500 | wxPyEndBlockThreads(); | |
501 | return tup; | |
502 | } | |
503 | } | |
504 | ||
505 | %pragma(python) addtoclass = " | |
506 | def __str__(self): return str(self.asTuple()) | |
507 | def __repr__(self): return 'wxPoint2DDouble'+str(self.asTuple()) | |
508 | def __len__(self): return len(self.asTuple()) | |
509 | def __getitem__(self, index): return self.asTuple()[index] | |
510 | def __setitem__(self, index, val): | |
511 | if index == 0: self.m_x = val | |
512 | elif index == 1: self.m_yt = val | |
513 | else: raise IndexError | |
514 | def __nonzero__(self): return self.asTuple() != (0.0, 0.0) | |
515 | def __getinitargs__(self): return () | |
516 | def __getstate__(self): return self.asTuple() | |
517 | def __setstate__(self, state): self.Set(*state) | |
518 | " | |
519 | }; | |
520 | ||
521 | ||
7bf85405 RD |
522 | //--------------------------------------------------------------------------- |
523 | // Miscellaneous functions | |
524 | ||
cf694132 RD |
525 | long wxNewId(); |
526 | void wxRegisterId(long id); | |
83b18bab | 527 | long wxGetCurrentId(); |
cf694132 | 528 | |
7bf85405 | 529 | void wxBell(); |
7bf85405 | 530 | void wxEndBusyCursor(); |
c368d904 | 531 | |
7bf85405 | 532 | long wxGetElapsedTime(bool resetTimer = TRUE); |
bc29c5e0 | 533 | #ifdef __WXMSW__ |
7bf85405 | 534 | long wxGetFreeMemory(); |
bc29c5e0 | 535 | #endif |
7bf85405 RD |
536 | void wxGetMousePosition(int* OUTPUT, int* OUTPUT); |
537 | bool wxIsBusy(); | |
538 | wxString wxNow(); | |
137b5242 | 539 | bool wxShell(const wxString& command = wxPyEmptyString); |
7bf85405 | 540 | void wxStartTimer(); |
fb5e0af0 | 541 | int wxGetOsVersion(int *OUTPUT, int *OUTPUT); |
c368d904 | 542 | wxString wxGetOsDescription(); |
fb5e0af0 | 543 | |
b7fc54be RD |
544 | enum wxShutdownFlags |
545 | { | |
546 | wxSHUTDOWN_POWEROFF, // power off the computer | |
547 | wxSHUTDOWN_REBOOT // shutdown and reboot | |
548 | }; | |
549 | ||
550 | // Shutdown or reboot the PC | |
551 | bool wxShutdown(wxShutdownFlags wFlags); | |
552 | ||
553 | ||
bb0054cd | 554 | void wxSleep(int secs); |
c368d904 | 555 | void wxUsleep(unsigned long milliseconds); |
7bf85405 | 556 | bool wxYield(); |
83b18bab | 557 | bool wxYieldIfNeeded(); |
bb0054cd | 558 | void wxEnableTopLevelWindows(bool enable); |
7bf85405 | 559 | |
1e4a197e RD |
560 | #ifdef wxUSE_RESOURCES |
561 | inline %{ | |
c8bc7bb8 | 562 | wxString wxGetResource(const wxString& section, const wxString& entry, |
137b5242 | 563 | const wxString& file = wxPyEmptyString) { |
1e4a197e | 564 | wxChar* retval; |
7bf85405 RD |
565 | wxGetResource(section, entry, &retval, file); |
566 | return retval; | |
567 | } | |
568 | %} | |
1e4a197e | 569 | #endif |
7bf85405 | 570 | |
694759cf | 571 | wxString wxStripMenuCodes(const wxString& in); |
7bf85405 | 572 | |
c368d904 RD |
573 | |
574 | wxString wxGetEmailAddress(); | |
575 | wxString wxGetHostName(); | |
576 | wxString wxGetFullHostName(); | |
577 | wxString wxGetUserId(); | |
578 | wxString wxGetUserName(); | |
579 | wxString wxGetHomeDir(); | |
137b5242 | 580 | wxString wxGetUserHome(const wxString& user = wxPyEmptyString); |
c368d904 | 581 | |
0815db26 | 582 | unsigned long wxGetProcessId(); |
f9bd2c1b RD |
583 | |
584 | // When wxApp gets the virtual method magic then enable this. | |
585 | // bool wxHandleFatalExceptions(bool doIt = TRUE); | |
586 | ||
7bf85405 RD |
587 | //---------------------------------------------------------------------- |
588 | ||
7bf85405 RD |
589 | enum wxEdge { wxLeft, wxTop, wxRight, wxBottom, wxWidth, wxHeight, |
590 | wxCentre, wxCenter = wxCentre, wxCentreX, wxCentreY }; | |
591 | enum wxRelationship { wxUnconstrained = 0, | |
592 | wxAsIs, | |
593 | wxPercentOf, | |
594 | wxAbove, | |
595 | wxBelow, | |
596 | wxLeftOf, | |
597 | wxRightOf, | |
598 | wxSameAs, | |
599 | wxAbsolute }; | |
600 | ||
601 | ||
9416aa89 | 602 | class wxIndividualLayoutConstraint : public wxObject { |
7bf85405 RD |
603 | public: |
604 | // wxIndividualLayoutConstraint(); | |
605 | // ~wxIndividualLayoutConstraint(); | |
606 | ||
607 | void Above(wxWindow *otherWin, int margin=0); | |
608 | void Absolute(int value); | |
08127323 | 609 | void AsIs(); |
7bf85405 | 610 | void Below(wxWindow *otherWin, int margin=0); |
08127323 | 611 | void Unconstrained(); |
7bf85405 RD |
612 | void LeftOf(wxWindow *otherWin, int margin=0); |
613 | void PercentOf(wxWindow *otherWin, wxEdge edge, int percent); | |
614 | void RightOf(wxWindow *otherWin, int margin=0); | |
615 | void SameAs(wxWindow *otherWin, wxEdge edge, int margin=0); | |
616 | void Set(wxRelationship rel, wxWindow *otherWin, wxEdge otherEdge, int value=0, int margin=0); | |
617 | }; | |
618 | ||
619 | ||
9416aa89 | 620 | class wxLayoutConstraints : public wxObject { |
7bf85405 RD |
621 | public: |
622 | wxLayoutConstraints(); | |
623 | ||
624 | %readonly | |
625 | wxIndividualLayoutConstraint bottom; | |
626 | wxIndividualLayoutConstraint centreX; | |
627 | wxIndividualLayoutConstraint centreY; | |
628 | wxIndividualLayoutConstraint height; | |
629 | wxIndividualLayoutConstraint left; | |
630 | wxIndividualLayoutConstraint right; | |
631 | wxIndividualLayoutConstraint top; | |
632 | wxIndividualLayoutConstraint width; | |
633 | %readwrite | |
634 | } | |
635 | ||
636 | ||
b639c3c5 | 637 | |
7bf85405 RD |
638 | //--------------------------------------------------------------------------- |
639 | // Accelerator Entry and Table | |
640 | ||
641 | class wxAcceleratorEntry { | |
642 | public: | |
643 | wxAcceleratorEntry(int flags = 0, int keyCode = 0, int cmd = 0); | |
2f90df85 | 644 | ~wxAcceleratorEntry(); |
7bf85405 RD |
645 | |
646 | void Set(int flags, int keyCode, int Cmd); | |
647 | int GetFlags(); | |
648 | int GetKeyCode(); | |
649 | int GetCommand(); | |
650 | }; | |
651 | ||
652 | ||
9416aa89 | 653 | class wxAcceleratorTable : public wxObject { |
7bf85405 RD |
654 | public: |
655 | // Can also accept a list of 3-tuples | |
eec92d76 | 656 | wxAcceleratorTable(int LCOUNT, wxAcceleratorEntry* choices); |
2f90df85 | 657 | ~wxAcceleratorTable(); |
7bf85405 RD |
658 | |
659 | }; | |
faf3cb35 | 660 | |
c368d904 | 661 | wxAcceleratorEntry *wxGetAccelFromString(const wxString& label); |
f6bcfd97 BP |
662 | |
663 | %readonly | |
664 | %{ | |
665 | #if 0 // we want to use the definition from the header, not the | |
666 | // one SWIG will generate. | |
667 | %} | |
dd116e73 | 668 | // See also wxPy_ReinitStockObjects in helpers.cpp |
f6bcfd97 BP |
669 | extern wxAcceleratorTable wxNullAcceleratorTable; |
670 | %{ | |
671 | #endif | |
672 | %} | |
673 | %readwrite | |
674 | ||
8bf5d46e | 675 | //--------------------------------------------------------------------------- |
2abc0a0f | 676 | |
9416aa89 | 677 | class wxBusyInfo : public wxObject { |
2abc0a0f RD |
678 | public: |
679 | wxBusyInfo(const wxString& message); | |
680 | ~wxBusyInfo(); | |
681 | }; | |
682 | ||
68bc8549 | 683 | |
8bf5d46e RD |
684 | //--------------------------------------------------------------------------- |
685 | ||
686 | ||
c368d904 | 687 |