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.
29 //---------------------------------------------------------------------------
40 wxSize(long w=0, long h=0);
42 void Set(long w, long h);
45 %name(GetWidth) long GetX();
46 %name(GetHeight)long GetY();
50 PyObject* tup = PyTuple_New(2);
51 PyTuple_SET_ITEM(tup, 0, PyInt_FromLong(self->x));
52 PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(self->y));
56 %pragma(python) addtoclass = "def __str__(self): return str(self.asTuple())"
57 %pragma(python) addtoclass = "def __repr__(self): return str(self.asTuple())"
61 //---------------------------------------------------------------------------
67 wxRealPoint(double x=0.0, double y=0.0);
75 wxPoint(long x=0, long y=0);
79 void Set(long x, long y) {
84 PyObject* tup = PyTuple_New(2);
85 PyTuple_SET_ITEM(tup, 0, PyInt_FromLong(self->x));
86 PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(self->y));
90 %pragma(python) addtoclass = "def __str__(self): return str(self.asTuple())"
91 %pragma(python) addtoclass = "def __repr__(self): return str(self.asTuple())"
94 //---------------------------------------------------------------------------
98 wxRect(long x=0, long y=0, long w=0, long h=0);
99 // TODO: do this one too... wxRect(const wxPoint& pos, const wxSize& size);
107 void SetWidth(long w);
109 void SetHeight(long h);
112 wxPoint GetPosition();
120 long x, y, width, height;
123 PyObject* asTuple() {
124 PyObject* tup = PyTuple_New(4);
125 PyTuple_SET_ITEM(tup, 0, PyInt_FromLong(self->x));
126 PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(self->y));
127 PyTuple_SET_ITEM(tup, 0, PyInt_FromLong(self->width));
128 PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(self->height));
132 %pragma(python) addtoclass = "def __str__(self): return str(self.asTuple())"
133 %pragma(python) addtoclass = "def __repr__(self): return str(self.asTuple())"
138 //---------------------------------------------------------------------------
141 wxString wxFileSelector(char* message,
142 char* default_path = NULL,
143 char* default_filename = NULL,
144 char* default_extension = NULL,
145 char* wildcard = "*.*",
147 wxWindow *parent = NULL,
148 int x = -1, int y = -1);
150 wxString wxGetTextFromUser(const wxString& message,
151 const wxString& caption = wxPyEmptyStr,
152 const wxString& default_value = wxPyEmptyStr,
153 wxWindow *parent = NULL,
154 int x = -1, int y = -1,
157 // TODO: Need to custom wrap this one...
158 // int wxGetMultipleChoice(char* message, char* caption,
159 // int LCOUNT, char** LIST,
160 // int nsel, int *selection,
161 // wxWindow *parent = NULL, int x = -1, int y = -1,
162 // bool centre = TRUE, int width=150, int height=200);
165 wxString wxGetSingleChoice(const wxString& message, const wxString& caption,
166 int LCOUNT, wxString* LIST,
167 wxWindow *parent = NULL,
168 int x = -1, int y = -1,
170 int width=150, int height=200);
172 int wxGetSingleChoiceIndex(const wxString& message, const wxString& caption,
173 int LCOUNT, wxString* LIST,
174 wxWindow *parent = NULL,
175 int x = -1, int y = -1,
177 int width=150, int height=200);
180 int wxMessageBox(const wxString& message,
181 const wxString& caption = wxPyEmptyStr,
182 int style = wxOK | wxCENTRE,
183 wxWindow *parent = NULL,
184 int x = -1, int y = -1);
186 //---------------------------------------------------------------------------
189 bool wxColourDisplay();
190 int wxDisplayDepth();
191 void wxSetCursor(wxCursor& cursor);
193 //---------------------------------------------------------------------------
194 // Miscellaneous functions
197 void RegisterId(long id);
198 void wxBeginBusyCursor(wxCursor *cursor = wxHOURGLASS_CURSOR);
200 void wxDisplaySize(int *OUTPUT, int *OUTPUT);
201 void wxEndBusyCursor();
202 long wxExecute(const wxString& command, bool sync = FALSE);
203 wxWindow * wxFindWindowByLabel(const wxString& label, wxWindow *parent=NULL);
204 wxWindow * wxFindWindowByName(const wxString& name, wxWindow *parent=NULL);
206 wxWindow * wxGetActiveWindow();
207 long wxGetElapsedTime(bool resetTimer = TRUE);
208 long wxGetFreeMemory();
210 void wxGetMousePosition(int* OUTPUT, int* OUTPUT);
214 bool wxShell(const wxString& command = wxPyEmptyStr);
216 int wxGetOsVersion(int *OUTPUT, int *OUTPUT);
222 char* wxGetResource(char *section, char *entry, char *file = NULL) {
224 wxGetResource(section, entry, &retval, file);
229 //---------------------------------------------------------------------------
232 bool wxResourceAddIdentifier(char *name, int value);
233 void wxResourceClear(void);
234 wxBitmap wxResourceCreateBitmap(char *resource);
235 wxIcon wxResourceCreateIcon(char *resource);
236 wxMenuBar * wxResourceCreateMenuBar(char *resource);
237 int wxResourceGetIdentifier(char *name);
238 bool wxResourceParseData(char *resource, wxResourceTable *table = NULL);
239 bool wxResourceParseFile(char *filename, wxResourceTable *table = NULL);
240 bool wxResourceParseString(char *resource, wxResourceTable *table = NULL);
244 //----------------------------------------------------------------------
248 wxPyTimer(PyObject* notify);
251 void Start(int milliseconds=-1, int oneShot=FALSE);
255 //---------------------------------------------------------------------------
257 enum wxEdge { wxLeft, wxTop, wxRight, wxBottom, wxWidth, wxHeight,
258 wxCentre, wxCenter = wxCentre, wxCentreX, wxCentreY };
259 enum wxRelationship { wxUnconstrained = 0,
270 class wxIndividualLayoutConstraint {
272 // wxIndividualLayoutConstraint();
273 // ~wxIndividualLayoutConstraint();
275 void Above(wxWindow *otherWin, int margin=0);
276 void Absolute(int value);
278 void Below(wxWindow *otherWin, int margin=0);
279 void Unconstrained();
280 void LeftOf(wxWindow *otherWin, int margin=0);
281 void PercentOf(wxWindow *otherWin, wxEdge edge, int percent);
282 void RightOf(wxWindow *otherWin, int margin=0);
283 void SameAs(wxWindow *otherWin, wxEdge edge, int margin=0);
284 void Set(wxRelationship rel, wxWindow *otherWin, wxEdge otherEdge, int value=0, int margin=0);
288 class wxLayoutConstraints {
290 wxLayoutConstraints();
293 wxIndividualLayoutConstraint bottom;
294 wxIndividualLayoutConstraint centreX;
295 wxIndividualLayoutConstraint centreY;
296 wxIndividualLayoutConstraint height;
297 wxIndividualLayoutConstraint left;
298 wxIndividualLayoutConstraint right;
299 wxIndividualLayoutConstraint top;
300 wxIndividualLayoutConstraint width;
305 //---------------------------------------------------------------------------
308 enum wxRegionContain {
309 wxOutRegion, wxPartRegion, wxInRegion
319 wxRegionContain Contains(long x, long y);
320 %name(ContainsPoint)wxRegionContain Contains(const wxPoint& pt);
321 %name(ContainsRect)wxRegionContain Contains(const wxRect& rect);
324 bool Intersect(const wxRect& rect);
328 bool Subtract(const wxRect& rect);
329 bool Union(const wxRect& rect);
330 bool Xor(const wxRect& rect);
335 class wxRegionIterator {
337 wxRegionIterator(const wxRegion& region);
359 //---------------------------------------------------------------------------
360 // Accelerator Entry and Table
362 class wxAcceleratorEntry {
364 wxAcceleratorEntry(int flags = 0, int keyCode = 0, int cmd = 0);
365 //~wxAcceleratorEntry(); *** ?
367 void Set(int flags, int keyCode, int Cmd);
374 class wxAcceleratorTable {
376 // Can also accept a list of 3-tuples
377 wxAcceleratorTable(int LCOUNT, wxAcceleratorEntry* LIST);
378 // ~wxAcceleratorEntry(); *** ?
382 //---------------------------------------------------------------------------
387 wxToolTip(const wxString &tip);
389 void SetTip(const wxString& tip);
392 void SetWindow(wxWindow *win);
394 wxWindow *GetWindow();
399 void wxToolTip_Enable(bool flag) {
400 wxToolTip::Enable(flag);
403 void wxToolTip_SetDelay(long milliseconds) {
404 wxToolTip::SetDelay(milliseconds);
408 //---------------------------------------------------------------------------
409 /////////////////////////////////////////////////////////////////////////////
412 // Revision 1.12 1999/02/20 10:02:37 RD
413 // Changes needed to enable wxGTK compatibility.
415 // Revision 1.11 1999/02/20 09:03:01 RD
416 // Added wxWindow_FromHWND(hWnd) for wxMSW to construct a wxWindow from a
417 // window handle. If you can get the window handle into the python code,
418 // it should just work... More news on this later.
420 // Added wxImageList, wxToolTip.
422 // Re-enabled wxConfig.DeleteAll() since it is reportedly fixed for the
423 // wxRegConfig class.
425 // As usual, some bug fixes, tweaks, etc.
427 // Revision 1.10 1999/01/30 07:30:14 RD
429 // Added wxSashWindow, wxSashEvent, wxLayoutAlgorithm, etc.
431 // Various cleanup, tweaks, minor additions, etc. to maintain
432 // compatibility with the current wxWindows.
434 // Revision 1.9 1998/12/16 22:10:55 RD
436 // Tweaks needed to be able to build wxPython with wxGTK.
438 // Revision 1.8 1998/12/15 20:41:22 RD
439 // Changed the import semantics from "from wxPython import *" to "from
440 // wxPython.wx import *" This is for people who are worried about
441 // namespace pollution, they can use "from wxPython import wx" and then
442 // prefix all the wxPython identifiers with "wx."
444 // Added wxTaskbarIcon for wxMSW.
446 // Made the events work for wxGrid.
450 // Added wxMiniFrame for wxGTK, (untested.)
452 // Changed many of the args and return values that were pointers to gdi
453 // objects to references to reflect changes in the wxWindows API.
455 // Other assorted fixes and additions.
457 // Revision 1.7 1998/11/25 08:45:27 RD
459 // Added wxPalette, wxRegion, wxRegionIterator, wxTaskbarIcon
460 // Added events for wxGrid
461 // Other various fixes and additions
463 // Revision 1.6 1998/11/15 23:03:46 RD
464 // Removing some ifdef's for wxGTK
466 // Revision 1.5 1998/10/20 06:43:59 RD
467 // New wxTreeCtrl wrappers (untested)
468 // some changes in helpers
471 // Revision 1.4 1998/08/18 19:48:19 RD
472 // more wxGTK compatibility things.
474 // It builds now but there are serious runtime problems...
476 // Revision 1.3 1998/08/16 04:31:10 RD
479 // Revision 1.2 1998/08/15 07:36:41 RD
480 // - Moved the header in the .i files out of the code that gets put into
481 // the .cpp files. It caused CVS conflicts because of the RCS ID being
482 // different each time.
484 // - A few minor fixes.
486 // Revision 1.1 1998/08/09 08:25:51 RD