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);
170 long wxGetFreeMemory();
171 void wxGetMousePosition(int* OUTPUT, int* OUTPUT);
174 bool wxShell(const wxString& command = wxPyEmptyStr);
176 int wxGetOsVersion(int *OUTPUT, int *OUTPUT);
178 void wxSleep(int secs);
181 void wxEnableTopLevelWindows(bool enable);
184 char* wxGetResource(char *section, char *entry, char *file = NULL) {
186 wxGetResource(section, entry, &retval, file);
192 //----------------------------------------------------------------------
196 wxPyTimer(PyObject* notify);
199 void Start(int milliseconds=-1, int oneShot=FALSE);
203 //---------------------------------------------------------------------------
205 enum wxEdge { wxLeft, wxTop, wxRight, wxBottom, wxWidth, wxHeight,
206 wxCentre, wxCenter = wxCentre, wxCentreX, wxCentreY };
207 enum wxRelationship { wxUnconstrained = 0,
218 class wxIndividualLayoutConstraint {
220 // wxIndividualLayoutConstraint();
221 // ~wxIndividualLayoutConstraint();
223 void Above(wxWindow *otherWin, int margin=0);
224 void Absolute(int value);
226 void Below(wxWindow *otherWin, int margin=0);
227 void Unconstrained();
228 void LeftOf(wxWindow *otherWin, int margin=0);
229 void PercentOf(wxWindow *otherWin, wxEdge edge, int percent);
230 void RightOf(wxWindow *otherWin, int margin=0);
231 void SameAs(wxWindow *otherWin, wxEdge edge, int margin=0);
232 void Set(wxRelationship rel, wxWindow *otherWin, wxEdge otherEdge, int value=0, int margin=0);
236 class wxLayoutConstraints {
238 wxLayoutConstraints();
241 wxIndividualLayoutConstraint bottom;
242 wxIndividualLayoutConstraint centreX;
243 wxIndividualLayoutConstraint centreY;
244 wxIndividualLayoutConstraint height;
245 wxIndividualLayoutConstraint left;
246 wxIndividualLayoutConstraint right;
247 wxIndividualLayoutConstraint top;
248 wxIndividualLayoutConstraint width;
253 //---------------------------------------------------------------------------
256 enum wxRegionContain {
257 wxOutRegion, wxPartRegion, wxInRegion
267 wxRegionContain Contains(long x, long y);
268 %name(ContainsPoint)wxRegionContain Contains(const wxPoint& pt);
269 %name(ContainsRect)wxRegionContain Contains(const wxRect& rect);
272 bool Intersect(const wxRect& rect);
274 bool Subtract(const wxRect& rect);
275 bool Union(const wxRect& rect);
276 bool Xor(const wxRect& rect);
281 class wxRegionIterator {
283 wxRegionIterator(const wxRegion& region);
305 //---------------------------------------------------------------------------
306 // Accelerator Entry and Table
308 class wxAcceleratorEntry {
310 wxAcceleratorEntry(int flags = 0, int keyCode = 0, int cmd = 0);
311 ~wxAcceleratorEntry();
313 void Set(int flags, int keyCode, int Cmd);
320 class wxAcceleratorTable {
322 // Can also accept a list of 3-tuples
323 wxAcceleratorTable(int LCOUNT, wxAcceleratorEntry* LIST);
324 ~wxAcceleratorTable();
328 //---------------------------------------------------------------------------
329 //---------------------------------------------------------------------------