]>
Commit | Line | Data |
---|---|---|
d14a1e28 RD |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: _functions.i | |
3 | // Purpose: SWIG interface defs for various functions and such | |
4 | // | |
5 | // Author: Robin Dunn | |
6 | // | |
7 | // Created: 3-July-1997 | |
8 | // RCS-ID: $Id$ | |
9 | // Copyright: (c) 2003 by Total Control Software | |
10 | // Licence: wxWindows license | |
11 | ///////////////////////////////////////////////////////////////////////////// | |
12 | ||
13 | // Not a %module | |
14 | ||
15 | ||
1a1ed526 RD |
16 | %{ |
17 | #include <wx/stockitem.h> | |
18 | %} | |
19 | ||
d14a1e28 RD |
20 | //--------------------------------------------------------------------------- |
21 | ||
b2dc1044 RD |
22 | MAKE_CONST_WXSTRING(FileSelectorPromptStr); |
23 | MAKE_CONST_WXSTRING(FileSelectorDefaultWildcardStr); | |
24 | MAKE_CONST_WXSTRING(DirSelectorPromptStr); | |
d14a1e28 RD |
25 | |
26 | //--------------------------------------------------------------------------- | |
27 | %newgroup; | |
28 | ||
29 | ||
30 | long wxNewId(); | |
31 | void wxRegisterId(long id); | |
32 | long wxGetCurrentId(); | |
33 | ||
ab1f7d2a | 34 | MustHaveApp(wxBell); |
d14a1e28 | 35 | void wxBell(); |
ab1f7d2a RD |
36 | |
37 | MustHaveApp(wxEndBusyCursor); | |
d14a1e28 RD |
38 | void wxEndBusyCursor(); |
39 | ||
dd9f7fea | 40 | long wxGetElapsedTime(bool resetTimer = True); |
322913ce | 41 | |
ab1f7d2a | 42 | MustHaveApp(wxGetMousePosition); |
322913ce RD |
43 | DocDeclA( |
44 | void, wxGetMousePosition(int* OUTPUT, int* OUTPUT), | |
45 | "GetMousePosition() -> (x,y)"); | |
46 | ||
d14a1e28 RD |
47 | bool wxIsBusy(); |
48 | wxString wxNow(); | |
49 | bool wxShell(const wxString& command = wxPyEmptyString); | |
50 | void wxStartTimer(); | |
322913ce RD |
51 | |
52 | DocDeclA( | |
53 | int, wxGetOsVersion(int *OUTPUT, int *OUTPUT), | |
54 | "GetOsVersion() -> (platform, major, minor)"); | |
55 | ||
d14a1e28 RD |
56 | wxString wxGetOsDescription(); |
57 | ||
03d51a2d RD |
58 | // TODO: |
59 | // // Parses the wildCard, returning the number of filters. | |
60 | // // Returns 0 if none or if there's a problem, | |
61 | // // The arrays will contain an equal number of items found before the error. | |
62 | // // wildCard is in the form: | |
63 | // // "All files (*)|*|Image Files (*.jpeg *.png)|*.jpg;*.png" | |
daf32463 | 64 | // int wxParseCommonDialogsFilter(const wxString& wildCard, wxArrayString& descriptions, wxArrayString& filters); |
03d51a2d | 65 | |
d14a1e28 RD |
66 | #if defined(__WXMSW__) || defined(__WXMAC__) |
67 | long wxGetFreeMemory(); | |
68 | #else | |
69 | %inline %{ | |
70 | long wxGetFreeMemory() | |
81cfe5e1 | 71 | { wxPyRaiseNotImplemented(); return 0; } |
d14a1e28 RD |
72 | %} |
73 | #endif | |
74 | ||
75 | enum wxShutdownFlags | |
76 | { | |
77 | wxSHUTDOWN_POWEROFF, // power off the computer | |
78 | wxSHUTDOWN_REBOOT // shutdown and reboot | |
79 | }; | |
80 | ||
81 | // Shutdown or reboot the PC | |
ab1f7d2a | 82 | MustHaveApp(wxShutdown); |
d14a1e28 RD |
83 | bool wxShutdown(wxShutdownFlags wFlags); |
84 | ||
85 | ||
86 | void wxSleep(int secs); | |
705b61cc RD |
87 | void wxMilliSleep(unsigned long milliseconds); |
88 | void wxMicroSleep(unsigned long microseconds); | |
89 | %pythoncode { Usleep = MilliSleep } | |
90 | ||
d14a1e28 RD |
91 | void wxEnableTopLevelWindows(bool enable); |
92 | ||
93 | wxString wxStripMenuCodes(const wxString& in); | |
94 | ||
95 | ||
96 | wxString wxGetEmailAddress(); | |
97 | wxString wxGetHostName(); | |
98 | wxString wxGetFullHostName(); | |
99 | wxString wxGetUserId(); | |
100 | wxString wxGetUserName(); | |
101 | wxString wxGetHomeDir(); | |
102 | wxString wxGetUserHome(const wxString& user = wxPyEmptyString); | |
103 | ||
104 | unsigned long wxGetProcessId(); | |
105 | ||
106 | void wxTrap(); | |
107 | ||
108 | ||
109 | // Dialog Functions | |
110 | ||
ab1f7d2a | 111 | MustHaveApp(wxFileSelector); |
d14a1e28 RD |
112 | wxString wxFileSelector(const wxString& message = wxPyFileSelectorPromptStr, |
113 | const wxString& default_path = wxPyEmptyString, | |
114 | const wxString& default_filename = wxPyEmptyString, | |
115 | const wxString& default_extension = wxPyEmptyString, | |
116 | const wxString& wildcard = wxPyFileSelectorDefaultWildcardStr, | |
117 | int flags = 0, | |
118 | wxWindow *parent = NULL, | |
119 | int x = -1, int y = -1); | |
120 | ||
121 | // TODO: wxFileSelectorEx | |
122 | ||
123 | ||
124 | // Ask for filename to load | |
ab1f7d2a | 125 | MustHaveApp(wxLoadFileSelector); |
d14a1e28 RD |
126 | wxString wxLoadFileSelector(const wxString& what, |
127 | const wxString& extension, | |
128 | const wxString& default_name = wxPyEmptyString, | |
129 | wxWindow *parent = NULL); | |
130 | ||
131 | // Ask for filename to save | |
ab1f7d2a | 132 | MustHaveApp(wxSaveFileSelector); |
d14a1e28 RD |
133 | wxString wxSaveFileSelector(const wxString& what, |
134 | const wxString& extension, | |
135 | const wxString& default_name = wxPyEmptyString, | |
136 | wxWindow *parent = NULL); | |
137 | ||
138 | ||
ab1f7d2a | 139 | MustHaveApp(wxDirSelector); |
d14a1e28 RD |
140 | wxString wxDirSelector(const wxString& message = wxPyDirSelectorPromptStr, |
141 | const wxString& defaultPath = wxPyEmptyString, | |
142 | long style = wxDD_DEFAULT_STYLE, | |
143 | const wxPoint& pos = wxDefaultPosition, | |
144 | wxWindow *parent = NULL); | |
145 | ||
ab1f7d2a | 146 | MustHaveApp(wxGetTextFromUser); |
d14a1e28 RD |
147 | wxString wxGetTextFromUser(const wxString& message, |
148 | const wxString& caption = wxPyEmptyString, | |
149 | const wxString& default_value = wxPyEmptyString, | |
150 | wxWindow *parent = NULL, | |
151 | int x = -1, int y = -1, | |
dd9f7fea | 152 | bool centre = True); |
d14a1e28 | 153 | |
ab1f7d2a | 154 | MustHaveApp(wxGetPasswordFromUser); |
d14a1e28 RD |
155 | wxString wxGetPasswordFromUser(const wxString& message, |
156 | const wxString& caption = wxPyEmptyString, | |
157 | const wxString& default_value = wxPyEmptyString, | |
158 | wxWindow *parent = NULL); | |
159 | ||
160 | ||
161 | // TODO: Need to custom wrap this one... | |
162 | // int wxGetMultipleChoice(char* message, char* caption, | |
163 | // int LCOUNT, char** choices, | |
164 | // int nsel, int *selection, | |
165 | // wxWindow *parent = NULL, int x = -1, int y = -1, | |
dd9f7fea | 166 | // bool centre = True, int width=150, int height=200); |
d14a1e28 RD |
167 | |
168 | ||
ab1f7d2a | 169 | MustHaveApp(wxGetSingleChoice); |
d14a1e28 RD |
170 | wxString wxGetSingleChoice(const wxString& message, const wxString& caption, |
171 | int choices, wxString* choices_array, | |
172 | wxWindow *parent = NULL, | |
173 | int x = -1, int y = -1, | |
dd9f7fea | 174 | bool centre = True, |
d14a1e28 RD |
175 | int width=150, int height=200); |
176 | ||
ab1f7d2a | 177 | MustHaveApp(wxGetSingleChoiceIndex); |
d14a1e28 RD |
178 | int wxGetSingleChoiceIndex(const wxString& message, const wxString& caption, |
179 | int choices, wxString* choices_array, | |
180 | wxWindow *parent = NULL, | |
181 | int x = -1, int y = -1, | |
dd9f7fea | 182 | bool centre = True, |
d14a1e28 RD |
183 | int width=150, int height=200); |
184 | ||
185 | ||
ab1f7d2a | 186 | MustHaveApp(wxMessageBox); |
d14a1e28 RD |
187 | int wxMessageBox(const wxString& message, |
188 | const wxString& caption = wxPyEmptyString, | |
189 | int style = wxOK | wxCENTRE, | |
190 | wxWindow *parent = NULL, | |
191 | int x = -1, int y = -1); | |
192 | ||
ab1f7d2a | 193 | MustHaveApp(wxGetNumberFromUser); |
d14a1e28 RD |
194 | long wxGetNumberFromUser(const wxString& message, |
195 | const wxString& prompt, | |
196 | const wxString& caption, | |
197 | long value, | |
198 | long min = 0, long max = 100, | |
199 | wxWindow *parent = NULL, | |
200 | const wxPoint& pos = wxDefaultPosition); | |
201 | ||
202 | // GDI Functions | |
203 | ||
ab1f7d2a | 204 | MustHaveApp(wxColourDisplay); |
d14a1e28 RD |
205 | bool wxColourDisplay(); |
206 | ||
ab1f7d2a | 207 | MustHaveApp(wxDisplayDepth); |
d14a1e28 | 208 | int wxDisplayDepth(); |
ab1f7d2a RD |
209 | |
210 | MustHaveApp(wxGetDisplayDepth); | |
d14a1e28 RD |
211 | int wxGetDisplayDepth(); |
212 | ||
ab1f7d2a | 213 | MustHaveApp(wxDisplaySize); |
322913ce RD |
214 | DocDeclA( |
215 | void, wxDisplaySize(int* OUTPUT, int* OUTPUT), | |
216 | "DisplaySize() -> (width, height)"); | |
ab1f7d2a RD |
217 | |
218 | MustHaveApp(wxGetDisplaySize); | |
d14a1e28 RD |
219 | wxSize wxGetDisplaySize(); |
220 | ||
ab1f7d2a | 221 | MustHaveApp(wxDisplaySizeMM); |
322913ce RD |
222 | DocDeclA( |
223 | void, wxDisplaySizeMM(int* OUTPUT, int* OUTPUT), | |
224 | "DisplaySizeMM() -> (width, height)"); | |
ab1f7d2a RD |
225 | |
226 | MustHaveApp(wxGetDisplaySizeMM); | |
d14a1e28 RD |
227 | wxSize wxGetDisplaySizeMM(); |
228 | ||
ab1f7d2a | 229 | MustHaveApp(wxClientDisplayRect); |
322913ce RD |
230 | DocDeclA( |
231 | void, wxClientDisplayRect(int *OUTPUT, int *OUTPUT, int *OUTPUT, int *OUTPUT), | |
232 | "ClientDisplayRect() -> (x, y, width, height)"); | |
ab1f7d2a RD |
233 | |
234 | MustHaveApp(wxGetClientDisplayRect); | |
d14a1e28 RD |
235 | wxRect wxGetClientDisplayRect(); |
236 | ||
ab1f7d2a RD |
237 | |
238 | MustHaveApp(wxSetCursor); | |
d14a1e28 RD |
239 | void wxSetCursor(wxCursor& cursor); |
240 | ||
241 | ||
242 | ||
243 | // Miscellaneous functions | |
244 | ||
ab1f7d2a | 245 | MustHaveApp(wxBeginBusyCursor); |
d14a1e28 | 246 | void wxBeginBusyCursor(wxCursor *cursor = wxHOURGLASS_CURSOR); |
ab1f7d2a RD |
247 | |
248 | MustHaveApp(wxGetActiveWindow); | |
d14a1e28 RD |
249 | wxWindow * wxGetActiveWindow(); |
250 | ||
ab1f7d2a | 251 | MustHaveApp(wxGenericFindWindowAtPoint); |
d14a1e28 | 252 | wxWindow* wxGenericFindWindowAtPoint(const wxPoint& pt); |
ab1f7d2a RD |
253 | |
254 | MustHaveApp(wxFindWindowAtPoint); | |
d14a1e28 RD |
255 | wxWindow* wxFindWindowAtPoint(const wxPoint& pt); |
256 | ||
ab1f7d2a | 257 | MustHaveApp(wxGetTopLevelParent); |
d14a1e28 RD |
258 | wxWindow* wxGetTopLevelParent(wxWindow *win); |
259 | ||
260 | //bool wxSpawnBrowser(wxWindow *parent, wxString href); | |
261 | ||
262 | ||
263 | ||
89c876de | 264 | |
ab1f7d2a | 265 | MustHaveApp(wxGetKeyState); |
ad411ab2 RD |
266 | DocDeclStr( |
267 | bool , wxGetKeyState(wxKeyCode key), | |
268 | "Get the state of a key (true if pressed or toggled on, false if not.) | |
269 | This is generally most useful getting the state of the modifier or | |
270 | toggle keys. On some platforms those may be the only keys that work. | |
271 | ", ""); | |
272 | ||
57b1892f RD |
273 | |
274 | ||
d14a1e28 RD |
275 | //--------------------------------------------------------------------------- |
276 | ||
ab1f7d2a RD |
277 | MustHaveApp(wxWakeUpMainThread); |
278 | ||
d14a1e28 RD |
279 | #if defined(__WXMSW__) || defined(__WXMAC__) |
280 | void wxWakeUpMainThread(); | |
281 | #else | |
282 | %inline %{ | |
283 | void wxWakeUpMainThread() {} | |
284 | %} | |
285 | #endif | |
286 | ||
ab1f7d2a RD |
287 | |
288 | MustHaveApp(wxMutexGuiEnter); | |
d14a1e28 | 289 | void wxMutexGuiEnter(); |
ab1f7d2a RD |
290 | |
291 | MustHaveApp(wxMutexGuiLeave); | |
d14a1e28 RD |
292 | void wxMutexGuiLeave(); |
293 | ||
294 | ||
ab1f7d2a | 295 | MustHaveApp(wxMutexGuiLocker); |
d14a1e28 RD |
296 | class wxMutexGuiLocker { |
297 | public: | |
298 | wxMutexGuiLocker(); | |
299 | ~wxMutexGuiLocker(); | |
300 | }; | |
301 | ||
302 | ||
ab1f7d2a | 303 | MustHaveApp(wxThread); |
d14a1e28 RD |
304 | %inline %{ |
305 | bool wxThread_IsMain() { | |
306 | #ifdef WXP_WITH_THREAD | |
307 | return wxThread::IsMain(); | |
308 | #else | |
dd9f7fea | 309 | return True; |
d14a1e28 RD |
310 | #endif |
311 | } | |
312 | %} | |
313 | ||
314 | //--------------------------------------------------------------------------- | |
315 | //--------------------------------------------------------------------------- |