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);
195 //----------------------------------------------------------------------
199 wxPyTimer(PyObject* notify);
202 void Start(int milliseconds=-1, int oneShot=FALSE);
206 //---------------------------------------------------------------------------
208 enum wxEdge { wxLeft, wxTop, wxRight, wxBottom, wxWidth, wxHeight,
209 wxCentre, wxCenter = wxCentre, wxCentreX, wxCentreY };
210 enum wxRelationship { wxUnconstrained = 0,
221 class wxIndividualLayoutConstraint {
223 // wxIndividualLayoutConstraint();
224 // ~wxIndividualLayoutConstraint();
226 void Above(wxWindow *otherWin, int margin=0);
227 void Absolute(int value);
229 void Below(wxWindow *otherWin, int margin=0);
230 void Unconstrained();
231 void LeftOf(wxWindow *otherWin, int margin=0);
232 void PercentOf(wxWindow *otherWin, wxEdge edge, int percent);
233 void RightOf(wxWindow *otherWin, int margin=0);
234 void SameAs(wxWindow *otherWin, wxEdge edge, int margin=0);
235 void Set(wxRelationship rel, wxWindow *otherWin, wxEdge otherEdge, int value=0, int margin=0);
239 class wxLayoutConstraints {
241 wxLayoutConstraints();
244 wxIndividualLayoutConstraint bottom;
245 wxIndividualLayoutConstraint centreX;
246 wxIndividualLayoutConstraint centreY;
247 wxIndividualLayoutConstraint height;
248 wxIndividualLayoutConstraint left;
249 wxIndividualLayoutConstraint right;
250 wxIndividualLayoutConstraint top;
251 wxIndividualLayoutConstraint width;
256 //---------------------------------------------------------------------------
259 enum wxRegionContain {
260 wxOutRegion, wxPartRegion, wxInRegion
270 wxRegionContain Contains(long x, long y);
271 %name(ContainsPoint)wxRegionContain Contains(const wxPoint& pt);
272 %name(ContainsRect)wxRegionContain Contains(const wxRect& rect);
275 bool Intersect(const wxRect& rect);
277 bool Subtract(const wxRect& rect);
278 bool Union(const wxRect& rect);
279 bool Xor(const wxRect& rect);
284 class wxRegionIterator {
286 wxRegionIterator(const wxRegion& region);
308 //---------------------------------------------------------------------------
309 // Accelerator Entry and Table
311 class wxAcceleratorEntry {
313 wxAcceleratorEntry(int flags = 0, int keyCode = 0, int cmd = 0);
314 ~wxAcceleratorEntry();
316 void Set(int flags, int keyCode, int Cmd);
323 class wxAcceleratorTable {
325 // Can also accept a list of 3-tuples
326 wxAcceleratorTable(int LCOUNT, wxAcceleratorEntry* LIST);
327 ~wxAcceleratorTable();
331 //---------------------------------------------------------------------------
335 wxBusyInfo(const wxString& message);
341 //---------------------------------------------------------------------------