]> git.saurik.com Git - wxWidgets.git/blob - wxPython/src/_functions.i
move check for compilers not supporting SEH to wx/chkconf.h
[wxWidgets.git] / wxPython / src / _functions.i
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 #include <wx/stockitem.h>
18 %}
19
20 //---------------------------------------------------------------------------
21
22 MAKE_CONST_WXSTRING(FileSelectorPromptStr);
23 MAKE_CONST_WXSTRING(FileSelectorDefaultWildcardStr);
24 MAKE_CONST_WXSTRING(DirSelectorPromptStr);
25
26 //---------------------------------------------------------------------------
27 %newgroup;
28
29
30 long wxNewId();
31 void wxRegisterId(long id);
32 long wxGetCurrentId();
33
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
46 MustHaveApp(wxBell);
47 void wxBell();
48
49 MustHaveApp(wxEndBusyCursor);
50 void wxEndBusyCursor();
51
52 long wxGetElapsedTime(bool resetTimer = true);
53
54 MustHaveApp(wxGetMousePosition);
55 DocDeclA(
56 void, wxGetMousePosition(int* OUTPUT, int* OUTPUT),
57 "GetMousePosition() -> (x,y)");
58
59 bool wxIsBusy();
60 wxString wxNow();
61 bool wxShell(const wxString& command = wxPyEmptyString);
62 void wxStartTimer();
63
64 DocDeclA(
65 int, wxGetOsVersion(int *OUTPUT, int *OUTPUT),
66 "GetOsVersion() -> (platform, major, minor)");
67
68 wxString wxGetOsDescription();
69
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"
76 // int wxParseCommonDialogsFilter(const wxString& wildCard, wxArrayString& descriptions, wxArrayString& filters);
77
78 #if defined(__WXMSW__) || defined(__WXMAC__)
79 long wxGetFreeMemory();
80 #else
81 %inline %{
82 long wxGetFreeMemory()
83 { wxPyRaiseNotImplemented(); return 0; }
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
94 MustHaveApp(wxShutdown);
95 bool wxShutdown(wxShutdownFlags wFlags);
96
97
98 void wxSleep(int secs);
99 void wxMilliSleep(unsigned long milliseconds);
100 void wxMicroSleep(unsigned long microseconds);
101 %pythoncode { Usleep = MilliSleep }
102
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
123 MustHaveApp(wxFileSelector);
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
137 MustHaveApp(wxLoadFileSelector);
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
144 MustHaveApp(wxSaveFileSelector);
145 wxString wxSaveFileSelector(const wxString& what,
146 const wxString& extension,
147 const wxString& default_name = wxPyEmptyString,
148 wxWindow *parent = NULL);
149
150
151 MustHaveApp(wxDirSelector);
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
158 MustHaveApp(wxGetTextFromUser);
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,
164 bool centre = true);
165
166 MustHaveApp(wxGetPasswordFromUser);
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,
178 // bool centre = true, int width=150, int height=200);
179
180
181 MustHaveApp(wxGetSingleChoice);
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,
186 bool centre = true,
187 int width=150, int height=200);
188
189 MustHaveApp(wxGetSingleChoiceIndex);
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,
194 bool centre = true,
195 int width=150, int height=200);
196
197
198 MustHaveApp(wxMessageBox);
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
205 // WXWIN_COMPATIBILITY_2_4
206 MustHaveApp(wxGetNumberFromUser);
207 long wxGetNumberFromUser(const wxString& message,
208 const wxString& prompt,
209 const wxString& caption,
210 long value,
211 long min = 0, long max = 100,
212 wxWindow *parent = NULL,
213 const wxPoint& pos = wxDefaultPosition);
214
215 // GDI Functions
216
217 MustHaveApp(wxColourDisplay);
218 bool wxColourDisplay();
219
220 MustHaveApp(wxDisplayDepth);
221 int wxDisplayDepth();
222
223 MustHaveApp(wxGetDisplayDepth);
224 int wxGetDisplayDepth();
225
226 MustHaveApp(wxDisplaySize);
227 DocDeclA(
228 void, wxDisplaySize(int* OUTPUT, int* OUTPUT),
229 "DisplaySize() -> (width, height)");
230
231 MustHaveApp(wxGetDisplaySize);
232 wxSize wxGetDisplaySize();
233
234 MustHaveApp(wxDisplaySizeMM);
235 DocDeclA(
236 void, wxDisplaySizeMM(int* OUTPUT, int* OUTPUT),
237 "DisplaySizeMM() -> (width, height)");
238
239 MustHaveApp(wxGetDisplaySizeMM);
240 wxSize wxGetDisplaySizeMM();
241
242 MustHaveApp(wxClientDisplayRect);
243 DocDeclA(
244 void, wxClientDisplayRect(int *OUTPUT, int *OUTPUT, int *OUTPUT, int *OUTPUT),
245 "ClientDisplayRect() -> (x, y, width, height)");
246
247 MustHaveApp(wxGetClientDisplayRect);
248 wxRect wxGetClientDisplayRect();
249
250
251 MustHaveApp(wxSetCursor);
252 void wxSetCursor(wxCursor& cursor);
253
254
255
256 // Miscellaneous functions
257
258 MustHaveApp(wxBeginBusyCursor);
259 void wxBeginBusyCursor(wxCursor *cursor = wxHOURGLASS_CURSOR);
260
261 MustHaveApp(wxGetActiveWindow);
262 wxWindow * wxGetActiveWindow();
263
264 MustHaveApp(wxGenericFindWindowAtPoint);
265 wxWindow* wxGenericFindWindowAtPoint(const wxPoint& pt);
266
267 MustHaveApp(wxFindWindowAtPoint);
268 wxWindow* wxFindWindowAtPoint(const wxPoint& pt);
269
270 MustHaveApp(wxGetTopLevelParent);
271 wxWindow* wxGetTopLevelParent(wxWindow *win);
272
273 //bool wxSpawnBrowser(wxWindow *parent, wxString href);
274
275
276
277
278 MustHaveApp(wxGetKeyState);
279 DocDeclStr(
280 bool , wxGetKeyState(wxKeyCode key),
281 "Get the state of a key (true if pressed or toggled on, false if not.)
282 This is generally most useful getting the state of the modifier or
283 toggle keys. On some platforms those may be the only keys that work.
284 ", "");
285
286
287
288 //---------------------------------------------------------------------------
289
290 MustHaveApp(wxWakeUpMainThread);
291
292 #if defined(__WXMSW__) || defined(__WXMAC__)
293 void wxWakeUpMainThread();
294 #else
295 %inline %{
296 void wxWakeUpMainThread() {}
297 %}
298 #endif
299
300
301 MustHaveApp(wxMutexGuiEnter);
302 void wxMutexGuiEnter();
303
304 MustHaveApp(wxMutexGuiLeave);
305 void wxMutexGuiLeave();
306
307
308 MustHaveApp(wxMutexGuiLocker);
309 class wxMutexGuiLocker {
310 public:
311 wxMutexGuiLocker();
312 ~wxMutexGuiLocker();
313 };
314
315
316 MustHaveApp(wxThread);
317 %inline %{
318 bool wxThread_IsMain() {
319 #ifdef WXP_WITH_THREAD
320 return wxThread::IsMain();
321 #else
322 return true;
323 #endif
324 }
325 %}
326
327 //---------------------------------------------------------------------------
328
329 // enum wxPowerType
330 // {
331 // wxPOWER_SOCKET,
332 // wxPOWER_BATTERY,
333 // wxPOWER_UNKNOWN
334 // };
335
336 // DocDeclStr(
337 // wxPowerType , wxGetPowerType(),
338 // "Returns the type of power source as one of wx.POWER_SOCKET,
339 // wx.POWER_BATTERY or wx.POWER_UNKNOWN. wx.POWER_UNKNOWN is also the
340 // default on platforms where this feature is not implemented.", "");
341
342
343 // enum wxBatteryState
344 // {
345 // wxBATTERY_NORMAL_STATE, // system is fully usable
346 // wxBATTERY_LOW_STATE, // start to worry
347 // wxBATTERY_CRITICAL_STATE, // save quickly
348 // wxBATTERY_SHUTDOWN_STATE, // too late
349 // wxBATTERY_UNKNOWN_STATE
350 // };
351
352 // DocDeclStr(
353 // wxBatteryState , wxGetBatteryState(),
354 // "Returns battery state as one of wx.BATTERY_NORMAL_STATE,
355 // wx.BATTERY_LOW_STATE}, wx.BATTERY_CRITICAL_STATE,
356 // wx.BATTERY_SHUTDOWN_STATE or wx.BATTERY_UNKNOWN_STATE.
357 // wx.BATTERY_UNKNOWN_STATE is also the default on platforms where this
358 // feature is not implemented.", "");
359
360
361
362 //---------------------------------------------------------------------------
363 //---------------------------------------------------------------------------