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);
77 wxPoint(long x=0, long y=0);
81 void Set(long x, long y) {
86 PyObject* tup = PyTuple_New(2);
87 PyTuple_SET_ITEM(tup, 0, PyInt_FromLong(self->x));
88 PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(self->y));
92 %pragma(python) addtoclass = "def __str__(self): return str(self.asTuple())"
93 %pragma(python) addtoclass = "def __repr__(self): return str(self.asTuple())"
96 //---------------------------------------------------------------------------
100 wxRect(long x=0, long y=0, long w=0, long h=0);
101 // TODO: do this one too... wxRect(const wxPoint& pos, const wxSize& size);
109 void SetWidth(long w);
111 void SetHeight(long h);
114 wxPoint GetPosition();
122 long x, y, width, height;
125 PyObject* asTuple() {
126 PyObject* tup = PyTuple_New(4);
127 PyTuple_SET_ITEM(tup, 0, PyInt_FromLong(self->x));
128 PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(self->y));
129 PyTuple_SET_ITEM(tup, 0, PyInt_FromLong(self->width));
130 PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(self->height));
134 %pragma(python) addtoclass = "def __str__(self): return str(self.asTuple())"
135 %pragma(python) addtoclass = "def __repr__(self): return str(self.asTuple())"
140 //---------------------------------------------------------------------------
143 wxString wxFileSelector(char* message,
144 char* default_path = NULL,
145 char* default_filename = NULL,
146 char* default_extension = NULL,
147 char* wildcard = "*.*",
149 wxWindow *parent = NULL,
150 int x = -1, int y = -1);
152 wxString wxGetTextFromUser(const wxString& message,
153 const wxString& caption = wxPyEmptyStr,
154 const wxString& default_value = wxPyEmptyStr,
155 wxWindow *parent = NULL,
156 int x = -1, int y = -1,
160 // TODO: Need to custom wrap this one...
161 // int wxGetMultipleChoice(char* message, char* caption,
162 // int LCOUNT, char** LIST,
163 // int nsel, int *selection,
164 // wxWindow *parent = NULL, int x = -1, int y = -1,
165 // bool centre = TRUE, int width=150, int height=200);
168 wxString wxGetSingleChoice(const wxString& message, const wxString& caption,
169 int LCOUNT, wxString* LIST,
170 wxWindow *parent = NULL,
171 int x = -1, int y = -1,
173 int width=150, int height=200);
175 int wxGetSingleChoiceIndex(const wxString& message, const wxString& caption,
176 int LCOUNT, wxString* LIST,
177 wxWindow *parent = NULL,
178 int x = -1, int y = -1,
180 int width=150, int height=200);
183 int wxMessageBox(const wxString& message,
184 const wxString& caption = wxPyEmptyStr,
185 int style = wxOK | wxCENTRE,
186 wxWindow *parent = NULL,
187 int x = -1, int y = -1);
189 long wxGetNumberFromUser(const wxString& message,
190 const wxString& prompt,
191 const wxString& caption,
193 long min = 0, long max = 100,
194 wxWindow *parent = NULL,
195 const wxPoint& pos = wxPyDefaultPosition);
197 //---------------------------------------------------------------------------
200 bool wxColourDisplay();
201 int wxDisplayDepth();
202 void wxSetCursor(wxCursor& cursor);
204 //---------------------------------------------------------------------------
205 // Miscellaneous functions
208 void wxRegisterId(long id);
209 %name(NewId) long wxNewId();
210 %name(RegisterId) void wxRegisterId(long id);
212 void wxBeginBusyCursor(wxCursor *cursor = wxHOURGLASS_CURSOR);
214 void wxDisplaySize(int *OUTPUT, int *OUTPUT);
215 void wxEndBusyCursor();
216 long wxExecute(const wxString& command, bool sync = FALSE);
218 wxWindow * wxGetActiveWindow();
219 long wxGetElapsedTime(bool resetTimer = TRUE);
220 long wxGetFreeMemory();
222 void wxGetMousePosition(int* OUTPUT, int* OUTPUT);
226 bool wxShell(const wxString& command = wxPyEmptyStr);
228 int wxGetOsVersion(int *OUTPUT, int *OUTPUT);
231 void wxSleep(int secs);
234 void wxEnableTopLevelWindows(bool enable);
237 char* wxGetResource(char *section, char *entry, char *file = NULL) {
239 wxGetResource(section, entry, &retval, file);
244 //---------------------------------------------------------------------------
247 bool wxResourceAddIdentifier(char *name, int value);
248 void wxResourceClear(void);
249 wxBitmap wxResourceCreateBitmap(char *resource);
250 wxIcon wxResourceCreateIcon(char *resource);
251 wxMenuBar * wxResourceCreateMenuBar(char *resource);
252 int wxResourceGetIdentifier(char *name);
253 bool wxResourceParseData(char *resource, wxResourceTable *table = NULL);
254 bool wxResourceParseFile(char *filename, wxResourceTable *table = NULL);
255 bool wxResourceParseString(char *resource, wxResourceTable *table = NULL);
259 //----------------------------------------------------------------------
263 wxPyTimer(PyObject* notify);
266 void Start(int milliseconds=-1, int oneShot=FALSE);
270 //---------------------------------------------------------------------------
272 enum wxEdge { wxLeft, wxTop, wxRight, wxBottom, wxWidth, wxHeight,
273 wxCentre, wxCenter = wxCentre, wxCentreX, wxCentreY };
274 enum wxRelationship { wxUnconstrained = 0,
285 class wxIndividualLayoutConstraint {
287 // wxIndividualLayoutConstraint();
288 // ~wxIndividualLayoutConstraint();
290 void Above(wxWindow *otherWin, int margin=0);
291 void Absolute(int value);
293 void Below(wxWindow *otherWin, int margin=0);
294 void Unconstrained();
295 void LeftOf(wxWindow *otherWin, int margin=0);
296 void PercentOf(wxWindow *otherWin, wxEdge edge, int percent);
297 void RightOf(wxWindow *otherWin, int margin=0);
298 void SameAs(wxWindow *otherWin, wxEdge edge, int margin=0);
299 void Set(wxRelationship rel, wxWindow *otherWin, wxEdge otherEdge, int value=0, int margin=0);
303 class wxLayoutConstraints {
305 wxLayoutConstraints();
308 wxIndividualLayoutConstraint bottom;
309 wxIndividualLayoutConstraint centreX;
310 wxIndividualLayoutConstraint centreY;
311 wxIndividualLayoutConstraint height;
312 wxIndividualLayoutConstraint left;
313 wxIndividualLayoutConstraint right;
314 wxIndividualLayoutConstraint top;
315 wxIndividualLayoutConstraint width;
320 //---------------------------------------------------------------------------
323 enum wxRegionContain {
324 wxOutRegion, wxPartRegion, wxInRegion
334 wxRegionContain Contains(long x, long y);
335 %name(ContainsPoint)wxRegionContain Contains(const wxPoint& pt);
336 %name(ContainsRect)wxRegionContain Contains(const wxRect& rect);
339 bool Intersect(const wxRect& rect);
343 bool Subtract(const wxRect& rect);
344 bool Union(const wxRect& rect);
345 bool Xor(const wxRect& rect);
350 class wxRegionIterator {
352 wxRegionIterator(const wxRegion& region);
374 //---------------------------------------------------------------------------
375 // Accelerator Entry and Table
377 class wxAcceleratorEntry {
379 wxAcceleratorEntry(int flags = 0, int keyCode = 0, int cmd = 0);
380 //~wxAcceleratorEntry(); *** ?
382 void Set(int flags, int keyCode, int Cmd);
389 class wxAcceleratorTable {
391 // Can also accept a list of 3-tuples
392 wxAcceleratorTable(int LCOUNT, wxAcceleratorEntry* LIST);
393 // ~wxAcceleratorEntry(); *** ?
397 //---------------------------------------------------------------------------
410 wxSYS_OEM_FIXED_FONT,
411 wxSYS_ANSI_FIXED_FONT,
414 wxSYS_DEVICE_DEFAULT_FONT,
415 wxSYS_DEFAULT_PALETTE,
416 wxSYS_SYSTEM_FIXED_FONT,
417 wxSYS_DEFAULT_GUI_FONT,
419 wxSYS_COLOUR_SCROLLBAR,
420 wxSYS_COLOUR_BACKGROUND,
421 wxSYS_COLOUR_ACTIVECAPTION,
422 wxSYS_COLOUR_INACTIVECAPTION,
425 wxSYS_COLOUR_WINDOWFRAME,
426 wxSYS_COLOUR_MENUTEXT,
427 wxSYS_COLOUR_WINDOWTEXT,
428 wxSYS_COLOUR_CAPTIONTEXT,
429 wxSYS_COLOUR_ACTIVEBORDER,
430 wxSYS_COLOUR_INACTIVEBORDER,
431 wxSYS_COLOUR_APPWORKSPACE,
432 wxSYS_COLOUR_HIGHLIGHT,
433 wxSYS_COLOUR_HIGHLIGHTTEXT,
434 wxSYS_COLOUR_BTNFACE,
435 wxSYS_COLOUR_BTNSHADOW,
436 wxSYS_COLOUR_GRAYTEXT,
437 wxSYS_COLOUR_BTNTEXT,
438 wxSYS_COLOUR_INACTIVECAPTIONTEXT,
439 wxSYS_COLOUR_BTNHIGHLIGHT,
441 wxSYS_COLOUR_3DDKSHADOW,
442 wxSYS_COLOUR_3DLIGHT,
443 wxSYS_COLOUR_INFOTEXT,
446 wxSYS_COLOUR_DESKTOP,
448 wxSYS_COLOUR_3DSHADOW,
449 wxSYS_COLOUR_3DHIGHLIGHT,
450 wxSYS_COLOUR_3DHILIGHT,
451 wxSYS_COLOUR_BTNHILIGHT,
464 wxSYS_HSCROLL_ARROW_X,
465 wxSYS_HSCROLL_ARROW_Y,
481 wxSYS_VSCROLL_ARROW_X,
482 wxSYS_VSCROLL_ARROW_Y,
486 wxSYS_NETWORK_PRESENT,
487 wxSYS_PENWINDOWS_PRESENT,
496 wxColour wxSystemSettings_GetSystemColour(int index) {
497 return wxSystemSettings::GetSystemColour(index);
500 wxFont wxSystemSettings_GetSystemFont(int index) {
501 return wxSystemSettings::GetSystemFont(index);
504 int wxSystemSettings_GetSystemMetric(int index) {
505 return wxSystemSettings::GetSystemMetric(index);
509 //---------------------------------------------------------------------------
510 //---------------------------------------------------------------------------