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>
19 #include <wx/busyinfo.h>
22 //----------------------------------------------------------------------
25 %include my_typemaps.i
27 // Import some definitions of other classes, etc.
31 //---------------------------------------------------------------------------
41 wxSize(long w=0, long h=0);
43 void Set(long w, long h);
48 void SetWidth(long w);
49 void SetHeight(long h);
53 PyObject* tup = PyTuple_New(2);
54 PyTuple_SET_ITEM(tup, 0, PyInt_FromLong(self->x));
55 PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(self->y));
59 %pragma(python) addtoclass = "def __str__(self): return str(self.asTuple())"
60 %pragma(python) addtoclass = "def __repr__(self): return str(self.asTuple())"
64 //---------------------------------------------------------------------------
70 wxRealPoint(double x=0.0, double y=0.0);
74 void Set(double x, double y) {
79 PyObject* tup = PyTuple_New(2);
80 PyTuple_SET_ITEM(tup, 0, PyFloat_FromDouble(self->x));
81 PyTuple_SET_ITEM(tup, 1, PyFloat_FromDouble(self->y));
85 %pragma(python) addtoclass = "def __str__(self): return str(self.asTuple())"
86 %pragma(python) addtoclass = "def __repr__(self): return str(self.asTuple())"
94 wxPoint(long x=0, long y=0);
98 void Set(long x, long y) {
102 PyObject* asTuple() {
103 PyObject* tup = PyTuple_New(2);
104 PyTuple_SET_ITEM(tup, 0, PyInt_FromLong(self->x));
105 PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(self->y));
109 %pragma(python) addtoclass = "def __str__(self): return str(self.asTuple())"
110 %pragma(python) addtoclass = "def __repr__(self): return str(self.asTuple())"
113 //---------------------------------------------------------------------------
117 wxRect(long x=0, long y=0, long w=0, long h=0);
118 // TODO: do this one too... wxRect(const wxPoint& pos, const wxSize& size);
126 void SetWidth(long w);
128 void SetHeight(long h);
131 wxPoint GetPosition();
139 long x, y, width, height;
142 PyObject* asTuple() {
143 PyObject* tup = PyTuple_New(4);
144 PyTuple_SET_ITEM(tup, 0, PyInt_FromLong(self->x));
145 PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(self->y));
146 PyTuple_SET_ITEM(tup, 2, PyInt_FromLong(self->width));
147 PyTuple_SET_ITEM(tup, 3, PyInt_FromLong(self->height));
151 %pragma(python) addtoclass = "def __str__(self): return str(self.asTuple())"
152 %pragma(python) addtoclass = "def __repr__(self): return str(self.asTuple())"
158 //---------------------------------------------------------------------------
159 // Miscellaneous functions
162 void wxRegisterId(long id);
163 %name(NewId) long wxNewId();
164 %name(RegisterId) void wxRegisterId(long id);
167 void wxDisplaySize(int *OUTPUT, int *OUTPUT);
168 void wxEndBusyCursor();
169 long wxExecute(const wxString& command, bool sync = FALSE);
170 long wxGetElapsedTime(bool resetTimer = TRUE);
172 long wxGetFreeMemory();
174 void wxGetMousePosition(int* OUTPUT, int* OUTPUT);
177 bool wxShell(const wxString& command = wxPyEmptyStr);
179 int wxGetOsVersion(int *OUTPUT, int *OUTPUT);
181 void wxSleep(int secs);
184 void wxEnableTopLevelWindows(bool enable);
187 char* wxGetResource(char *section, char *entry, char *file = NULL) {
189 wxGetResource(section, entry, &retval, file);
194 wxString wxStripMenuCodes(const wxString& in);
196 //----------------------------------------------------------------------
200 wxPyTimer(PyObject* notify);
204 void Start(int milliseconds=-1, int oneShot=FALSE);
208 //---------------------------------------------------------------------------
210 enum wxEdge { wxLeft, wxTop, wxRight, wxBottom, wxWidth, wxHeight,
211 wxCentre, wxCenter = wxCentre, wxCentreX, wxCentreY };
212 enum wxRelationship { wxUnconstrained = 0,
223 class wxIndividualLayoutConstraint {
225 // wxIndividualLayoutConstraint();
226 // ~wxIndividualLayoutConstraint();
228 void Above(wxWindow *otherWin, int margin=0);
229 void Absolute(int value);
231 void Below(wxWindow *otherWin, int margin=0);
232 void Unconstrained();
233 void LeftOf(wxWindow *otherWin, int margin=0);
234 void PercentOf(wxWindow *otherWin, wxEdge edge, int percent);
235 void RightOf(wxWindow *otherWin, int margin=0);
236 void SameAs(wxWindow *otherWin, wxEdge edge, int margin=0);
237 void Set(wxRelationship rel, wxWindow *otherWin, wxEdge otherEdge, int value=0, int margin=0);
241 class wxLayoutConstraints {
243 wxLayoutConstraints();
246 wxIndividualLayoutConstraint bottom;
247 wxIndividualLayoutConstraint centreX;
248 wxIndividualLayoutConstraint centreY;
249 wxIndividualLayoutConstraint height;
250 wxIndividualLayoutConstraint left;
251 wxIndividualLayoutConstraint right;
252 wxIndividualLayoutConstraint top;
253 wxIndividualLayoutConstraint width;
258 //---------------------------------------------------------------------------
261 enum wxRegionContain {
262 wxOutRegion, wxPartRegion, wxInRegion
272 wxRegionContain Contains(long x, long y);
273 %name(ContainsPoint)wxRegionContain Contains(const wxPoint& pt);
274 %name(ContainsRect)wxRegionContain Contains(const wxRect& rect);
277 bool Intersect(const wxRect& rect);
279 bool Subtract(const wxRect& rect);
280 bool Union(const wxRect& rect);
281 bool Xor(const wxRect& rect);
286 class wxRegionIterator {
288 wxRegionIterator(const wxRegion& region);
310 //---------------------------------------------------------------------------
311 // Accelerator Entry and Table
313 class wxAcceleratorEntry {
315 wxAcceleratorEntry(int flags = 0, int keyCode = 0, int cmd = 0);
316 ~wxAcceleratorEntry();
318 void Set(int flags, int keyCode, int Cmd);
325 class wxAcceleratorTable {
327 // Can also accept a list of 3-tuples
328 wxAcceleratorTable(int LCOUNT, wxAcceleratorEntry* LIST);
329 ~wxAcceleratorTable();
333 //---------------------------------------------------------------------------
337 wxBusyInfo(const wxString& message);
343 //---------------------------------------------------------------------------