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);
73 void Set(double x, double y) {
78 PyObject* tup = PyTuple_New(2);
79 PyTuple_SET_ITEM(tup, 0, PyFloat_FromDouble(self->x));
80 PyTuple_SET_ITEM(tup, 1, PyFloat_FromDouble(self->y));
84 %pragma(python) addtoclass = "def __str__(self): return str(self.asTuple())"
85 %pragma(python) addtoclass = "def __repr__(self): return str(self.asTuple())"
93 wxPoint(long x=0, long y=0);
97 void Set(long x, long y) {
101 PyObject* asTuple() {
102 PyObject* tup = PyTuple_New(2);
103 PyTuple_SET_ITEM(tup, 0, PyInt_FromLong(self->x));
104 PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(self->y));
108 %pragma(python) addtoclass = "def __str__(self): return str(self.asTuple())"
109 %pragma(python) addtoclass = "def __repr__(self): return str(self.asTuple())"
112 //---------------------------------------------------------------------------
116 wxRect(long x=0, long y=0, long w=0, long h=0);
117 // TODO: do this one too... wxRect(const wxPoint& pos, const wxSize& size);
125 void SetWidth(long w);
127 void SetHeight(long h);
130 wxPoint GetPosition();
138 long x, y, width, height;
141 PyObject* asTuple() {
142 PyObject* tup = PyTuple_New(4);
143 PyTuple_SET_ITEM(tup, 0, PyInt_FromLong(self->x));
144 PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(self->y));
145 PyTuple_SET_ITEM(tup, 2, PyInt_FromLong(self->width));
146 PyTuple_SET_ITEM(tup, 3, PyInt_FromLong(self->height));
150 %pragma(python) addtoclass = "def __str__(self): return str(self.asTuple())"
151 %pragma(python) addtoclass = "def __repr__(self): return str(self.asTuple())"
157 //---------------------------------------------------------------------------
158 // Miscellaneous functions
161 void wxRegisterId(long id);
162 %name(NewId) long wxNewId();
163 %name(RegisterId) void wxRegisterId(long id);
166 void wxDisplaySize(int *OUTPUT, int *OUTPUT);
167 void wxEndBusyCursor();
168 long wxExecute(const wxString& command, bool sync = FALSE);
169 long wxGetElapsedTime(bool resetTimer = TRUE);
171 long wxGetFreeMemory();
173 void wxGetMousePosition(int* OUTPUT, int* OUTPUT);
176 bool wxShell(const wxString& command = wxPyEmptyStr);
178 int wxGetOsVersion(int *OUTPUT, int *OUTPUT);
180 void wxSleep(int secs);
183 void wxEnableTopLevelWindows(bool enable);
186 char* wxGetResource(char *section, char *entry, char *file = NULL) {
188 wxGetResource(section, entry, &retval, file);
194 //----------------------------------------------------------------------
198 wxPyTimer(PyObject* notify);
201 void Start(int milliseconds=-1, int oneShot=FALSE);
205 //---------------------------------------------------------------------------
207 enum wxEdge { wxLeft, wxTop, wxRight, wxBottom, wxWidth, wxHeight,
208 wxCentre, wxCenter = wxCentre, wxCentreX, wxCentreY };
209 enum wxRelationship { wxUnconstrained = 0,
220 class wxIndividualLayoutConstraint {
222 // wxIndividualLayoutConstraint();
223 // ~wxIndividualLayoutConstraint();
225 void Above(wxWindow *otherWin, int margin=0);
226 void Absolute(int value);
228 void Below(wxWindow *otherWin, int margin=0);
229 void Unconstrained();
230 void LeftOf(wxWindow *otherWin, int margin=0);
231 void PercentOf(wxWindow *otherWin, wxEdge edge, int percent);
232 void RightOf(wxWindow *otherWin, int margin=0);
233 void SameAs(wxWindow *otherWin, wxEdge edge, int margin=0);
234 void Set(wxRelationship rel, wxWindow *otherWin, wxEdge otherEdge, int value=0, int margin=0);
238 class wxLayoutConstraints {
240 wxLayoutConstraints();
243 wxIndividualLayoutConstraint bottom;
244 wxIndividualLayoutConstraint centreX;
245 wxIndividualLayoutConstraint centreY;
246 wxIndividualLayoutConstraint height;
247 wxIndividualLayoutConstraint left;
248 wxIndividualLayoutConstraint right;
249 wxIndividualLayoutConstraint top;
250 wxIndividualLayoutConstraint width;
255 //---------------------------------------------------------------------------
258 enum wxRegionContain {
259 wxOutRegion, wxPartRegion, wxInRegion
269 wxRegionContain Contains(long x, long y);
270 %name(ContainsPoint)wxRegionContain Contains(const wxPoint& pt);
271 %name(ContainsRect)wxRegionContain Contains(const wxRect& rect);
274 bool Intersect(const wxRect& rect);
276 bool Subtract(const wxRect& rect);
277 bool Union(const wxRect& rect);
278 bool Xor(const wxRect& rect);
283 class wxRegionIterator {
285 wxRegionIterator(const wxRegion& region);
307 //---------------------------------------------------------------------------
308 // Accelerator Entry and Table
310 class wxAcceleratorEntry {
312 wxAcceleratorEntry(int flags = 0, int keyCode = 0, int cmd = 0);
313 ~wxAcceleratorEntry();
315 void Set(int flags, int keyCode, int Cmd);
322 class wxAcceleratorTable {
324 // Can also accept a list of 3-tuples
325 wxAcceleratorTable(int LCOUNT, wxAcceleratorEntry* LIST);
326 ~wxAcceleratorTable();
330 //---------------------------------------------------------------------------
331 //---------------------------------------------------------------------------