]> git.saurik.com Git - wxWidgets.git/blob - utils/wxPython/src/misc.i
Corrected link error for missing wxRegTipProvider::GetTip by giving it
[wxWidgets.git] / utils / wxPython / src / misc.i
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
13 %module misc
14
15 %{
16 #include "helpers.h"
17 #include <wx/resource.h>
18 #include <wx/tooltip.h>
19 %}
20
21 //----------------------------------------------------------------------
22
23 %include typemaps.i
24 %include my_typemaps.i
25
26 // Import some definitions of other classes, etc.
27 %import _defs.i
28
29
30 //---------------------------------------------------------------------------
31
32
33 class wxSize {
34 public:
35 long x;
36 long y;
37 %name(width) long x;
38 %name(height)long y;
39
40 wxSize(long w=0, long h=0);
41 ~wxSize();
42 void Set(long w, long h);
43 long GetX();
44 long GetY();
45 long GetWidth();
46 long GetHeight();
47 void SetWidth(long w);
48 void SetHeight(long h);
49
50 %addmethods {
51 PyObject* asTuple() {
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));
55 return tup;
56 }
57 }
58 %pragma(python) addtoclass = "def __str__(self): return str(self.asTuple())"
59 %pragma(python) addtoclass = "def __repr__(self): return str(self.asTuple())"
60
61 };
62
63 //---------------------------------------------------------------------------
64
65 class wxRealPoint {
66 public:
67 double x;
68 double y;
69 wxRealPoint(double x=0.0, double y=0.0);
70 ~wxRealPoint();
71 };
72
73 class wxPoint {
74 public:
75 long x;
76 long y;
77 wxPoint(long x=0, long y=0);
78 ~wxPoint();
79
80 %addmethods {
81 void Set(long x, long y) {
82 self->x = x;
83 self->y = y;
84 }
85 PyObject* asTuple() {
86 PyObject* tup = PyTuple_New(2);
87 PyTuple_SET_ITEM(tup, 0, PyInt_FromLong(self->x));
88 PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(self->y));
89 return tup;
90 }
91 }
92 %pragma(python) addtoclass = "def __str__(self): return str(self.asTuple())"
93 %pragma(python) addtoclass = "def __repr__(self): return str(self.asTuple())"
94 };
95
96 //---------------------------------------------------------------------------
97
98 class wxRect {
99 public:
100 wxRect(long x=0, long y=0, long w=0, long h=0);
101 // TODO: do this one too... wxRect(const wxPoint& pos, const wxSize& size);
102 ~wxRect();
103
104 long GetX();
105 void SetX(long X);
106 long GetY();
107 void SetY(long Y);
108 long GetWidth();
109 void SetWidth(long w);
110 long GetHeight();
111 void SetHeight(long h);
112
113
114 wxPoint GetPosition();
115 wxSize GetSize();
116
117 long GetLeft();
118 long GetTop();
119 long GetBottom();
120 long GetRight();
121
122 long x, y, width, height;
123
124 %addmethods {
125 PyObject* asTuple() {
126 PyObject* tup = PyTuple_New(4);
127 PyTuple_SET_ITEM(tup, 0, PyInt_FromLong(self->x));
128 PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(self->y));
129 PyTuple_SET_ITEM(tup, 0, PyInt_FromLong(self->width));
130 PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(self->height));
131 return tup;
132 }
133 }
134 %pragma(python) addtoclass = "def __str__(self): return str(self.asTuple())"
135 %pragma(python) addtoclass = "def __repr__(self): return str(self.asTuple())"
136 };
137
138
139
140 //---------------------------------------------------------------------------
141 // Dialog Functions
142
143 wxString wxFileSelector(char* message,
144 char* default_path = NULL,
145 char* default_filename = NULL,
146 char* default_extension = NULL,
147 char* wildcard = "*.*",
148 int flags = 0,
149 wxWindow *parent = NULL,
150 int x = -1, int y = -1);
151
152 wxString wxGetTextFromUser(const wxString& message,
153 const wxString& caption = wxPyEmptyStr,
154 const wxString& default_value = wxPyEmptyStr,
155 wxWindow *parent = NULL,
156 int x = -1, int y = -1,
157 bool centre = TRUE);
158
159
160 // TODO: Need to custom wrap this one...
161 // int wxGetMultipleChoice(char* message, char* caption,
162 // int LCOUNT, char** LIST,
163 // int nsel, int *selection,
164 // wxWindow *parent = NULL, int x = -1, int y = -1,
165 // bool centre = TRUE, int width=150, int height=200);
166
167
168 wxString wxGetSingleChoice(const wxString& message, const wxString& caption,
169 int LCOUNT, wxString* LIST,
170 wxWindow *parent = NULL,
171 int x = -1, int y = -1,
172 bool centre = TRUE,
173 int width=150, int height=200);
174
175 int wxGetSingleChoiceIndex(const wxString& message, const wxString& caption,
176 int LCOUNT, wxString* LIST,
177 wxWindow *parent = NULL,
178 int x = -1, int y = -1,
179 bool centre = TRUE,
180 int width=150, int height=200);
181
182
183 int wxMessageBox(const wxString& message,
184 const wxString& caption = wxPyEmptyStr,
185 int style = wxOK | wxCENTRE,
186 wxWindow *parent = NULL,
187 int x = -1, int y = -1);
188
189 //---------------------------------------------------------------------------
190 // GDI Functions
191
192 bool wxColourDisplay();
193 int wxDisplayDepth();
194 void wxSetCursor(wxCursor& cursor);
195
196 //---------------------------------------------------------------------------
197 // Miscellaneous functions
198
199 long wxNewId();
200 void wxRegisterId(long id);
201 %name(NewId) long wxNewId();
202 %name(RegisterId) void wxRegisterId(long id);
203
204 void wxBeginBusyCursor(wxCursor *cursor = wxHOURGLASS_CURSOR);
205 void wxBell();
206 void wxDisplaySize(int *OUTPUT, int *OUTPUT);
207 void wxEndBusyCursor();
208 long wxExecute(const wxString& command, bool sync = FALSE);
209 #ifdef __WXMSW__
210 wxWindow * wxGetActiveWindow();
211 long wxGetElapsedTime(bool resetTimer = TRUE);
212 long wxGetFreeMemory();
213 #endif
214 void wxGetMousePosition(int* OUTPUT, int* OUTPUT);
215 bool wxIsBusy();
216 wxString wxNow();
217 #ifdef __WXMSW__
218 bool wxShell(const wxString& command = wxPyEmptyStr);
219 void wxStartTimer();
220 int wxGetOsVersion(int *OUTPUT, int *OUTPUT);
221 #endif
222
223 void wxSleep(int secs);
224 bool wxYield();
225 bool wxSafeYield();
226 void wxEnableTopLevelWindows(bool enable);
227
228 %inline %{
229 char* wxGetResource(char *section, char *entry, char *file = NULL) {
230 char * retval;
231 wxGetResource(section, entry, &retval, file);
232 return retval;
233 }
234 %}
235
236 //---------------------------------------------------------------------------
237 // Resource System
238
239 bool wxResourceAddIdentifier(char *name, int value);
240 void wxResourceClear(void);
241 wxBitmap wxResourceCreateBitmap(char *resource);
242 wxIcon wxResourceCreateIcon(char *resource);
243 wxMenuBar * wxResourceCreateMenuBar(char *resource);
244 int wxResourceGetIdentifier(char *name);
245 bool wxResourceParseData(char *resource, wxResourceTable *table = NULL);
246 bool wxResourceParseFile(char *filename, wxResourceTable *table = NULL);
247 bool wxResourceParseString(char *resource, wxResourceTable *table = NULL);
248
249
250
251 //----------------------------------------------------------------------
252
253 class wxPyTimer {
254 public:
255 wxPyTimer(PyObject* notify);
256 ~wxPyTimer();
257 int Interval();
258 void Start(int milliseconds=-1, int oneShot=FALSE);
259 void Stop();
260 };
261
262 //---------------------------------------------------------------------------
263
264 enum wxEdge { wxLeft, wxTop, wxRight, wxBottom, wxWidth, wxHeight,
265 wxCentre, wxCenter = wxCentre, wxCentreX, wxCentreY };
266 enum wxRelationship { wxUnconstrained = 0,
267 wxAsIs,
268 wxPercentOf,
269 wxAbove,
270 wxBelow,
271 wxLeftOf,
272 wxRightOf,
273 wxSameAs,
274 wxAbsolute };
275
276
277 class wxIndividualLayoutConstraint {
278 public:
279 // wxIndividualLayoutConstraint();
280 // ~wxIndividualLayoutConstraint();
281
282 void Above(wxWindow *otherWin, int margin=0);
283 void Absolute(int value);
284 void AsIs();
285 void Below(wxWindow *otherWin, int margin=0);
286 void Unconstrained();
287 void LeftOf(wxWindow *otherWin, int margin=0);
288 void PercentOf(wxWindow *otherWin, wxEdge edge, int percent);
289 void RightOf(wxWindow *otherWin, int margin=0);
290 void SameAs(wxWindow *otherWin, wxEdge edge, int margin=0);
291 void Set(wxRelationship rel, wxWindow *otherWin, wxEdge otherEdge, int value=0, int margin=0);
292 };
293
294
295 class wxLayoutConstraints {
296 public:
297 wxLayoutConstraints();
298
299 %readonly
300 wxIndividualLayoutConstraint bottom;
301 wxIndividualLayoutConstraint centreX;
302 wxIndividualLayoutConstraint centreY;
303 wxIndividualLayoutConstraint height;
304 wxIndividualLayoutConstraint left;
305 wxIndividualLayoutConstraint right;
306 wxIndividualLayoutConstraint top;
307 wxIndividualLayoutConstraint width;
308 %readwrite
309 }
310
311
312 //---------------------------------------------------------------------------
313 // Regions, etc.
314
315 enum wxRegionContain {
316 wxOutRegion, wxPartRegion, wxInRegion
317 };
318
319
320 class wxRegion {
321 public:
322 wxRegion();
323 ~wxRegion();
324
325 void Clear();
326 wxRegionContain Contains(long x, long y);
327 %name(ContainsPoint)wxRegionContain Contains(const wxPoint& pt);
328 %name(ContainsRect)wxRegionContain Contains(const wxRect& rect);
329
330 wxRect GetBox();
331 bool Intersect(const wxRect& rect);
332 #ifdef __WXMSW__
333 bool IsEmpty();
334 #endif
335 bool Subtract(const wxRect& rect);
336 bool Union(const wxRect& rect);
337 bool Xor(const wxRect& rect);
338 };
339
340
341
342 class wxRegionIterator {
343 public:
344 wxRegionIterator(const wxRegion& region);
345 ~wxRegionIterator();
346
347 long GetX();
348 long GetY();
349 long GetW();
350 long GetWidth();
351 long GetH();
352 long GetHeight();
353 wxRect GetRect();
354 bool HaveRects();
355 void Reset();
356
357 %addmethods {
358 void Next() {
359 (*self) ++;
360 }
361 };
362 };
363
364
365
366 //---------------------------------------------------------------------------
367 // Accelerator Entry and Table
368
369 class wxAcceleratorEntry {
370 public:
371 wxAcceleratorEntry(int flags = 0, int keyCode = 0, int cmd = 0);
372 //~wxAcceleratorEntry(); *** ?
373
374 void Set(int flags, int keyCode, int Cmd);
375 int GetFlags();
376 int GetKeyCode();
377 int GetCommand();
378 };
379
380
381 class wxAcceleratorTable {
382 public:
383 // Can also accept a list of 3-tuples
384 wxAcceleratorTable(int LCOUNT, wxAcceleratorEntry* LIST);
385 // ~wxAcceleratorEntry(); *** ?
386
387 };
388
389 //---------------------------------------------------------------------------