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 wxRegisterId(long id);
198 %name(NewId) long wxNewId();
199 %name(RegisterId) void wxRegisterId(long id);
201 void wxBeginBusyCursor(wxCursor *cursor = wxHOURGLASS_CURSOR);
203 void wxDisplaySize(int *OUTPUT, int *OUTPUT);
204 void wxEndBusyCursor();
205 long wxExecute(const wxString& command, bool sync = FALSE);
206 wxWindow * wxFindWindowByLabel(const wxString& label, wxWindow *parent=NULL);
207 wxWindow * wxFindWindowByName(const wxString& name, wxWindow *parent=NULL);
209 wxWindow * wxGetActiveWindow();
210 long wxGetElapsedTime(bool resetTimer = TRUE);
211 long wxGetFreeMemory();
213 void wxGetMousePosition(int* OUTPUT, int* OUTPUT);
217 bool wxShell(const wxString& command = wxPyEmptyStr);
219 int wxGetOsVersion(int *OUTPUT, int *OUTPUT);
226 char* wxGetResource(char *section, char *entry, char *file = NULL) {
228 wxGetResource(section, entry, &retval, file);
233 //---------------------------------------------------------------------------
236 bool wxResourceAddIdentifier(char *name, int value);
237 void wxResourceClear(void);
238 wxBitmap wxResourceCreateBitmap(char *resource);
239 wxIcon wxResourceCreateIcon(char *resource);
240 wxMenuBar * wxResourceCreateMenuBar(char *resource);
241 int wxResourceGetIdentifier(char *name);
242 bool wxResourceParseData(char *resource, wxResourceTable *table = NULL);
243 bool wxResourceParseFile(char *filename, wxResourceTable *table = NULL);
244 bool wxResourceParseString(char *resource, wxResourceTable *table = NULL);
248 //----------------------------------------------------------------------
252 wxPyTimer(PyObject* notify);
255 void Start(int milliseconds=-1, int oneShot=FALSE);
259 //---------------------------------------------------------------------------
261 enum wxEdge { wxLeft, wxTop, wxRight, wxBottom, wxWidth, wxHeight,
262 wxCentre, wxCenter = wxCentre, wxCentreX, wxCentreY };
263 enum wxRelationship { wxUnconstrained = 0,
274 class wxIndividualLayoutConstraint {
276 // wxIndividualLayoutConstraint();
277 // ~wxIndividualLayoutConstraint();
279 void Above(wxWindow *otherWin, int margin=0);
280 void Absolute(int value);
282 void Below(wxWindow *otherWin, int margin=0);
283 void Unconstrained();
284 void LeftOf(wxWindow *otherWin, int margin=0);
285 void PercentOf(wxWindow *otherWin, wxEdge edge, int percent);
286 void RightOf(wxWindow *otherWin, int margin=0);
287 void SameAs(wxWindow *otherWin, wxEdge edge, int margin=0);
288 void Set(wxRelationship rel, wxWindow *otherWin, wxEdge otherEdge, int value=0, int margin=0);
292 class wxLayoutConstraints {
294 wxLayoutConstraints();
297 wxIndividualLayoutConstraint bottom;
298 wxIndividualLayoutConstraint centreX;
299 wxIndividualLayoutConstraint centreY;
300 wxIndividualLayoutConstraint height;
301 wxIndividualLayoutConstraint left;
302 wxIndividualLayoutConstraint right;
303 wxIndividualLayoutConstraint top;
304 wxIndividualLayoutConstraint width;
309 //---------------------------------------------------------------------------
312 enum wxRegionContain {
313 wxOutRegion, wxPartRegion, wxInRegion
323 wxRegionContain Contains(long x, long y);
324 %name(ContainsPoint)wxRegionContain Contains(const wxPoint& pt);
325 %name(ContainsRect)wxRegionContain Contains(const wxRect& rect);
328 bool Intersect(const wxRect& rect);
332 bool Subtract(const wxRect& rect);
333 bool Union(const wxRect& rect);
334 bool Xor(const wxRect& rect);
339 class wxRegionIterator {
341 wxRegionIterator(const wxRegion& region);
363 //---------------------------------------------------------------------------
364 // Accelerator Entry and Table
366 class wxAcceleratorEntry {
368 wxAcceleratorEntry(int flags = 0, int keyCode = 0, int cmd = 0);
369 //~wxAcceleratorEntry(); *** ?
371 void Set(int flags, int keyCode, int Cmd);
378 class wxAcceleratorTable {
380 // Can also accept a list of 3-tuples
381 wxAcceleratorTable(int LCOUNT, wxAcceleratorEntry* LIST);
382 // ~wxAcceleratorEntry(); *** ?
386 //---------------------------------------------------------------------------
391 wxToolTip(const wxString &tip);
393 void SetTip(const wxString& tip);
395 // *** Not in the "public" interface void SetWindow(wxWindow *win);
396 wxWindow *GetWindow();
401 void wxToolTip_Enable(bool flag) {
402 wxToolTip::Enable(flag);
405 void wxToolTip_SetDelay(long milliseconds) {
406 wxToolTip::SetDelay(milliseconds);
410 //---------------------------------------------------------------------------
411 /////////////////////////////////////////////////////////////////////////////
414 // Revision 1.14 1999/04/30 03:29:19 RD
415 // wxPython 2.0b9, first phase (win32)
416 // Added gobs of stuff, see wxPython/README.txt for details
418 // Revision 1.13.4.1 1999/03/27 23:29:15 RD
421 // Python thread support
422 // various minor additions
423 // various minor fixes
425 // Revision 1.13 1999/02/25 07:08:34 RD
427 // wxPython version 2.0b5
429 // Revision 1.12 1999/02/20 10:02:37 RD
431 // Changes needed to enable wxGTK compatibility.
433 // Revision 1.11 1999/02/20 09:03:01 RD
434 // Added wxWindow_FromHWND(hWnd) for wxMSW to construct a wxWindow from a
435 // window handle. If you can get the window handle into the python code,
436 // it should just work... More news on this later.
438 // Added wxImageList, wxToolTip.
440 // Re-enabled wxConfig.DeleteAll() since it is reportedly fixed for the
441 // wxRegConfig class.
443 // As usual, some bug fixes, tweaks, etc.
445 // Revision 1.10 1999/01/30 07:30:14 RD
447 // Added wxSashWindow, wxSashEvent, wxLayoutAlgorithm, etc.
449 // Various cleanup, tweaks, minor additions, etc. to maintain
450 // compatibility with the current wxWindows.
452 // Revision 1.9 1998/12/16 22:10:55 RD
454 // Tweaks needed to be able to build wxPython with wxGTK.
456 // Revision 1.8 1998/12/15 20:41:22 RD
457 // Changed the import semantics from "from wxPython import *" to "from
458 // wxPython.wx import *" This is for people who are worried about
459 // namespace pollution, they can use "from wxPython import wx" and then
460 // prefix all the wxPython identifiers with "wx."
462 // Added wxTaskbarIcon for wxMSW.
464 // Made the events work for wxGrid.
468 // Added wxMiniFrame for wxGTK, (untested.)
470 // Changed many of the args and return values that were pointers to gdi
471 // objects to references to reflect changes in the wxWindows API.
473 // Other assorted fixes and additions.
475 // Revision 1.7 1998/11/25 08:45:27 RD
477 // Added wxPalette, wxRegion, wxRegionIterator, wxTaskbarIcon
478 // Added events for wxGrid
479 // Other various fixes and additions
481 // Revision 1.6 1998/11/15 23:03:46 RD
482 // Removing some ifdef's for wxGTK
484 // Revision 1.5 1998/10/20 06:43:59 RD
485 // New wxTreeCtrl wrappers (untested)
486 // some changes in helpers
489 // Revision 1.4 1998/08/18 19:48:19 RD
490 // more wxGTK compatibility things.
492 // It builds now but there are serious runtime problems...
494 // Revision 1.3 1998/08/16 04:31:10 RD
497 // Revision 1.2 1998/08/15 07:36:41 RD
498 // - Moved the header in the .i files out of the code that gets put into
499 // the .cpp files. It caused CVS conflicts because of the RCS ID being
500 // different each time.
502 // - A few minor fixes.
504 // Revision 1.1 1998/08/09 08:25:51 RD