]> git.saurik.com Git - wxWidgets.git/blame - utils/wxPython/src/misc.i
Added missing | symbol
[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>
18%}
19
20//----------------------------------------------------------------------
21
22%include typemaps.i
23%include my_typemaps.i
24
25// Import some definitions of other classes, etc.
26%import _defs.i
27
28//---------------------------------------------------------------------------
29
30
31
32class wxSize {
33public:
34 %name(width) long x;
35 %name(height)long y;
36
37 wxSize(long w=0, long h=0);
38 ~wxSize();
39 void Set(long w, long h);
40 %name(GetWidth) long GetX();
41 %name(GetHeight)long GetY();
42
43 %addmethods {
44 PyObject* __str__() {
45 PyObject* tup = PyTuple_New(2);
46 PyTuple_SET_ITEM(tup, 0, PyInt_FromLong(self->x));
47 PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(self->y));
48 return tup;
49 }
50 }
51};
52
53//---------------------------------------------------------------------------
54
55class wxRealPoint {
56public:
57 double x;
58 double y;
59 wxRealPoint(double x=0.0, double y=0.0);
60 ~wxRealPoint();
61};
62
63class wxPoint {
64public:
65 long x;
66 long y;
67 wxPoint(long x=0, long y=0);
68 ~wxPoint();
69
70 %addmethods {
71 void Set(long x, long y) {
72 self->x = x;
73 self->y = y;
74 }
75 PyObject* __str__() {
76 PyObject* tup = PyTuple_New(2);
77 PyTuple_SET_ITEM(tup, 0, PyInt_FromLong(self->x));
78 PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(self->y));
79 return tup;
80 }
81 }
82};
83
84//---------------------------------------------------------------------------
85
86class wxRect {
87public:
88 wxRect(long x=0, long y=0, long w=0, long h=0);
89 // TODO: do this one too... wxRect(const wxPoint& pos, const wxSize& size);
90 ~wxRect();
91
92 long GetX();
93 void SetX(long X);
94 long GetY();
95 void SetY(long Y);
96 long GetWidth();
97 void SetWidth(long w);
98 long GetHeight();
99 void SetHeight(long h);
100
101
102 wxPoint GetPosition();
103 wxSize GetSize();
104
105 long GetLeft();
106 long GetTop();
107 long GetBottom();
108 long GetRight();
109
110 long x, y, width, height;
111};
112
113
114
115//---------------------------------------------------------------------------
116// Dialog Functions
117
08127323 118wxString wxFileSelector(char* message,
7bf85405
RD
119 char* default_path = NULL,
120 char* default_filename = NULL,
121 char* default_extension = NULL,
122 char* wildcard = "*.*",
123 int flags = 0,
124 wxWindow *parent = NULL,
125 int x = -1, int y = -1);
126
127wxString wxGetTextFromUser(const wxString& message,
128 const wxString& caption = wxPyEmptyStr,
129 const wxString& default_value = wxPyEmptyStr,
130 wxWindow *parent = NULL,
131 int x = -1, int y = -1,
132 bool centre = TRUE);
133
134// TODO: Need to custom wrap this one...
135// int wxGetMultipleChoice(char* message, char* caption,
136// int LCOUNT, char** LIST,
137// int nsel, int *selection,
138// wxWindow *parent = NULL, int x = -1, int y = -1,
139// bool centre = TRUE, int width=150, int height=200);
140
141
142wxString wxGetSingleChoice(const wxString& message, const wxString& caption,
143 int LCOUNT, wxString* LIST,
144 wxWindow *parent = NULL,
145 int x = -1, int y = -1,
146 bool centre = TRUE,
147 int width=150, int height=200);
148
149int wxGetSingleChoiceIndex(const wxString& message, const wxString& caption,
150 int LCOUNT, wxString* LIST,
151 wxWindow *parent = NULL,
152 int x = -1, int y = -1,
153 bool centre = TRUE,
154 int width=150, int height=200);
155
156
157int wxMessageBox(const wxString& message,
158 const wxString& caption = wxPyEmptyStr,
159 int style = wxOK | wxCENTRE,
160 wxWindow *parent = NULL,
161 int x = -1, int y = -1);
162
163//---------------------------------------------------------------------------
164// GDI Functions
165
166bool wxColourDisplay();
167int wxDisplayDepth();
b8b8dda7 168void wxSetCursor(wxCursor& cursor);
7bf85405
RD
169
170//---------------------------------------------------------------------------
171// Miscellaneous functions
172
173long NewId();
174void RegisterId(long id);
175void wxBeginBusyCursor(wxCursor *cursor = wxHOURGLASS_CURSOR);
176void wxBell();
177void wxDisplaySize(int *OUTPUT, int *OUTPUT);
178void wxEndBusyCursor();
179long wxExecute(const wxString& command, bool sync = FALSE);
180wxWindow * wxFindWindowByLabel(const wxString& label, wxWindow *parent=NULL);
181wxWindow * wxFindWindowByName(const wxString& name, wxWindow *parent=NULL);
714e6a9e 182#ifdef __WXMSW__
7bf85405
RD
183wxWindow * wxGetActiveWindow();
184long wxGetElapsedTime(bool resetTimer = TRUE);
185long wxGetFreeMemory();
fb5e0af0 186#endif
7bf85405
RD
187void wxGetMousePosition(int* OUTPUT, int* OUTPUT);
188bool wxIsBusy();
189wxString wxNow();
714e6a9e 190#ifdef __WXMSW__
fb5e0af0 191bool wxShell(const wxString& command = wxPyEmptyStr);
7bf85405 192void wxStartTimer();
fb5e0af0 193int wxGetOsVersion(int *OUTPUT, int *OUTPUT);
714e6a9e 194#endif
fb5e0af0 195
7bf85405
RD
196bool wxYield();
197
7bf85405
RD
198%inline %{
199 char* wxGetResource(char *section, char *entry, char *file = NULL) {
200 char * retval;
201 wxGetResource(section, entry, &retval, file);
202 return retval;
203 }
204%}
205
206//---------------------------------------------------------------------------
207// Resource System
208
209bool wxResourceAddIdentifier(char *name, int value);
210void wxResourceClear(void);
d5c9047a
RD
211wxBitmap wxResourceCreateBitmap(char *resource);
212wxIcon wxResourceCreateIcon(char *resource);
7bf85405
RD
213wxMenuBar * wxResourceCreateMenuBar(char *resource);
214int wxResourceGetIdentifier(char *name);
215bool wxResourceParseData(char *resource, wxResourceTable *table = NULL);
216bool wxResourceParseFile(char *filename, wxResourceTable *table = NULL);
217bool wxResourceParseString(char *resource, wxResourceTable *table = NULL);
218
219
220
221//----------------------------------------------------------------------
222
223class wxPyTimer {
224public:
225 wxPyTimer(PyObject* notify);
226 ~wxPyTimer();
227 int Interval();
228 void Start(int milliseconds=-1, int oneShot=FALSE);
229 void Stop();
230};
231
232//---------------------------------------------------------------------------
233
234enum wxEdge { wxLeft, wxTop, wxRight, wxBottom, wxWidth, wxHeight,
235 wxCentre, wxCenter = wxCentre, wxCentreX, wxCentreY };
236enum wxRelationship { wxUnconstrained = 0,
237 wxAsIs,
238 wxPercentOf,
239 wxAbove,
240 wxBelow,
241 wxLeftOf,
242 wxRightOf,
243 wxSameAs,
244 wxAbsolute };
245
246
247class wxIndividualLayoutConstraint {
248public:
249// wxIndividualLayoutConstraint();
250// ~wxIndividualLayoutConstraint();
251
252 void Above(wxWindow *otherWin, int margin=0);
253 void Absolute(int value);
08127323 254 void AsIs();
7bf85405 255 void Below(wxWindow *otherWin, int margin=0);
08127323 256 void Unconstrained();
7bf85405
RD
257 void LeftOf(wxWindow *otherWin, int margin=0);
258 void PercentOf(wxWindow *otherWin, wxEdge edge, int percent);
259 void RightOf(wxWindow *otherWin, int margin=0);
260 void SameAs(wxWindow *otherWin, wxEdge edge, int margin=0);
261 void Set(wxRelationship rel, wxWindow *otherWin, wxEdge otherEdge, int value=0, int margin=0);
262};
263
264
265class wxLayoutConstraints {
266public:
267 wxLayoutConstraints();
268
269%readonly
270 wxIndividualLayoutConstraint bottom;
271 wxIndividualLayoutConstraint centreX;
272 wxIndividualLayoutConstraint centreY;
273 wxIndividualLayoutConstraint height;
274 wxIndividualLayoutConstraint left;
275 wxIndividualLayoutConstraint right;
276 wxIndividualLayoutConstraint top;
277 wxIndividualLayoutConstraint width;
278%readwrite
279}
280
281
b639c3c5
RD
282//---------------------------------------------------------------------------
283// Regions, etc.
284
285enum wxRegionContain {
286 wxOutRegion, wxPartRegion, wxInRegion
287};
288
289
290class wxRegion {
291public:
292 wxRegion();
293 ~wxRegion();
294
295 void Clear();
296 wxRegionContain Contains(long x, long y);
297 %name(ContainsPoint)wxRegionContain Contains(const wxPoint& pt);
298 %name(ContainsRect)wxRegionContain Contains(const wxRect& rect);
299
300 wxRect GetBox();
301 bool Intersect(const wxRect& rect);
105e45b9 302#ifdef __WXMSW__
b639c3c5 303 bool IsEmpty();
105e45b9 304#endif
b639c3c5
RD
305 bool Subtract(const wxRect& rect);
306 bool Union(const wxRect& rect);
307 bool Xor(const wxRect& rect);
308};
309
310
311
312class wxRegionIterator {
313public:
314 wxRegionIterator(const wxRegion& region);
315 ~wxRegionIterator();
316
317 long GetX();
318 long GetY();
319 long GetW();
320 long GetWidth();
321 long GetH();
322 long GetHeight();
323 wxRect GetRect();
324 bool HaveRects();
325 void Reset();
326
327 %addmethods {
328 void Next() {
329 (*self) ++;
330 }
331 };
332};
333
334
335
7bf85405
RD
336//---------------------------------------------------------------------------
337// Accelerator Entry and Table
338
339class wxAcceleratorEntry {
340public:
341 wxAcceleratorEntry(int flags = 0, int keyCode = 0, int cmd = 0);
342 //~wxAcceleratorEntry(); *** ?
343
344 void Set(int flags, int keyCode, int Cmd);
345 int GetFlags();
346 int GetKeyCode();
347 int GetCommand();
348};
349
350
351class wxAcceleratorTable {
352public:
353 // Can also accept a list of 3-tuples
354 wxAcceleratorTable(int LCOUNT, wxAcceleratorEntry* LIST);
355 // ~wxAcceleratorEntry(); *** ?
356
357};
faf3cb35 358
7bf85405
RD
359//---------------------------------------------------------------------------
360/////////////////////////////////////////////////////////////////////////////
361//
362// $Log$
08127323
RD
363// Revision 1.10 1999/01/30 07:30:14 RD
364// Added wxSashWindow, wxSashEvent, wxLayoutAlgorithm, etc.
365//
366// Various cleanup, tweaks, minor additions, etc. to maintain
367// compatibility with the current wxWindows.
368//
105e45b9 369// Revision 1.9 1998/12/16 22:10:55 RD
08127323 370//
105e45b9
RD
371// Tweaks needed to be able to build wxPython with wxGTK.
372//
b8b8dda7
RD
373// Revision 1.8 1998/12/15 20:41:22 RD
374// Changed the import semantics from "from wxPython import *" to "from
375// wxPython.wx import *" This is for people who are worried about
376// namespace pollution, they can use "from wxPython import wx" and then
377// prefix all the wxPython identifiers with "wx."
378//
379// Added wxTaskbarIcon for wxMSW.
380//
381// Made the events work for wxGrid.
382//
383// Added wxConfig.
384//
385// Added wxMiniFrame for wxGTK, (untested.)
386//
387// Changed many of the args and return values that were pointers to gdi
388// objects to references to reflect changes in the wxWindows API.
389//
390// Other assorted fixes and additions.
391//
b639c3c5 392// Revision 1.7 1998/11/25 08:45:27 RD
b8b8dda7 393//
b639c3c5
RD
394// Added wxPalette, wxRegion, wxRegionIterator, wxTaskbarIcon
395// Added events for wxGrid
396// Other various fixes and additions
397//
faf3cb35
RD
398// Revision 1.6 1998/11/15 23:03:46 RD
399// Removing some ifdef's for wxGTK
400//
d5c9047a
RD
401// Revision 1.5 1998/10/20 06:43:59 RD
402// New wxTreeCtrl wrappers (untested)
403// some changes in helpers
404// etc.
405//
fb5e0af0
RD
406// Revision 1.4 1998/08/18 19:48:19 RD
407// more wxGTK compatibility things.
408//
409// It builds now but there are serious runtime problems...
410//
714e6a9e
RD
411// Revision 1.3 1998/08/16 04:31:10 RD
412// More wxGTK work.
413//
03e9bead
RD
414// Revision 1.2 1998/08/15 07:36:41 RD
415// - Moved the header in the .i files out of the code that gets put into
416// the .cpp files. It caused CVS conflicts because of the RCS ID being
417// different each time.
418//
419// - A few minor fixes.
420//
7bf85405
RD
421// Revision 1.1 1998/08/09 08:25:51 RD
422// Initial version
423//
424//
425
426