]>
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); | |
83 | void wxUsleep(unsigned long milliseconds); | |
84 | void wxEnableTopLevelWindows(bool enable); | |
85 | ||
86 | wxString wxStripMenuCodes(const wxString& in); | |
87 | ||
88 | ||
89 | wxString wxGetEmailAddress(); | |
90 | wxString wxGetHostName(); | |
91 | wxString wxGetFullHostName(); | |
92 | wxString wxGetUserId(); | |
93 | wxString wxGetUserName(); | |
94 | wxString wxGetHomeDir(); | |
95 | wxString wxGetUserHome(const wxString& user = wxPyEmptyString); | |
96 | ||
97 | unsigned long wxGetProcessId(); | |
98 | ||
99 | void wxTrap(); | |
100 | ||
101 | ||
102 | // Dialog Functions | |
103 | ||
ab1f7d2a | 104 | MustHaveApp(wxFileSelector); |
d14a1e28 RD |
105 | wxString wxFileSelector(const wxString& message = wxPyFileSelectorPromptStr, |
106 | const wxString& default_path = wxPyEmptyString, | |
107 | const wxString& default_filename = wxPyEmptyString, | |
108 | const wxString& default_extension = wxPyEmptyString, | |
109 | const wxString& wildcard = wxPyFileSelectorDefaultWildcardStr, | |
110 | int flags = 0, | |
111 | wxWindow *parent = NULL, | |
112 | int x = -1, int y = -1); | |
113 | ||
114 | // TODO: wxFileSelectorEx | |
115 | ||
116 | ||
117 | // Ask for filename to load | |
ab1f7d2a | 118 | MustHaveApp(wxLoadFileSelector); |
d14a1e28 RD |
119 | wxString wxLoadFileSelector(const wxString& what, |
120 | const wxString& extension, | |
121 | const wxString& default_name = wxPyEmptyString, | |
122 | wxWindow *parent = NULL); | |
123 | ||
124 | // Ask for filename to save | |
ab1f7d2a | 125 | MustHaveApp(wxSaveFileSelector); |
d14a1e28 RD |
126 | wxString wxSaveFileSelector(const wxString& what, |
127 | const wxString& extension, | |
128 | const wxString& default_name = wxPyEmptyString, | |
129 | wxWindow *parent = NULL); | |
130 | ||
131 | ||
ab1f7d2a | 132 | MustHaveApp(wxDirSelector); |
d14a1e28 RD |
133 | wxString wxDirSelector(const wxString& message = wxPyDirSelectorPromptStr, |
134 | const wxString& defaultPath = wxPyEmptyString, | |
135 | long style = wxDD_DEFAULT_STYLE, | |
136 | const wxPoint& pos = wxDefaultPosition, | |
137 | wxWindow *parent = NULL); | |
138 | ||
ab1f7d2a | 139 | MustHaveApp(wxGetTextFromUser); |
d14a1e28 RD |
140 | wxString wxGetTextFromUser(const wxString& message, |
141 | const wxString& caption = wxPyEmptyString, | |
142 | const wxString& default_value = wxPyEmptyString, | |
143 | wxWindow *parent = NULL, | |
144 | int x = -1, int y = -1, | |
dd9f7fea | 145 | bool centre = True); |
d14a1e28 | 146 | |
ab1f7d2a | 147 | MustHaveApp(wxGetPasswordFromUser); |
d14a1e28 RD |
148 | wxString wxGetPasswordFromUser(const wxString& message, |
149 | const wxString& caption = wxPyEmptyString, | |
150 | const wxString& default_value = wxPyEmptyString, | |
151 | wxWindow *parent = NULL); | |
152 | ||
153 | ||
154 | // TODO: Need to custom wrap this one... | |
155 | // int wxGetMultipleChoice(char* message, char* caption, | |
156 | // int LCOUNT, char** choices, | |
157 | // int nsel, int *selection, | |
158 | // wxWindow *parent = NULL, int x = -1, int y = -1, | |
dd9f7fea | 159 | // bool centre = True, int width=150, int height=200); |
d14a1e28 RD |
160 | |
161 | ||
ab1f7d2a | 162 | MustHaveApp(wxGetSingleChoice); |
d14a1e28 RD |
163 | wxString wxGetSingleChoice(const wxString& message, const wxString& caption, |
164 | int choices, wxString* choices_array, | |
165 | wxWindow *parent = NULL, | |
166 | int x = -1, int y = -1, | |
dd9f7fea | 167 | bool centre = True, |
d14a1e28 RD |
168 | int width=150, int height=200); |
169 | ||
ab1f7d2a | 170 | MustHaveApp(wxGetSingleChoiceIndex); |
d14a1e28 RD |
171 | int wxGetSingleChoiceIndex(const wxString& message, const wxString& caption, |
172 | int choices, wxString* choices_array, | |
173 | wxWindow *parent = NULL, | |
174 | int x = -1, int y = -1, | |
dd9f7fea | 175 | bool centre = True, |
d14a1e28 RD |
176 | int width=150, int height=200); |
177 | ||
178 | ||
ab1f7d2a | 179 | MustHaveApp(wxMessageBox); |
d14a1e28 RD |
180 | int wxMessageBox(const wxString& message, |
181 | const wxString& caption = wxPyEmptyString, | |
182 | int style = wxOK | wxCENTRE, | |
183 | wxWindow *parent = NULL, | |
184 | int x = -1, int y = -1); | |
185 | ||
ab1f7d2a | 186 | MustHaveApp(wxGetNumberFromUser); |
d14a1e28 RD |
187 | long wxGetNumberFromUser(const wxString& message, |
188 | const wxString& prompt, | |
189 | const wxString& caption, | |
190 | long value, | |
191 | long min = 0, long max = 100, | |
192 | wxWindow *parent = NULL, | |
193 | const wxPoint& pos = wxDefaultPosition); | |
194 | ||
195 | // GDI Functions | |
196 | ||
ab1f7d2a | 197 | MustHaveApp(wxColourDisplay); |
d14a1e28 RD |
198 | bool wxColourDisplay(); |
199 | ||
ab1f7d2a | 200 | MustHaveApp(wxDisplayDepth); |
d14a1e28 | 201 | int wxDisplayDepth(); |
ab1f7d2a RD |
202 | |
203 | MustHaveApp(wxGetDisplayDepth); | |
d14a1e28 RD |
204 | int wxGetDisplayDepth(); |
205 | ||
ab1f7d2a | 206 | MustHaveApp(wxDisplaySize); |
322913ce RD |
207 | DocDeclA( |
208 | void, wxDisplaySize(int* OUTPUT, int* OUTPUT), | |
209 | "DisplaySize() -> (width, height)"); | |
ab1f7d2a RD |
210 | |
211 | MustHaveApp(wxGetDisplaySize); | |
d14a1e28 RD |
212 | wxSize wxGetDisplaySize(); |
213 | ||
ab1f7d2a | 214 | MustHaveApp(wxDisplaySizeMM); |
322913ce RD |
215 | DocDeclA( |
216 | void, wxDisplaySizeMM(int* OUTPUT, int* OUTPUT), | |
217 | "DisplaySizeMM() -> (width, height)"); | |
ab1f7d2a RD |
218 | |
219 | MustHaveApp(wxGetDisplaySizeMM); | |
d14a1e28 RD |
220 | wxSize wxGetDisplaySizeMM(); |
221 | ||
ab1f7d2a | 222 | MustHaveApp(wxClientDisplayRect); |
322913ce RD |
223 | DocDeclA( |
224 | void, wxClientDisplayRect(int *OUTPUT, int *OUTPUT, int *OUTPUT, int *OUTPUT), | |
225 | "ClientDisplayRect() -> (x, y, width, height)"); | |
ab1f7d2a RD |
226 | |
227 | MustHaveApp(wxGetClientDisplayRect); | |
d14a1e28 RD |
228 | wxRect wxGetClientDisplayRect(); |
229 | ||
ab1f7d2a RD |
230 | |
231 | MustHaveApp(wxSetCursor); | |
d14a1e28 RD |
232 | void wxSetCursor(wxCursor& cursor); |
233 | ||
234 | ||
235 | ||
236 | // Miscellaneous functions | |
237 | ||
ab1f7d2a | 238 | MustHaveApp(wxBeginBusyCursor); |
d14a1e28 | 239 | void wxBeginBusyCursor(wxCursor *cursor = wxHOURGLASS_CURSOR); |
ab1f7d2a RD |
240 | |
241 | MustHaveApp(wxGetActiveWindow); | |
d14a1e28 RD |
242 | wxWindow * wxGetActiveWindow(); |
243 | ||
ab1f7d2a | 244 | MustHaveApp(wxGenericFindWindowAtPoint); |
d14a1e28 | 245 | wxWindow* wxGenericFindWindowAtPoint(const wxPoint& pt); |
ab1f7d2a RD |
246 | |
247 | MustHaveApp(wxFindWindowAtPoint); | |
d14a1e28 RD |
248 | wxWindow* wxFindWindowAtPoint(const wxPoint& pt); |
249 | ||
ab1f7d2a | 250 | MustHaveApp(wxGetTopLevelParent); |
d14a1e28 RD |
251 | wxWindow* wxGetTopLevelParent(wxWindow *win); |
252 | ||
253 | //bool wxSpawnBrowser(wxWindow *parent, wxString href); | |
254 | ||
255 | ||
256 | ||
89c876de | 257 | |
ab1f7d2a | 258 | MustHaveApp(wxGetKeyState); |
ad411ab2 RD |
259 | DocDeclStr( |
260 | bool , wxGetKeyState(wxKeyCode key), | |
261 | "Get the state of a key (true if pressed or toggled on, false if not.) | |
262 | This is generally most useful getting the state of the modifier or | |
263 | toggle keys. On some platforms those may be the only keys that work. | |
264 | ", ""); | |
265 | ||
57b1892f RD |
266 | |
267 | ||
d14a1e28 RD |
268 | //--------------------------------------------------------------------------- |
269 | ||
ab1f7d2a RD |
270 | MustHaveApp(wxWakeUpMainThread); |
271 | ||
d14a1e28 RD |
272 | #if defined(__WXMSW__) || defined(__WXMAC__) |
273 | void wxWakeUpMainThread(); | |
274 | #else | |
275 | %inline %{ | |
276 | void wxWakeUpMainThread() {} | |
277 | %} | |
278 | #endif | |
279 | ||
ab1f7d2a RD |
280 | |
281 | MustHaveApp(wxMutexGuiEnter); | |
d14a1e28 | 282 | void wxMutexGuiEnter(); |
ab1f7d2a RD |
283 | |
284 | MustHaveApp(wxMutexGuiLeave); | |
d14a1e28 RD |
285 | void wxMutexGuiLeave(); |
286 | ||
287 | ||
ab1f7d2a | 288 | MustHaveApp(wxMutexGuiLocker); |
d14a1e28 RD |
289 | class wxMutexGuiLocker { |
290 | public: | |
291 | wxMutexGuiLocker(); | |
292 | ~wxMutexGuiLocker(); | |
293 | }; | |
294 | ||
295 | ||
ab1f7d2a | 296 | MustHaveApp(wxThread); |
d14a1e28 RD |
297 | %inline %{ |
298 | bool wxThread_IsMain() { | |
299 | #ifdef WXP_WITH_THREAD | |
300 | return wxThread::IsMain(); | |
301 | #else | |
dd9f7fea | 302 | return True; |
d14a1e28 RD |
303 | #endif |
304 | } | |
305 | %} | |
306 | ||
307 | //--------------------------------------------------------------------------- | |
308 | //--------------------------------------------------------------------------- |