1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: Definitions of miscelaneous functions and classes
9 // Copyright: (c) 1998 by Total Control Software
10 // Licence: wxWindows license
11 /////////////////////////////////////////////////////////////////////////////
17 #include <wx/resource.h>
18 #include <wx/tooltip.h>
21 //----------------------------------------------------------------------
24 %include my_typemaps.i
26 // Import some definitions of other classes, etc.
30 //---------------------------------------------------------------------------
40 wxSize(long w=0, long h=0);
42 void Set(long w, long h);
47 void SetWidth(long w);
48 void SetHeight(long h);
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));
58 %pragma(python) addtoclass = "def __str__(self): return str(self.asTuple())"
59 %pragma(python) addtoclass = "def __repr__(self): return str(self.asTuple())"
63 //---------------------------------------------------------------------------
69 wxRealPoint(double x=0.0, double y=0.0);
73 void Set(double x, double y) {
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));
84 %pragma(python) addtoclass = "def __str__(self): return str(self.asTuple())"
85 %pragma(python) addtoclass = "def __repr__(self): return str(self.asTuple())"
93 wxPoint(long x=0, long y=0);
97 void Set(long x, long y) {
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));
108 %pragma(python) addtoclass = "def __str__(self): return str(self.asTuple())"
109 %pragma(python) addtoclass = "def __repr__(self): return str(self.asTuple())"
112 //---------------------------------------------------------------------------
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);
125 void SetWidth(long w);
127 void SetHeight(long h);
130 wxPoint GetPosition();
138 long x, y, width, height;
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, 0, PyInt_FromLong(self->width));
146 PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(self->height));
150 %pragma(python) addtoclass = "def __str__(self): return str(self.asTuple())"
151 %pragma(python) addtoclass = "def __repr__(self): return str(self.asTuple())"
156 //---------------------------------------------------------------------------
159 wxString wxFileSelector(char* message,
160 char* default_path = NULL,
161 char* default_filename = NULL,
162 char* default_extension = NULL,
163 char* wildcard = "*.*",
165 wxWindow *parent = NULL,
166 int x = -1, int y = -1);
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,
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);
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,
189 int width=150, int height=200);
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,
196 int width=150, int height=200);
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);
205 long wxGetNumberFromUser(const wxString& message,
206 const wxString& prompt,
207 const wxString& caption,
209 long min = 0, long max = 100,
210 wxWindow *parent = NULL,
211 const wxPoint& pos = wxPyDefaultPosition);
213 //---------------------------------------------------------------------------
216 bool wxColourDisplay();
217 int wxDisplayDepth();
218 void wxSetCursor(wxCursor& cursor);
220 //---------------------------------------------------------------------------
221 // Miscellaneous functions
224 void wxRegisterId(long id);
225 %name(NewId) long wxNewId();
226 %name(RegisterId) void wxRegisterId(long id);
228 void wxBeginBusyCursor(wxCursor *cursor = wxHOURGLASS_CURSOR);
230 void wxDisplaySize(int *OUTPUT, int *OUTPUT);
231 void wxEndBusyCursor();
232 long wxExecute(const wxString& command, bool sync = FALSE);
234 wxWindow * wxGetActiveWindow();
235 long wxGetElapsedTime(bool resetTimer = TRUE);
236 long wxGetFreeMemory();
238 void wxGetMousePosition(int* OUTPUT, int* OUTPUT);
242 bool wxShell(const wxString& command = wxPyEmptyStr);
244 int wxGetOsVersion(int *OUTPUT, int *OUTPUT);
247 void wxSleep(int secs);
250 void wxEnableTopLevelWindows(bool enable);
253 char* wxGetResource(char *section, char *entry, char *file = NULL) {
255 wxGetResource(section, entry, &retval, file);
260 //---------------------------------------------------------------------------
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);
275 //----------------------------------------------------------------------
279 wxPyTimer(PyObject* notify);
282 void Start(int milliseconds=-1, int oneShot=FALSE);
286 //---------------------------------------------------------------------------
288 enum wxEdge { wxLeft, wxTop, wxRight, wxBottom, wxWidth, wxHeight,
289 wxCentre, wxCenter = wxCentre, wxCentreX, wxCentreY };
290 enum wxRelationship { wxUnconstrained = 0,
301 class wxIndividualLayoutConstraint {
303 // wxIndividualLayoutConstraint();
304 // ~wxIndividualLayoutConstraint();
306 void Above(wxWindow *otherWin, int margin=0);
307 void Absolute(int value);
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);
319 class wxLayoutConstraints {
321 wxLayoutConstraints();
324 wxIndividualLayoutConstraint bottom;
325 wxIndividualLayoutConstraint centreX;
326 wxIndividualLayoutConstraint centreY;
327 wxIndividualLayoutConstraint height;
328 wxIndividualLayoutConstraint left;
329 wxIndividualLayoutConstraint right;
330 wxIndividualLayoutConstraint top;
331 wxIndividualLayoutConstraint width;
336 //---------------------------------------------------------------------------
339 enum wxRegionContain {
340 wxOutRegion, wxPartRegion, wxInRegion
350 wxRegionContain Contains(long x, long y);
351 %name(ContainsPoint)wxRegionContain Contains(const wxPoint& pt);
352 %name(ContainsRect)wxRegionContain Contains(const wxRect& rect);
355 bool Intersect(const wxRect& rect);
359 bool Subtract(const wxRect& rect);
360 bool Union(const wxRect& rect);
361 bool Xor(const wxRect& rect);
366 class wxRegionIterator {
368 wxRegionIterator(const wxRegion& region);
390 //---------------------------------------------------------------------------
391 // Accelerator Entry and Table
393 class wxAcceleratorEntry {
395 wxAcceleratorEntry(int flags = 0, int keyCode = 0, int cmd = 0);
396 //~wxAcceleratorEntry(); *** ?
398 void Set(int flags, int keyCode, int Cmd);
405 class wxAcceleratorTable {
407 // Can also accept a list of 3-tuples
408 wxAcceleratorTable(int LCOUNT, wxAcceleratorEntry* LIST);
409 // ~wxAcceleratorEntry(); *** ?
413 //---------------------------------------------------------------------------
426 wxSYS_OEM_FIXED_FONT,
427 wxSYS_ANSI_FIXED_FONT,
430 wxSYS_DEVICE_DEFAULT_FONT,
431 wxSYS_DEFAULT_PALETTE,
432 wxSYS_SYSTEM_FIXED_FONT,
433 wxSYS_DEFAULT_GUI_FONT,
435 wxSYS_COLOUR_SCROLLBAR,
436 wxSYS_COLOUR_BACKGROUND,
437 wxSYS_COLOUR_ACTIVECAPTION,
438 wxSYS_COLOUR_INACTIVECAPTION,
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,
457 wxSYS_COLOUR_3DDKSHADOW,
458 wxSYS_COLOUR_3DLIGHT,
459 wxSYS_COLOUR_INFOTEXT,
462 wxSYS_COLOUR_DESKTOP,
464 wxSYS_COLOUR_3DSHADOW,
465 wxSYS_COLOUR_3DHIGHLIGHT,
466 wxSYS_COLOUR_3DHILIGHT,
467 wxSYS_COLOUR_BTNHILIGHT,
480 wxSYS_HSCROLL_ARROW_X,
481 wxSYS_HSCROLL_ARROW_Y,
497 wxSYS_VSCROLL_ARROW_X,
498 wxSYS_VSCROLL_ARROW_Y,
502 wxSYS_NETWORK_PRESENT,
503 wxSYS_PENWINDOWS_PRESENT,
512 wxColour wxSystemSettings_GetSystemColour(int index) {
513 return wxSystemSettings::GetSystemColour(index);
516 wxFont wxSystemSettings_GetSystemFont(int index) {
517 return wxSystemSettings::GetSystemFont(index);
520 int wxSystemSettings_GetSystemMetric(int index) {
521 return wxSystemSettings::GetSystemMetric(index);
525 //---------------------------------------------------------------------------
526 //---------------------------------------------------------------------------