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