]> git.saurik.com Git - wxWidgets.git/blob - utils/wxPython/src/misc.i
updated generated sources
[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 %}
20
21 //----------------------------------------------------------------------
22
23 %include typemaps.i
24 %include my_typemaps.i
25
26 // Import some definitions of other classes, etc.
27 %import _defs.i
28
29
30 //---------------------------------------------------------------------------
31
32
33 class wxSize {
34 public:
35 long x;
36 long y;
37 %name(width) long x;
38 %name(height)long y;
39
40 wxSize(long w=0, long h=0);
41 ~wxSize();
42 void Set(long w, long h);
43 long GetX();
44 long GetY();
45 long GetWidth();
46 long GetHeight();
47 void SetWidth(long w);
48 void SetHeight(long h);
49
50 %addmethods {
51 PyObject* asTuple() {
52 PyObject* tup = PyTuple_New(2);
53 PyTuple_SET_ITEM(tup, 0, PyInt_FromLong(self->x));
54 PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(self->y));
55 return tup;
56 }
57 }
58 %pragma(python) addtoclass = "def __str__(self): return str(self.asTuple())"
59 %pragma(python) addtoclass = "def __repr__(self): return str(self.asTuple())"
60
61 };
62
63 //---------------------------------------------------------------------------
64
65 class wxRealPoint {
66 public:
67 double x;
68 double y;
69 wxRealPoint(double x=0.0, double y=0.0);
70 ~wxRealPoint();
71
72 %addmethods {
73 void Set(double x, double y) {
74 self->x = x;
75 self->y = y;
76 }
77 PyObject* asTuple() {
78 PyObject* tup = PyTuple_New(2);
79 PyTuple_SET_ITEM(tup, 0, PyFloat_FromDouble(self->x));
80 PyTuple_SET_ITEM(tup, 1, PyFloat_FromDouble(self->y));
81 return tup;
82 }
83 }
84 %pragma(python) addtoclass = "def __str__(self): return str(self.asTuple())"
85 %pragma(python) addtoclass = "def __repr__(self): return str(self.asTuple())"
86 };
87
88
89 class wxPoint {
90 public:
91 long x;
92 long y;
93 wxPoint(long x=0, long y=0);
94 ~wxPoint();
95
96 %addmethods {
97 void Set(long x, long y) {
98 self->x = x;
99 self->y = y;
100 }
101 PyObject* asTuple() {
102 PyObject* tup = PyTuple_New(2);
103 PyTuple_SET_ITEM(tup, 0, PyInt_FromLong(self->x));
104 PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(self->y));
105 return tup;
106 }
107 }
108 %pragma(python) addtoclass = "def __str__(self): return str(self.asTuple())"
109 %pragma(python) addtoclass = "def __repr__(self): return str(self.asTuple())"
110 };
111
112 //---------------------------------------------------------------------------
113
114 class wxRect {
115 public:
116 wxRect(long x=0, long y=0, long w=0, long h=0);
117 // TODO: do this one too... wxRect(const wxPoint& pos, const wxSize& size);
118 ~wxRect();
119
120 long GetX();
121 void SetX(long X);
122 long GetY();
123 void SetY(long Y);
124 long GetWidth();
125 void SetWidth(long w);
126 long GetHeight();
127 void SetHeight(long h);
128
129
130 wxPoint GetPosition();
131 wxSize GetSize();
132
133 long GetLeft();
134 long GetTop();
135 long GetBottom();
136 long GetRight();
137
138 long x, y, width, height;
139
140 %addmethods {
141 PyObject* asTuple() {
142 PyObject* tup = PyTuple_New(4);
143 PyTuple_SET_ITEM(tup, 0, PyInt_FromLong(self->x));
144 PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(self->y));
145 PyTuple_SET_ITEM(tup, 2, PyInt_FromLong(self->width));
146 PyTuple_SET_ITEM(tup, 3, PyInt_FromLong(self->height));
147 return tup;
148 }
149 }
150 %pragma(python) addtoclass = "def __str__(self): return str(self.asTuple())"
151 %pragma(python) addtoclass = "def __repr__(self): return str(self.asTuple())"
152 };
153
154
155
156 //---------------------------------------------------------------------------
157 // Dialog Functions
158
159 wxString wxFileSelector(char* message,
160 char* default_path = NULL,
161 char* default_filename = NULL,
162 char* default_extension = NULL,
163 char* wildcard = "*.*",
164 int flags = 0,
165 wxWindow *parent = NULL,
166 int x = -1, int y = -1);
167
168 wxString wxGetTextFromUser(const wxString& message,
169 const wxString& caption = wxPyEmptyStr,
170 const wxString& default_value = wxPyEmptyStr,
171 wxWindow *parent = NULL,
172 int x = -1, int y = -1,
173 bool centre = TRUE);
174
175
176 // TODO: Need to custom wrap this one...
177 // int wxGetMultipleChoice(char* message, char* caption,
178 // int LCOUNT, char** LIST,
179 // int nsel, int *selection,
180 // wxWindow *parent = NULL, int x = -1, int y = -1,
181 // bool centre = TRUE, int width=150, int height=200);
182
183
184 wxString wxGetSingleChoice(const wxString& message, const wxString& caption,
185 int LCOUNT, wxString* LIST,
186 wxWindow *parent = NULL,
187 int x = -1, int y = -1,
188 bool centre = TRUE,
189 int width=150, int height=200);
190
191 int wxGetSingleChoiceIndex(const wxString& message, const wxString& caption,
192 int LCOUNT, wxString* LIST,
193 wxWindow *parent = NULL,
194 int x = -1, int y = -1,
195 bool centre = TRUE,
196 int width=150, int height=200);
197
198
199 int wxMessageBox(const wxString& message,
200 const wxString& caption = wxPyEmptyStr,
201 int style = wxOK | wxCENTRE,
202 wxWindow *parent = NULL,
203 int x = -1, int y = -1);
204
205 long wxGetNumberFromUser(const wxString& message,
206 const wxString& prompt,
207 const wxString& caption,
208 long value,
209 long min = 0, long max = 100,
210 wxWindow *parent = NULL,
211 const wxPoint& pos = wxPyDefaultPosition);
212
213 //---------------------------------------------------------------------------
214 // GDI Functions
215
216 bool wxColourDisplay();
217 int wxDisplayDepth();
218 void wxSetCursor(wxCursor& cursor);
219
220 //---------------------------------------------------------------------------
221 // Miscellaneous functions
222
223 long wxNewId();
224 void wxRegisterId(long id);
225 %name(NewId) long wxNewId();
226 %name(RegisterId) void wxRegisterId(long id);
227
228 void wxBeginBusyCursor(wxCursor *cursor = wxHOURGLASS_CURSOR);
229 void wxBell();
230 void wxDisplaySize(int *OUTPUT, int *OUTPUT);
231 void wxEndBusyCursor();
232 long wxExecute(const wxString& command, bool sync = FALSE);
233 #ifdef __WXMSW__
234 wxWindow * wxGetActiveWindow();
235 long wxGetElapsedTime(bool resetTimer = TRUE);
236 long wxGetFreeMemory();
237 #endif
238 void wxGetMousePosition(int* OUTPUT, int* OUTPUT);
239 bool wxIsBusy();
240 wxString wxNow();
241 #ifdef __WXMSW__
242 bool wxShell(const wxString& command = wxPyEmptyStr);
243 void wxStartTimer();
244 int wxGetOsVersion(int *OUTPUT, int *OUTPUT);
245 #endif
246
247 void wxSleep(int secs);
248 bool wxYield();
249 bool wxSafeYield();
250 void wxEnableTopLevelWindows(bool enable);
251
252 %inline %{
253 char* wxGetResource(char *section, char *entry, char *file = NULL) {
254 char * retval;
255 wxGetResource(section, entry, &retval, file);
256 return retval;
257 }
258 %}
259
260 //---------------------------------------------------------------------------
261 // Resource System
262
263 bool wxResourceAddIdentifier(char *name, int value);
264 void wxResourceClear(void);
265 wxBitmap wxResourceCreateBitmap(char *resource);
266 wxIcon wxResourceCreateIcon(char *resource);
267 wxMenuBar * wxResourceCreateMenuBar(char *resource);
268 int wxResourceGetIdentifier(char *name);
269 bool wxResourceParseData(char *resource, wxResourceTable *table = NULL);
270 bool wxResourceParseFile(char *filename, wxResourceTable *table = NULL);
271 bool wxResourceParseString(char *resource, wxResourceTable *table = NULL);
272
273
274
275 //----------------------------------------------------------------------
276
277 class wxPyTimer {
278 public:
279 wxPyTimer(PyObject* notify);
280 ~wxPyTimer();
281 int Interval();
282 void Start(int milliseconds=-1, int oneShot=FALSE);
283 void Stop();
284 };
285
286 //---------------------------------------------------------------------------
287
288 enum wxEdge { wxLeft, wxTop, wxRight, wxBottom, wxWidth, wxHeight,
289 wxCentre, wxCenter = wxCentre, wxCentreX, wxCentreY };
290 enum wxRelationship { wxUnconstrained = 0,
291 wxAsIs,
292 wxPercentOf,
293 wxAbove,
294 wxBelow,
295 wxLeftOf,
296 wxRightOf,
297 wxSameAs,
298 wxAbsolute };
299
300
301 class wxIndividualLayoutConstraint {
302 public:
303 // wxIndividualLayoutConstraint();
304 // ~wxIndividualLayoutConstraint();
305
306 void Above(wxWindow *otherWin, int margin=0);
307 void Absolute(int value);
308 void AsIs();
309 void Below(wxWindow *otherWin, int margin=0);
310 void Unconstrained();
311 void LeftOf(wxWindow *otherWin, int margin=0);
312 void PercentOf(wxWindow *otherWin, wxEdge edge, int percent);
313 void RightOf(wxWindow *otherWin, int margin=0);
314 void SameAs(wxWindow *otherWin, wxEdge edge, int margin=0);
315 void Set(wxRelationship rel, wxWindow *otherWin, wxEdge otherEdge, int value=0, int margin=0);
316 };
317
318
319 class wxLayoutConstraints {
320 public:
321 wxLayoutConstraints();
322
323 %readonly
324 wxIndividualLayoutConstraint bottom;
325 wxIndividualLayoutConstraint centreX;
326 wxIndividualLayoutConstraint centreY;
327 wxIndividualLayoutConstraint height;
328 wxIndividualLayoutConstraint left;
329 wxIndividualLayoutConstraint right;
330 wxIndividualLayoutConstraint top;
331 wxIndividualLayoutConstraint width;
332 %readwrite
333 }
334
335
336 //---------------------------------------------------------------------------
337 // Regions, etc.
338
339 enum wxRegionContain {
340 wxOutRegion, wxPartRegion, wxInRegion
341 };
342
343
344 class wxRegion {
345 public:
346 wxRegion();
347 ~wxRegion();
348
349 void Clear();
350 wxRegionContain Contains(long x, long y);
351 %name(ContainsPoint)wxRegionContain Contains(const wxPoint& pt);
352 %name(ContainsRect)wxRegionContain Contains(const wxRect& rect);
353
354 wxRect GetBox();
355 bool Intersect(const wxRect& rect);
356 #ifdef __WXMSW__
357 bool IsEmpty();
358 #endif
359 bool Subtract(const wxRect& rect);
360 bool Union(const wxRect& rect);
361 bool Xor(const wxRect& rect);
362 };
363
364
365
366 class wxRegionIterator {
367 public:
368 wxRegionIterator(const wxRegion& region);
369 ~wxRegionIterator();
370
371 long GetX();
372 long GetY();
373 long GetW();
374 long GetWidth();
375 long GetH();
376 long GetHeight();
377 wxRect GetRect();
378 bool HaveRects();
379 void Reset();
380
381 %addmethods {
382 void Next() {
383 (*self) ++;
384 }
385 };
386 };
387
388
389
390 //---------------------------------------------------------------------------
391 // Accelerator Entry and Table
392
393 class wxAcceleratorEntry {
394 public:
395 wxAcceleratorEntry(int flags = 0, int keyCode = 0, int cmd = 0);
396 ~wxAcceleratorEntry();
397
398 void Set(int flags, int keyCode, int Cmd);
399 int GetFlags();
400 int GetKeyCode();
401 int GetCommand();
402 };
403
404
405 class wxAcceleratorTable {
406 public:
407 // Can also accept a list of 3-tuples
408 wxAcceleratorTable(int LCOUNT, wxAcceleratorEntry* LIST);
409 ~wxAcceleratorTable();
410
411 };
412
413 //---------------------------------------------------------------------------
414
415 enum {
416 wxSYS_WHITE_BRUSH,
417 wxSYS_LTGRAY_BRUSH,
418 wxSYS_GRAY_BRUSH,
419 wxSYS_DKGRAY_BRUSH,
420 wxSYS_BLACK_BRUSH,
421 wxSYS_NULL_BRUSH,
422 wxSYS_HOLLOW_BRUSH,
423 wxSYS_WHITE_PEN,
424 wxSYS_BLACK_PEN,
425 wxSYS_NULL_PEN,
426 wxSYS_OEM_FIXED_FONT,
427 wxSYS_ANSI_FIXED_FONT,
428 wxSYS_ANSI_VAR_FONT,
429 wxSYS_SYSTEM_FONT,
430 wxSYS_DEVICE_DEFAULT_FONT,
431 wxSYS_DEFAULT_PALETTE,
432 wxSYS_SYSTEM_FIXED_FONT,
433 wxSYS_DEFAULT_GUI_FONT,
434
435 wxSYS_COLOUR_SCROLLBAR,
436 wxSYS_COLOUR_BACKGROUND,
437 wxSYS_COLOUR_ACTIVECAPTION,
438 wxSYS_COLOUR_INACTIVECAPTION,
439 wxSYS_COLOUR_MENU,
440 wxSYS_COLOUR_WINDOW,
441 wxSYS_COLOUR_WINDOWFRAME,
442 wxSYS_COLOUR_MENUTEXT,
443 wxSYS_COLOUR_WINDOWTEXT,
444 wxSYS_COLOUR_CAPTIONTEXT,
445 wxSYS_COLOUR_ACTIVEBORDER,
446 wxSYS_COLOUR_INACTIVEBORDER,
447 wxSYS_COLOUR_APPWORKSPACE,
448 wxSYS_COLOUR_HIGHLIGHT,
449 wxSYS_COLOUR_HIGHLIGHTTEXT,
450 wxSYS_COLOUR_BTNFACE,
451 wxSYS_COLOUR_BTNSHADOW,
452 wxSYS_COLOUR_GRAYTEXT,
453 wxSYS_COLOUR_BTNTEXT,
454 wxSYS_COLOUR_INACTIVECAPTIONTEXT,
455 wxSYS_COLOUR_BTNHIGHLIGHT,
456
457 wxSYS_COLOUR_3DDKSHADOW,
458 wxSYS_COLOUR_3DLIGHT,
459 wxSYS_COLOUR_INFOTEXT,
460 wxSYS_COLOUR_INFOBK,
461
462 wxSYS_COLOUR_DESKTOP,
463 wxSYS_COLOUR_3DFACE,
464 wxSYS_COLOUR_3DSHADOW,
465 wxSYS_COLOUR_3DHIGHLIGHT,
466 wxSYS_COLOUR_3DHILIGHT,
467 wxSYS_COLOUR_BTNHILIGHT,
468
469 wxSYS_MOUSE_BUTTONS,
470 wxSYS_BORDER_X,
471 wxSYS_BORDER_Y,
472 wxSYS_CURSOR_X,
473 wxSYS_CURSOR_Y,
474 wxSYS_DCLICK_X,
475 wxSYS_DCLICK_Y,
476 wxSYS_DRAG_X,
477 wxSYS_DRAG_Y,
478 wxSYS_EDGE_X,
479 wxSYS_EDGE_Y,
480 wxSYS_HSCROLL_ARROW_X,
481 wxSYS_HSCROLL_ARROW_Y,
482 wxSYS_HTHUMB_X,
483 wxSYS_ICON_X,
484 wxSYS_ICON_Y,
485 wxSYS_ICONSPACING_X,
486 wxSYS_ICONSPACING_Y,
487 wxSYS_WINDOWMIN_X,
488 wxSYS_WINDOWMIN_Y,
489 wxSYS_SCREEN_X,
490 wxSYS_SCREEN_Y,
491 wxSYS_FRAMESIZE_X,
492 wxSYS_FRAMESIZE_Y,
493 wxSYS_SMALLICON_X,
494 wxSYS_SMALLICON_Y,
495 wxSYS_HSCROLL_Y,
496 wxSYS_VSCROLL_X,
497 wxSYS_VSCROLL_ARROW_X,
498 wxSYS_VSCROLL_ARROW_Y,
499 wxSYS_VTHUMB_Y,
500 wxSYS_CAPTION_Y,
501 wxSYS_MENU_Y,
502 wxSYS_NETWORK_PRESENT,
503 wxSYS_PENWINDOWS_PRESENT,
504 wxSYS_SHOW_SOUNDS,
505 wxSYS_SWAP_BUTTONS,
506 };
507
508
509
510 %inline %{
511
512 wxColour wxSystemSettings_GetSystemColour(int index) {
513 return wxSystemSettings::GetSystemColour(index);
514 }
515
516 wxFont wxSystemSettings_GetSystemFont(int index) {
517 return wxSystemSettings::GetSystemFont(index);
518 }
519
520 int wxSystemSettings_GetSystemMetric(int index) {
521 return wxSystemSettings::GetSystemMetric(index);
522 }
523 %}
524
525 //---------------------------------------------------------------------------
526 //---------------------------------------------------------------------------
527
528