]> git.saurik.com Git - wxWidgets.git/blame - utils/wxPython/src/misc.i
Changes mostly as a result of __WXSTUBS__ compilation. The stubs code now
[wxWidgets.git] / utils / wxPython / src / misc.i
CommitLineData
7bf85405
RD
1%module misc
2%{
3/////////////////////////////////////////////////////////////////////////////
4// Name: misc.i
5// Purpose: Definitions of miscelaneous functions and classes
6//
7// Author: Robin Dunn
8//
9// Created: 7/3/97
10// RCS-ID: $Id$
11// Copyright: (c) 1998 by Total Control Software
12// Licence: wxWindows license
13/////////////////////////////////////////////////////////////////////////////
14
15
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
118char* wxFileSelector(char* message,
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();
168void wxSetCursor(wxCursor *cursor);
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);
182wxWindow * wxGetActiveWindow();
183long wxGetElapsedTime(bool resetTimer = TRUE);
184long wxGetFreeMemory();
185void wxGetMousePosition(int* OUTPUT, int* OUTPUT);
186bool wxIsBusy();
187wxString wxNow();
188bool wxShell(const wxString& command = wxPyEmptyStr);
189void wxStartTimer();
190bool wxYield();
191
192int wxGetOsVersion(int *OUTPUT, int *OUTPUT);
193%inline %{
194 char* wxGetResource(char *section, char *entry, char *file = NULL) {
195 char * retval;
196 wxGetResource(section, entry, &retval, file);
197 return retval;
198 }
199%}
200
201//---------------------------------------------------------------------------
202// Resource System
203
204bool wxResourceAddIdentifier(char *name, int value);
205void wxResourceClear(void);
206wxBitmap * wxResourceCreateBitmap(char *resource);
207wxIcon * wxResourceCreateIcon(char *resource);
208wxMenuBar * wxResourceCreateMenuBar(char *resource);
209int wxResourceGetIdentifier(char *name);
210bool wxResourceParseData(char *resource, wxResourceTable *table = NULL);
211bool wxResourceParseFile(char *filename, wxResourceTable *table = NULL);
212bool wxResourceParseString(char *resource, wxResourceTable *table = NULL);
213
214
215
216//----------------------------------------------------------------------
217
218class wxPyTimer {
219public:
220 wxPyTimer(PyObject* notify);
221 ~wxPyTimer();
222 int Interval();
223 void Start(int milliseconds=-1, int oneShot=FALSE);
224 void Stop();
225};
226
227//---------------------------------------------------------------------------
228
229enum wxEdge { wxLeft, wxTop, wxRight, wxBottom, wxWidth, wxHeight,
230 wxCentre, wxCenter = wxCentre, wxCentreX, wxCentreY };
231enum wxRelationship { wxUnconstrained = 0,
232 wxAsIs,
233 wxPercentOf,
234 wxAbove,
235 wxBelow,
236 wxLeftOf,
237 wxRightOf,
238 wxSameAs,
239 wxAbsolute };
240
241
242class wxIndividualLayoutConstraint {
243public:
244// wxIndividualLayoutConstraint();
245// ~wxIndividualLayoutConstraint();
246
247 void Above(wxWindow *otherWin, int margin=0);
248 void Absolute(int value);
249 void AsIs(void);
250 void Below(wxWindow *otherWin, int margin=0);
251 void Unconstrained(void);
252 void LeftOf(wxWindow *otherWin, int margin=0);
253 void PercentOf(wxWindow *otherWin, wxEdge edge, int percent);
254 void RightOf(wxWindow *otherWin, int margin=0);
255 void SameAs(wxWindow *otherWin, wxEdge edge, int margin=0);
256 void Set(wxRelationship rel, wxWindow *otherWin, wxEdge otherEdge, int value=0, int margin=0);
257};
258
259
260class wxLayoutConstraints {
261public:
262 wxLayoutConstraints();
263
264%readonly
265 wxIndividualLayoutConstraint bottom;
266 wxIndividualLayoutConstraint centreX;
267 wxIndividualLayoutConstraint centreY;
268 wxIndividualLayoutConstraint height;
269 wxIndividualLayoutConstraint left;
270 wxIndividualLayoutConstraint right;
271 wxIndividualLayoutConstraint top;
272 wxIndividualLayoutConstraint width;
273%readwrite
274}
275
276
277//---------------------------------------------------------------------------
278// Accelerator Entry and Table
279
280class wxAcceleratorEntry {
281public:
282 wxAcceleratorEntry(int flags = 0, int keyCode = 0, int cmd = 0);
283 //~wxAcceleratorEntry(); *** ?
284
285 void Set(int flags, int keyCode, int Cmd);
286 int GetFlags();
287 int GetKeyCode();
288 int GetCommand();
289};
290
291
292class wxAcceleratorTable {
293public:
294 // Can also accept a list of 3-tuples
295 wxAcceleratorTable(int LCOUNT, wxAcceleratorEntry* LIST);
296 // ~wxAcceleratorEntry(); *** ?
297
298};
299
300//---------------------------------------------------------------------------
301/////////////////////////////////////////////////////////////////////////////
302//
303// $Log$
304// Revision 1.1 1998/08/09 08:25:51 RD
305// Initial version
306//
307//
308
309