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>
20 //----------------------------------------------------------------------
23 %include my_typemaps.i
25 // Import some definitions of other classes, etc.
28 //---------------------------------------------------------------------------
37 wxSize(long w=0, long h=0);
39 void Set(long w, long h);
40 %name(GetWidth) long GetX();
41 %name(GetHeight)long GetY();
45 PyObject* tup = PyTuple_New(2);
46 PyTuple_SET_ITEM(tup, 0, PyInt_FromLong(self->x));
47 PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(self->y));
53 //---------------------------------------------------------------------------
59 wxRealPoint(double x=0.0, double y=0.0);
67 wxPoint(long x=0, long y=0);
71 void Set(long x, long y) {
76 PyObject* tup = PyTuple_New(2);
77 PyTuple_SET_ITEM(tup, 0, PyInt_FromLong(self->x));
78 PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(self->y));
84 //---------------------------------------------------------------------------
88 wxRect(long x=0, long y=0, long w=0, long h=0);
89 // TODO: do this one too... wxRect(const wxPoint& pos, const wxSize& size);
97 void SetWidth(long w);
99 void SetHeight(long h);
102 wxPoint GetPosition();
110 long x, y, width, height;
115 //---------------------------------------------------------------------------
118 char* wxFileSelector(char* message,
119 char* default_path = NULL,
120 char* default_filename = NULL,
121 char* default_extension = NULL,
122 char* wildcard = "*.*",
124 wxWindow *parent = NULL,
125 int x = -1, int y = -1);
127 wxString wxGetTextFromUser(const wxString& message,
128 const wxString& caption = wxPyEmptyStr,
129 const wxString& default_value = wxPyEmptyStr,
130 wxWindow *parent = NULL,
131 int x = -1, int y = -1,
134 // TODO: Need to custom wrap this one...
135 // int wxGetMultipleChoice(char* message, char* caption,
136 // int LCOUNT, char** LIST,
137 // int nsel, int *selection,
138 // wxWindow *parent = NULL, int x = -1, int y = -1,
139 // bool centre = TRUE, int width=150, int height=200);
142 wxString wxGetSingleChoice(const wxString& message, const wxString& caption,
143 int LCOUNT, wxString* LIST,
144 wxWindow *parent = NULL,
145 int x = -1, int y = -1,
147 int width=150, int height=200);
149 int wxGetSingleChoiceIndex(const wxString& message, const wxString& caption,
150 int LCOUNT, wxString* LIST,
151 wxWindow *parent = NULL,
152 int x = -1, int y = -1,
154 int width=150, int height=200);
157 int wxMessageBox(const wxString& message,
158 const wxString& caption = wxPyEmptyStr,
159 int style = wxOK | wxCENTRE,
160 wxWindow *parent = NULL,
161 int x = -1, int y = -1);
163 //---------------------------------------------------------------------------
166 bool wxColourDisplay();
167 int wxDisplayDepth();
168 void wxSetCursor(wxCursor& cursor);
170 //---------------------------------------------------------------------------
171 // Miscellaneous functions
174 void RegisterId(long id);
175 void wxBeginBusyCursor(wxCursor *cursor = wxHOURGLASS_CURSOR);
177 void wxDisplaySize(int *OUTPUT, int *OUTPUT);
178 void wxEndBusyCursor();
179 long wxExecute(const wxString& command, bool sync = FALSE);
180 wxWindow * wxFindWindowByLabel(const wxString& label, wxWindow *parent=NULL);
181 wxWindow * wxFindWindowByName(const wxString& name, wxWindow *parent=NULL);
183 wxWindow * wxGetActiveWindow();
184 long wxGetElapsedTime(bool resetTimer = TRUE);
185 long wxGetFreeMemory();
187 void wxGetMousePosition(int* OUTPUT, int* OUTPUT);
191 bool wxShell(const wxString& command = wxPyEmptyStr);
193 int wxGetOsVersion(int *OUTPUT, int *OUTPUT);
199 char* wxGetResource(char *section, char *entry, char *file = NULL) {
201 wxGetResource(section, entry, &retval, file);
206 //---------------------------------------------------------------------------
209 bool wxResourceAddIdentifier(char *name, int value);
210 void wxResourceClear(void);
211 wxBitmap wxResourceCreateBitmap(char *resource);
212 wxIcon wxResourceCreateIcon(char *resource);
213 wxMenuBar * wxResourceCreateMenuBar(char *resource);
214 int wxResourceGetIdentifier(char *name);
215 bool wxResourceParseData(char *resource, wxResourceTable *table = NULL);
216 bool wxResourceParseFile(char *filename, wxResourceTable *table = NULL);
217 bool wxResourceParseString(char *resource, wxResourceTable *table = NULL);
221 //----------------------------------------------------------------------
225 wxPyTimer(PyObject* notify);
228 void Start(int milliseconds=-1, int oneShot=FALSE);
232 //---------------------------------------------------------------------------
234 enum wxEdge { wxLeft, wxTop, wxRight, wxBottom, wxWidth, wxHeight,
235 wxCentre, wxCenter = wxCentre, wxCentreX, wxCentreY };
236 enum wxRelationship { wxUnconstrained = 0,
247 class wxIndividualLayoutConstraint {
249 // wxIndividualLayoutConstraint();
250 // ~wxIndividualLayoutConstraint();
252 void Above(wxWindow *otherWin, int margin=0);
253 void Absolute(int value);
255 void Below(wxWindow *otherWin, int margin=0);
256 void Unconstrained(void);
257 void LeftOf(wxWindow *otherWin, int margin=0);
258 void PercentOf(wxWindow *otherWin, wxEdge edge, int percent);
259 void RightOf(wxWindow *otherWin, int margin=0);
260 void SameAs(wxWindow *otherWin, wxEdge edge, int margin=0);
261 void Set(wxRelationship rel, wxWindow *otherWin, wxEdge otherEdge, int value=0, int margin=0);
265 class wxLayoutConstraints {
267 wxLayoutConstraints();
270 wxIndividualLayoutConstraint bottom;
271 wxIndividualLayoutConstraint centreX;
272 wxIndividualLayoutConstraint centreY;
273 wxIndividualLayoutConstraint height;
274 wxIndividualLayoutConstraint left;
275 wxIndividualLayoutConstraint right;
276 wxIndividualLayoutConstraint top;
277 wxIndividualLayoutConstraint width;
282 //---------------------------------------------------------------------------
285 enum wxRegionContain {
286 wxOutRegion, wxPartRegion, wxInRegion
296 wxRegionContain Contains(long x, long y);
297 %name(ContainsPoint)wxRegionContain Contains(const wxPoint& pt);
298 %name(ContainsRect)wxRegionContain Contains(const wxRect& rect);
301 bool Intersect(const wxRect& rect);
303 bool Subtract(const wxRect& rect);
304 bool Union(const wxRect& rect);
305 bool Xor(const wxRect& rect);
310 class wxRegionIterator {
312 wxRegionIterator(const wxRegion& region);
334 //---------------------------------------------------------------------------
335 // Accelerator Entry and Table
337 class wxAcceleratorEntry {
339 wxAcceleratorEntry(int flags = 0, int keyCode = 0, int cmd = 0);
340 //~wxAcceleratorEntry(); *** ?
342 void Set(int flags, int keyCode, int Cmd);
349 class wxAcceleratorTable {
351 // Can also accept a list of 3-tuples
352 wxAcceleratorTable(int LCOUNT, wxAcceleratorEntry* LIST);
353 // ~wxAcceleratorEntry(); *** ?
357 //---------------------------------------------------------------------------
358 /////////////////////////////////////////////////////////////////////////////
361 // Revision 1.8 1998/12/15 20:41:22 RD
362 // Changed the import semantics from "from wxPython import *" to "from
363 // wxPython.wx import *" This is for people who are worried about
364 // namespace pollution, they can use "from wxPython import wx" and then
365 // prefix all the wxPython identifiers with "wx."
367 // Added wxTaskbarIcon for wxMSW.
369 // Made the events work for wxGrid.
373 // Added wxMiniFrame for wxGTK, (untested.)
375 // Changed many of the args and return values that were pointers to gdi
376 // objects to references to reflect changes in the wxWindows API.
378 // Other assorted fixes and additions.
380 // Revision 1.7 1998/11/25 08:45:27 RD
382 // Added wxPalette, wxRegion, wxRegionIterator, wxTaskbarIcon
383 // Added events for wxGrid
384 // Other various fixes and additions
386 // Revision 1.6 1998/11/15 23:03:46 RD
387 // Removing some ifdef's for wxGTK
389 // Revision 1.5 1998/10/20 06:43:59 RD
390 // New wxTreeCtrl wrappers (untested)
391 // some changes in helpers
394 // Revision 1.4 1998/08/18 19:48:19 RD
395 // more wxGTK compatibility things.
397 // It builds now but there are serious runtime problems...
399 // Revision 1.3 1998/08/16 04:31:10 RD
402 // Revision 1.2 1998/08/15 07:36:41 RD
403 // - Moved the header in the .i files out of the code that gets put into
404 // the .cpp files. It caused CVS conflicts because of the RCS ID being
405 // different each time.
407 // - A few minor fixes.
409 // Revision 1.1 1998/08/09 08:25:51 RD