]> git.saurik.com Git - wxWidgets.git/blame - utils/wxPython/src/misc.i
Made SetType public to match MSW.
[wxWidgets.git] / utils / wxPython / src / misc.i
CommitLineData
7bf85405
RD
1/////////////////////////////////////////////////////////////////////////////
2// Name: misc.i
3// Purpose: Definitions of miscelaneous functions and classes
4//
5// Author: Robin Dunn
6//
7// Created: 7/3/97
8// RCS-ID: $Id$
9// Copyright: (c) 1998 by Total Control Software
10// Licence: wxWindows license
11/////////////////////////////////////////////////////////////////////////////
12
03e9bead 13%module misc
7bf85405 14
03e9bead 15%{
7bf85405
RD
16#include "helpers.h"
17#include <wx/resource.h>
af309447 18#include <wx/tooltip.h>
2abc0a0f 19#include <wx/busyinfo.h>
7bf85405
RD
20%}
21
22//----------------------------------------------------------------------
23
24%include typemaps.i
25%include my_typemaps.i
26
27// Import some definitions of other classes, etc.
28%import _defs.i
29
7bf85405 30
bb0054cd 31//---------------------------------------------------------------------------
7bf85405
RD
32
33
34class wxSize {
35public:
af309447
RD
36 long x;
37 long y;
7bf85405
RD
38 %name(width) long x;
39 %name(height)long y;
40
41 wxSize(long w=0, long h=0);
42 ~wxSize();
43 void Set(long w, long h);
af309447
RD
44 long GetX();
45 long GetY();
bb0054cd
RD
46 long GetWidth();
47 long GetHeight();
48 void SetWidth(long w);
49 void SetHeight(long h);
7bf85405
RD
50
51 %addmethods {
af309447 52 PyObject* asTuple() {
7bf85405
RD
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));
56 return tup;
57 }
58 }
af309447
RD
59 %pragma(python) addtoclass = "def __str__(self): return str(self.asTuple())"
60 %pragma(python) addtoclass = "def __repr__(self): return str(self.asTuple())"
61
7bf85405
RD
62};
63
64//---------------------------------------------------------------------------
65
66class wxRealPoint {
67public:
68 double x;
69 double y;
70 wxRealPoint(double x=0.0, double y=0.0);
71 ~wxRealPoint();
efc5f224
RD
72
73 %addmethods {
74 void Set(double x, double y) {
75 self->x = x;
76 self->y = y;
77 }
78 PyObject* asTuple() {
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));
82 return tup;
83 }
84 }
85 %pragma(python) addtoclass = "def __str__(self): return str(self.asTuple())"
86 %pragma(python) addtoclass = "def __repr__(self): return str(self.asTuple())"
7bf85405
RD
87};
88
efc5f224 89
7bf85405
RD
90class wxPoint {
91public:
92 long x;
93 long y;
94 wxPoint(long x=0, long y=0);
95 ~wxPoint();
96
97 %addmethods {
98 void Set(long x, long y) {
99 self->x = x;
100 self->y = y;
101 }
af309447 102 PyObject* asTuple() {
7bf85405
RD
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));
106 return tup;
107 }
108 }
af309447
RD
109 %pragma(python) addtoclass = "def __str__(self): return str(self.asTuple())"
110 %pragma(python) addtoclass = "def __repr__(self): return str(self.asTuple())"
7bf85405
RD
111};
112
113//---------------------------------------------------------------------------
114
115class wxRect {
116public:
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);
119 ~wxRect();
120
121 long GetX();
122 void SetX(long X);
123 long GetY();
124 void SetY(long Y);
125 long GetWidth();
126 void SetWidth(long w);
127 long GetHeight();
128 void SetHeight(long h);
129
130
131 wxPoint GetPosition();
132 wxSize GetSize();
133
134 long GetLeft();
135 long GetTop();
136 long GetBottom();
137 long GetRight();
138
139 long x, y, width, height;
af309447
RD
140
141 %addmethods {
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));
f0261a72
RD
146 PyTuple_SET_ITEM(tup, 2, PyInt_FromLong(self->width));
147 PyTuple_SET_ITEM(tup, 3, PyInt_FromLong(self->height));
af309447
RD
148 return tup;
149 }
150 }
151 %pragma(python) addtoclass = "def __str__(self): return str(self.asTuple())"
152 %pragma(python) addtoclass = "def __repr__(self): return str(self.asTuple())"
7bf85405
RD
153};
154
155
156
7bf85405
RD
157
158//---------------------------------------------------------------------------
159// Miscellaneous functions
160
cf694132
RD
161long wxNewId();
162void wxRegisterId(long id);
163%name(NewId) long wxNewId();
164%name(RegisterId) void wxRegisterId(long id);
165
7bf85405
RD
166void wxBell();
167void wxDisplaySize(int *OUTPUT, int *OUTPUT);
168void wxEndBusyCursor();
169long wxExecute(const wxString& command, bool sync = FALSE);
7bf85405 170long wxGetElapsedTime(bool resetTimer = TRUE);
bc29c5e0 171#ifdef __WXMSW__
7bf85405 172long wxGetFreeMemory();
bc29c5e0 173#endif
7bf85405
RD
174void wxGetMousePosition(int* OUTPUT, int* OUTPUT);
175bool wxIsBusy();
176wxString wxNow();
fb5e0af0 177bool wxShell(const wxString& command = wxPyEmptyStr);
7bf85405 178void wxStartTimer();
fb5e0af0 179int wxGetOsVersion(int *OUTPUT, int *OUTPUT);
fb5e0af0 180
bb0054cd 181void wxSleep(int secs);
7bf85405 182bool wxYield();
cf694132 183bool wxSafeYield();
bb0054cd 184void wxEnableTopLevelWindows(bool enable);
7bf85405 185
7bf85405
RD
186%inline %{
187 char* wxGetResource(char *section, char *entry, char *file = NULL) {
188 char * retval;
189 wxGetResource(section, entry, &retval, file);
190 return retval;
191 }
192%}
193
7bf85405
RD
194
195//----------------------------------------------------------------------
196
197class wxPyTimer {
198public:
199 wxPyTimer(PyObject* notify);
200 ~wxPyTimer();
201 int Interval();
202 void Start(int milliseconds=-1, int oneShot=FALSE);
203 void Stop();
204};
205
206//---------------------------------------------------------------------------
207
208enum wxEdge { wxLeft, wxTop, wxRight, wxBottom, wxWidth, wxHeight,
209 wxCentre, wxCenter = wxCentre, wxCentreX, wxCentreY };
210enum wxRelationship { wxUnconstrained = 0,
211 wxAsIs,
212 wxPercentOf,
213 wxAbove,
214 wxBelow,
215 wxLeftOf,
216 wxRightOf,
217 wxSameAs,
218 wxAbsolute };
219
220
221class wxIndividualLayoutConstraint {
222public:
223// wxIndividualLayoutConstraint();
224// ~wxIndividualLayoutConstraint();
225
226 void Above(wxWindow *otherWin, int margin=0);
227 void Absolute(int value);
08127323 228 void AsIs();
7bf85405 229 void Below(wxWindow *otherWin, int margin=0);
08127323 230 void Unconstrained();
7bf85405
RD
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);
236};
237
238
239class wxLayoutConstraints {
240public:
241 wxLayoutConstraints();
242
243%readonly
244 wxIndividualLayoutConstraint bottom;
245 wxIndividualLayoutConstraint centreX;
246 wxIndividualLayoutConstraint centreY;
247 wxIndividualLayoutConstraint height;
248 wxIndividualLayoutConstraint left;
249 wxIndividualLayoutConstraint right;
250 wxIndividualLayoutConstraint top;
251 wxIndividualLayoutConstraint width;
252%readwrite
253}
254
255
b639c3c5
RD
256//---------------------------------------------------------------------------
257// Regions, etc.
258
259enum wxRegionContain {
260 wxOutRegion, wxPartRegion, wxInRegion
261};
262
263
264class wxRegion {
265public:
266 wxRegion();
267 ~wxRegion();
268
269 void Clear();
270 wxRegionContain Contains(long x, long y);
271 %name(ContainsPoint)wxRegionContain Contains(const wxPoint& pt);
272 %name(ContainsRect)wxRegionContain Contains(const wxRect& rect);
273
274 wxRect GetBox();
275 bool Intersect(const wxRect& rect);
276 bool IsEmpty();
277 bool Subtract(const wxRect& rect);
278 bool Union(const wxRect& rect);
279 bool Xor(const wxRect& rect);
280};
281
282
283
284class wxRegionIterator {
285public:
286 wxRegionIterator(const wxRegion& region);
287 ~wxRegionIterator();
288
289 long GetX();
290 long GetY();
291 long GetW();
292 long GetWidth();
293 long GetH();
294 long GetHeight();
295 wxRect GetRect();
296 bool HaveRects();
297 void Reset();
298
299 %addmethods {
300 void Next() {
301 (*self) ++;
302 }
303 };
304};
305
306
307
7bf85405
RD
308//---------------------------------------------------------------------------
309// Accelerator Entry and Table
310
311class wxAcceleratorEntry {
312public:
313 wxAcceleratorEntry(int flags = 0, int keyCode = 0, int cmd = 0);
2f90df85 314 ~wxAcceleratorEntry();
7bf85405
RD
315
316 void Set(int flags, int keyCode, int Cmd);
317 int GetFlags();
318 int GetKeyCode();
319 int GetCommand();
320};
321
322
323class wxAcceleratorTable {
324public:
325 // Can also accept a list of 3-tuples
326 wxAcceleratorTable(int LCOUNT, wxAcceleratorEntry* LIST);
2f90df85 327 ~wxAcceleratorTable();
7bf85405
RD
328
329};
faf3cb35 330
8bf5d46e 331//---------------------------------------------------------------------------
2abc0a0f
RD
332
333class wxBusyInfo {
334public:
335 wxBusyInfo(const wxString& message);
336 ~wxBusyInfo();
337};
338
339
340
8bf5d46e
RD
341//---------------------------------------------------------------------------
342
343