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