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,
159 // TODO: Need to custom wrap this one...
160 // int wxGetMultipleChoice(char* message, char* caption,
161 // int LCOUNT, char** LIST,
162 // int nsel, int *selection,
163 // wxWindow *parent = NULL, int x = -1, int y = -1,
164 // bool centre = TRUE, int width=150, int height=200);
167 wxString wxGetSingleChoice(const wxString& message, const wxString& caption,
168 int LCOUNT, wxString* LIST,
169 wxWindow *parent = NULL,
170 int x = -1, int y = -1,
172 int width=150, int height=200);
174 int wxGetSingleChoiceIndex(const wxString& message, const wxString& caption,
175 int LCOUNT, wxString* LIST,
176 wxWindow *parent = NULL,
177 int x = -1, int y = -1,
179 int width=150, int height=200);
182 int wxMessageBox(const wxString& message,
183 const wxString& caption = wxPyEmptyStr,
184 int style = wxOK | wxCENTRE,
185 wxWindow *parent = NULL,
186 int x = -1, int y = -1);
188 //---------------------------------------------------------------------------
191 bool wxColourDisplay();
192 int wxDisplayDepth();
193 void wxSetCursor(wxCursor& cursor);
195 //---------------------------------------------------------------------------
196 // Miscellaneous functions
199 void wxRegisterId(long id);
200 %name(NewId) long wxNewId();
201 %name(RegisterId) void wxRegisterId(long id);
203 void wxBeginBusyCursor(wxCursor *cursor = wxHOURGLASS_CURSOR);
205 void wxDisplaySize(int *OUTPUT, int *OUTPUT);
206 void wxEndBusyCursor();
207 long wxExecute(const wxString& command, bool sync = FALSE);
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);
222 void wxSleep(int secs);
225 void wxEnableTopLevelWindows(bool enable);
228 char* wxGetResource(char *section, char *entry, char *file = NULL) {
230 wxGetResource(section, entry, &retval, file);
235 //---------------------------------------------------------------------------
238 bool wxResourceAddIdentifier(char *name, int value);
239 void wxResourceClear(void);
240 wxBitmap wxResourceCreateBitmap(char *resource);
241 wxIcon wxResourceCreateIcon(char *resource);
242 wxMenuBar * wxResourceCreateMenuBar(char *resource);
243 int wxResourceGetIdentifier(char *name);
244 bool wxResourceParseData(char *resource, wxResourceTable *table = NULL);
245 bool wxResourceParseFile(char *filename, wxResourceTable *table = NULL);
246 bool wxResourceParseString(char *resource, wxResourceTable *table = NULL);
250 //----------------------------------------------------------------------
254 wxPyTimer(PyObject* notify);
257 void Start(int milliseconds=-1, int oneShot=FALSE);
261 //---------------------------------------------------------------------------
263 enum wxEdge { wxLeft, wxTop, wxRight, wxBottom, wxWidth, wxHeight,
264 wxCentre, wxCenter = wxCentre, wxCentreX, wxCentreY };
265 enum wxRelationship { wxUnconstrained = 0,
276 class wxIndividualLayoutConstraint {
278 // wxIndividualLayoutConstraint();
279 // ~wxIndividualLayoutConstraint();
281 void Above(wxWindow *otherWin, int margin=0);
282 void Absolute(int value);
284 void Below(wxWindow *otherWin, int margin=0);
285 void Unconstrained();
286 void LeftOf(wxWindow *otherWin, int margin=0);
287 void PercentOf(wxWindow *otherWin, wxEdge edge, int percent);
288 void RightOf(wxWindow *otherWin, int margin=0);
289 void SameAs(wxWindow *otherWin, wxEdge edge, int margin=0);
290 void Set(wxRelationship rel, wxWindow *otherWin, wxEdge otherEdge, int value=0, int margin=0);
294 class wxLayoutConstraints {
296 wxLayoutConstraints();
299 wxIndividualLayoutConstraint bottom;
300 wxIndividualLayoutConstraint centreX;
301 wxIndividualLayoutConstraint centreY;
302 wxIndividualLayoutConstraint height;
303 wxIndividualLayoutConstraint left;
304 wxIndividualLayoutConstraint right;
305 wxIndividualLayoutConstraint top;
306 wxIndividualLayoutConstraint width;
311 //---------------------------------------------------------------------------
314 enum wxRegionContain {
315 wxOutRegion, wxPartRegion, wxInRegion
325 wxRegionContain Contains(long x, long y);
326 %name(ContainsPoint)wxRegionContain Contains(const wxPoint& pt);
327 %name(ContainsRect)wxRegionContain Contains(const wxRect& rect);
330 bool Intersect(const wxRect& rect);
334 bool Subtract(const wxRect& rect);
335 bool Union(const wxRect& rect);
336 bool Xor(const wxRect& rect);
341 class wxRegionIterator {
343 wxRegionIterator(const wxRegion& region);
365 //---------------------------------------------------------------------------
366 // Accelerator Entry and Table
368 class wxAcceleratorEntry {
370 wxAcceleratorEntry(int flags = 0, int keyCode = 0, int cmd = 0);
371 //~wxAcceleratorEntry(); *** ?
373 void Set(int flags, int keyCode, int Cmd);
380 class wxAcceleratorTable {
382 // Can also accept a list of 3-tuples
383 wxAcceleratorTable(int LCOUNT, wxAcceleratorEntry* LIST);
384 // ~wxAcceleratorEntry(); *** ?
388 //---------------------------------------------------------------------------