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