]>
Commit | Line | Data |
---|---|---|
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 | ||
18 | MAKE_CONST_WXSTRING(FileSelectorPromptStr); | |
19 | MAKE_CONST_WXSTRING(FileSelectorDefaultWildcardStr); | |
20 | MAKE_CONST_WXSTRING(DirSelectorPromptStr); | |
21 | ||
22 | //--------------------------------------------------------------------------- | |
23 | %newgroup; | |
24 | ||
25 | ||
26 | long wxNewId(); | |
27 | void wxRegisterId(long id); | |
28 | long wxGetCurrentId(); | |
29 | ||
30 | MustHaveApp(wxBell); | |
31 | void wxBell(); | |
32 | ||
33 | MustHaveApp(wxEndBusyCursor); | |
34 | void wxEndBusyCursor(); | |
35 | ||
36 | long wxGetElapsedTime(bool resetTimer = True); | |
37 | ||
38 | MustHaveApp(wxGetMousePosition); | |
39 | DocDeclA( | |
40 | void, wxGetMousePosition(int* OUTPUT, int* OUTPUT), | |
41 | "GetMousePosition() -> (x,y)"); | |
42 | ||
43 | bool wxIsBusy(); | |
44 | wxString wxNow(); | |
45 | bool wxShell(const wxString& command = wxPyEmptyString); | |
46 | void wxStartTimer(); | |
47 | ||
48 | DocDeclA( | |
49 | int, wxGetOsVersion(int *OUTPUT, int *OUTPUT), | |
50 | "GetOsVersion() -> (platform, major, minor)"); | |
51 | ||
52 | wxString wxGetOsDescription(); | |
53 | ||
54 | #if defined(__WXMSW__) || defined(__WXMAC__) | |
55 | long wxGetFreeMemory(); | |
56 | #else | |
57 | %inline %{ | |
58 | long wxGetFreeMemory() | |
59 | { wxPyRaiseNotImplemented(); return 0; } | |
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 | |
70 | MustHaveApp(wxShutdown); | |
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 | ||
96 | MustHaveApp(wxFileSelector); | |
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 | |
110 | MustHaveApp(wxLoadFileSelector); | |
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 | |
117 | MustHaveApp(wxSaveFileSelector); | |
118 | wxString wxSaveFileSelector(const wxString& what, | |
119 | const wxString& extension, | |
120 | const wxString& default_name = wxPyEmptyString, | |
121 | wxWindow *parent = NULL); | |
122 | ||
123 | ||
124 | MustHaveApp(wxDirSelector); | |
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 | ||
131 | MustHaveApp(wxGetTextFromUser); | |
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, | |
137 | bool centre = True); | |
138 | ||
139 | MustHaveApp(wxGetPasswordFromUser); | |
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, | |
151 | // bool centre = True, int width=150, int height=200); | |
152 | ||
153 | ||
154 | MustHaveApp(wxGetSingleChoice); | |
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, | |
159 | bool centre = True, | |
160 | int width=150, int height=200); | |
161 | ||
162 | MustHaveApp(wxGetSingleChoiceIndex); | |
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, | |
167 | bool centre = True, | |
168 | int width=150, int height=200); | |
169 | ||
170 | ||
171 | MustHaveApp(wxMessageBox); | |
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 | ||
178 | MustHaveApp(wxGetNumberFromUser); | |
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 | ||
189 | MustHaveApp(wxColourDisplay); | |
190 | bool wxColourDisplay(); | |
191 | ||
192 | MustHaveApp(wxDisplayDepth); | |
193 | int wxDisplayDepth(); | |
194 | ||
195 | MustHaveApp(wxGetDisplayDepth); | |
196 | int wxGetDisplayDepth(); | |
197 | ||
198 | MustHaveApp(wxDisplaySize); | |
199 | DocDeclA( | |
200 | void, wxDisplaySize(int* OUTPUT, int* OUTPUT), | |
201 | "DisplaySize() -> (width, height)"); | |
202 | ||
203 | MustHaveApp(wxGetDisplaySize); | |
204 | wxSize wxGetDisplaySize(); | |
205 | ||
206 | MustHaveApp(wxDisplaySizeMM); | |
207 | DocDeclA( | |
208 | void, wxDisplaySizeMM(int* OUTPUT, int* OUTPUT), | |
209 | "DisplaySizeMM() -> (width, height)"); | |
210 | ||
211 | MustHaveApp(wxGetDisplaySizeMM); | |
212 | wxSize wxGetDisplaySizeMM(); | |
213 | ||
214 | MustHaveApp(wxClientDisplayRect); | |
215 | DocDeclA( | |
216 | void, wxClientDisplayRect(int *OUTPUT, int *OUTPUT, int *OUTPUT, int *OUTPUT), | |
217 | "ClientDisplayRect() -> (x, y, width, height)"); | |
218 | ||
219 | MustHaveApp(wxGetClientDisplayRect); | |
220 | wxRect wxGetClientDisplayRect(); | |
221 | ||
222 | ||
223 | MustHaveApp(wxSetCursor); | |
224 | void wxSetCursor(wxCursor& cursor); | |
225 | ||
226 | ||
227 | ||
228 | // Miscellaneous functions | |
229 | ||
230 | MustHaveApp(wxBeginBusyCursor); | |
231 | void wxBeginBusyCursor(wxCursor *cursor = wxHOURGLASS_CURSOR); | |
232 | ||
233 | MustHaveApp(wxGetActiveWindow); | |
234 | wxWindow * wxGetActiveWindow(); | |
235 | ||
236 | MustHaveApp(wxGenericFindWindowAtPoint); | |
237 | wxWindow* wxGenericFindWindowAtPoint(const wxPoint& pt); | |
238 | ||
239 | MustHaveApp(wxFindWindowAtPoint); | |
240 | wxWindow* wxFindWindowAtPoint(const wxPoint& pt); | |
241 | ||
242 | MustHaveApp(wxGetTopLevelParent); | |
243 | wxWindow* wxGetTopLevelParent(wxWindow *win); | |
244 | ||
245 | //bool wxSpawnBrowser(wxWindow *parent, wxString href); | |
246 | ||
247 | ||
248 | ||
249 | ||
250 | MustHaveApp(wxGetKeyState); | |
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 | ||
258 | ||
259 | ||
260 | //--------------------------------------------------------------------------- | |
261 | ||
262 | MustHaveApp(wxWakeUpMainThread); | |
263 | ||
264 | #if defined(__WXMSW__) || defined(__WXMAC__) | |
265 | void wxWakeUpMainThread(); | |
266 | #else | |
267 | %inline %{ | |
268 | void wxWakeUpMainThread() {} | |
269 | %} | |
270 | #endif | |
271 | ||
272 | ||
273 | MustHaveApp(wxMutexGuiEnter); | |
274 | void wxMutexGuiEnter(); | |
275 | ||
276 | MustHaveApp(wxMutexGuiLeave); | |
277 | void wxMutexGuiLeave(); | |
278 | ||
279 | ||
280 | MustHaveApp(wxMutexGuiLocker); | |
281 | class wxMutexGuiLocker { | |
282 | public: | |
283 | wxMutexGuiLocker(); | |
284 | ~wxMutexGuiLocker(); | |
285 | }; | |
286 | ||
287 | ||
288 | MustHaveApp(wxThread); | |
289 | %inline %{ | |
290 | bool wxThread_IsMain() { | |
291 | #ifdef WXP_WITH_THREAD | |
292 | return wxThread::IsMain(); | |
293 | #else | |
294 | return True; | |
295 | #endif | |
296 | } | |
297 | %} | |
298 | ||
299 | //--------------------------------------------------------------------------- | |
300 | //--------------------------------------------------------------------------- |