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 //---------------------------------------------------------------------------
192 bool wxColourDisplay();
193 int wxDisplayDepth();
194 void wxSetCursor(wxCursor& cursor);
196 //---------------------------------------------------------------------------
197 // Miscellaneous functions
200 void wxRegisterId(long id);
201 %name(NewId) long wxNewId();
202 %name(RegisterId) void wxRegisterId(long id);
204 void wxBeginBusyCursor(wxCursor *cursor = wxHOURGLASS_CURSOR);
206 void wxDisplaySize(int *OUTPUT, int *OUTPUT);
207 void wxEndBusyCursor();
208 long wxExecute(const wxString& command, bool sync = FALSE);
210 wxWindow * wxGetActiveWindow();
211 long wxGetElapsedTime(bool resetTimer = TRUE);
212 long wxGetFreeMemory();
214 void wxGetMousePosition(int* OUTPUT, int* OUTPUT);
218 bool wxShell(const wxString& command = wxPyEmptyStr);
220 int wxGetOsVersion(int *OUTPUT, int *OUTPUT);
223 void wxSleep(int secs);
226 void wxEnableTopLevelWindows(bool enable);
229 char* wxGetResource(char *section, char *entry, char *file = NULL) {
231 wxGetResource(section, entry, &retval, file);
236 //---------------------------------------------------------------------------
239 bool wxResourceAddIdentifier(char *name, int value);
240 void wxResourceClear(void);
241 wxBitmap wxResourceCreateBitmap(char *resource);
242 wxIcon wxResourceCreateIcon(char *resource);
243 wxMenuBar * wxResourceCreateMenuBar(char *resource);
244 int wxResourceGetIdentifier(char *name);
245 bool wxResourceParseData(char *resource, wxResourceTable *table = NULL);
246 bool wxResourceParseFile(char *filename, wxResourceTable *table = NULL);
247 bool wxResourceParseString(char *resource, wxResourceTable *table = NULL);
251 //----------------------------------------------------------------------
255 wxPyTimer(PyObject* notify);
258 void Start(int milliseconds=-1, int oneShot=FALSE);
262 //---------------------------------------------------------------------------
264 enum wxEdge { wxLeft, wxTop, wxRight, wxBottom, wxWidth, wxHeight,
265 wxCentre, wxCenter = wxCentre, wxCentreX, wxCentreY };
266 enum wxRelationship { wxUnconstrained = 0,
277 class wxIndividualLayoutConstraint {
279 // wxIndividualLayoutConstraint();
280 // ~wxIndividualLayoutConstraint();
282 void Above(wxWindow *otherWin, int margin=0);
283 void Absolute(int value);
285 void Below(wxWindow *otherWin, int margin=0);
286 void Unconstrained();
287 void LeftOf(wxWindow *otherWin, int margin=0);
288 void PercentOf(wxWindow *otherWin, wxEdge edge, int percent);
289 void RightOf(wxWindow *otherWin, int margin=0);
290 void SameAs(wxWindow *otherWin, wxEdge edge, int margin=0);
291 void Set(wxRelationship rel, wxWindow *otherWin, wxEdge otherEdge, int value=0, int margin=0);
295 class wxLayoutConstraints {
297 wxLayoutConstraints();
300 wxIndividualLayoutConstraint bottom;
301 wxIndividualLayoutConstraint centreX;
302 wxIndividualLayoutConstraint centreY;
303 wxIndividualLayoutConstraint height;
304 wxIndividualLayoutConstraint left;
305 wxIndividualLayoutConstraint right;
306 wxIndividualLayoutConstraint top;
307 wxIndividualLayoutConstraint width;
312 //---------------------------------------------------------------------------
315 enum wxRegionContain {
316 wxOutRegion, wxPartRegion, wxInRegion
326 wxRegionContain Contains(long x, long y);
327 %name(ContainsPoint)wxRegionContain Contains(const wxPoint& pt);
328 %name(ContainsRect)wxRegionContain Contains(const wxRect& rect);
331 bool Intersect(const wxRect& rect);
335 bool Subtract(const wxRect& rect);
336 bool Union(const wxRect& rect);
337 bool Xor(const wxRect& rect);
342 class wxRegionIterator {
344 wxRegionIterator(const wxRegion& region);
366 //---------------------------------------------------------------------------
367 // Accelerator Entry and Table
369 class wxAcceleratorEntry {
371 wxAcceleratorEntry(int flags = 0, int keyCode = 0, int cmd = 0);
372 //~wxAcceleratorEntry(); *** ?
374 void Set(int flags, int keyCode, int Cmd);
381 class wxAcceleratorTable {
383 // Can also accept a list of 3-tuples
384 wxAcceleratorTable(int LCOUNT, wxAcceleratorEntry* LIST);
385 // ~wxAcceleratorEntry(); *** ?
389 //---------------------------------------------------------------------------