]> git.saurik.com Git - wxWidgets.git/blame - wxPython/src/_functions.i
Undo part of lst change
[wxWidgets.git] / wxPython / src / _functions.i
CommitLineData
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
22MAKE_CONST_WXSTRING(FileSelectorPromptStr);
23MAKE_CONST_WXSTRING(FileSelectorDefaultWildcardStr);
24MAKE_CONST_WXSTRING(DirSelectorPromptStr);
d14a1e28
RD
25
26//---------------------------------------------------------------------------
27%newgroup;
28
29
30long wxNewId();
31void wxRegisterId(long id);
32long wxGetCurrentId();
33
1e140719
RD
34// Returns true if the ID is in the list of recognized stock actions
35bool wxIsStockID(wxWindowID id);
36
37// Returns true of the label is empty or label of a stock button with
38// given ID
39bool 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):
8815349a
RD
43wxString wxGetStockLabel(wxWindowID id,
44 bool withCodes = true,
45 wxString accelerator = wxPyEmptyString);
1e140719
RD
46
47
ab1f7d2a 48MustHaveApp(wxBell);
d14a1e28 49void wxBell();
ab1f7d2a
RD
50
51MustHaveApp(wxEndBusyCursor);
d14a1e28
RD
52void wxEndBusyCursor();
53
a72f4631 54long wxGetElapsedTime(bool resetTimer = true);
15648073
RD
55%pythoncode { GetElapsedTime = wx._deprecated(GetElapsedTime) }
56
d14a1e28
RD
57bool wxIsBusy();
58wxString wxNow();
59bool wxShell(const wxString& command = wxPyEmptyString);
60void wxStartTimer();
322913ce
RD
61
62DocDeclA(
63 int, wxGetOsVersion(int *OUTPUT, int *OUTPUT),
64 "GetOsVersion() -> (platform, major, minor)");
65
d14a1e28
RD
66wxString wxGetOsDescription();
67
03d51a2d
RD
68// TODO:
69// // Parses the wildCard, returning the number of filters.
70// // Returns 0 if none or if there's a problem,
71// // The arrays will contain an equal number of items found before the error.
72// // wildCard is in the form:
73// // "All files (*)|*|Image Files (*.jpeg *.png)|*.jpg;*.png"
daf32463 74// int wxParseCommonDialogsFilter(const wxString& wildCard, wxArrayString& descriptions, wxArrayString& filters);
03d51a2d 75
d14a1e28 76#if defined(__WXMSW__) || defined(__WXMAC__)
e88df737 77wxMemorySize wxGetFreeMemory();
d14a1e28
RD
78#else
79%inline %{
e88df737 80 wxMemorySize wxGetFreeMemory()
81cfe5e1 81 { wxPyRaiseNotImplemented(); return 0; }
d14a1e28
RD
82%}
83#endif
84
85enum wxShutdownFlags
86{
87 wxSHUTDOWN_POWEROFF, // power off the computer
88 wxSHUTDOWN_REBOOT // shutdown and reboot
89};
90
91// Shutdown or reboot the PC
ab1f7d2a 92MustHaveApp(wxShutdown);
d14a1e28
RD
93bool wxShutdown(wxShutdownFlags wFlags);
94
95
96void wxSleep(int secs);
705b61cc
RD
97void wxMilliSleep(unsigned long milliseconds);
98void wxMicroSleep(unsigned long microseconds);
99%pythoncode { Usleep = MilliSleep }
100
d14a1e28
RD
101void wxEnableTopLevelWindows(bool enable);
102
103wxString wxStripMenuCodes(const wxString& in);
104
105
106wxString wxGetEmailAddress();
107wxString wxGetHostName();
108wxString wxGetFullHostName();
109wxString wxGetUserId();
110wxString wxGetUserName();
111wxString wxGetHomeDir();
112wxString wxGetUserHome(const wxString& user = wxPyEmptyString);
113
114unsigned long wxGetProcessId();
115
116void wxTrap();
117
118
119// Dialog Functions
120
ab1f7d2a 121MustHaveApp(wxFileSelector);
d14a1e28
RD
122wxString wxFileSelector(const wxString& message = wxPyFileSelectorPromptStr,
123 const wxString& default_path = wxPyEmptyString,
124 const wxString& default_filename = wxPyEmptyString,
125 const wxString& default_extension = wxPyEmptyString,
126 const wxString& wildcard = wxPyFileSelectorDefaultWildcardStr,
127 int flags = 0,
128 wxWindow *parent = NULL,
129 int x = -1, int y = -1);
130
131// TODO: wxFileSelectorEx
132
133
134// Ask for filename to load
ab1f7d2a 135MustHaveApp(wxLoadFileSelector);
d14a1e28
RD
136wxString wxLoadFileSelector(const wxString& what,
137 const wxString& extension,
138 const wxString& default_name = wxPyEmptyString,
139 wxWindow *parent = NULL);
140
141// Ask for filename to save
ab1f7d2a 142MustHaveApp(wxSaveFileSelector);
d14a1e28
RD
143wxString wxSaveFileSelector(const wxString& what,
144 const wxString& extension,
145 const wxString& default_name = wxPyEmptyString,
146 wxWindow *parent = NULL);
147
148
ab1f7d2a 149MustHaveApp(wxDirSelector);
d14a1e28
RD
150wxString wxDirSelector(const wxString& message = wxPyDirSelectorPromptStr,
151 const wxString& defaultPath = wxPyEmptyString,
152 long style = wxDD_DEFAULT_STYLE,
153 const wxPoint& pos = wxDefaultPosition,
154 wxWindow *parent = NULL);
155
ab1f7d2a 156MustHaveApp(wxGetTextFromUser);
d14a1e28
RD
157wxString wxGetTextFromUser(const wxString& message,
158 const wxString& caption = wxPyEmptyString,
159 const wxString& default_value = wxPyEmptyString,
160 wxWindow *parent = NULL,
161 int x = -1, int y = -1,
a72f4631 162 bool centre = true);
d14a1e28 163
ab1f7d2a 164MustHaveApp(wxGetPasswordFromUser);
d14a1e28
RD
165wxString wxGetPasswordFromUser(const wxString& message,
166 const wxString& caption = wxPyEmptyString,
167 const wxString& default_value = wxPyEmptyString,
168 wxWindow *parent = NULL);
169
170
171// TODO: Need to custom wrap this one...
172// int wxGetMultipleChoice(char* message, char* caption,
173// int LCOUNT, char** choices,
174// int nsel, int *selection,
175// wxWindow *parent = NULL, int x = -1, int y = -1,
a72f4631 176// bool centre = true, int width=150, int height=200);
d14a1e28
RD
177
178
ab1f7d2a 179MustHaveApp(wxGetSingleChoice);
d14a1e28
RD
180wxString wxGetSingleChoice(const wxString& message, const wxString& caption,
181 int choices, wxString* choices_array,
182 wxWindow *parent = NULL,
183 int x = -1, int y = -1,
a72f4631 184 bool centre = true,
d14a1e28
RD
185 int width=150, int height=200);
186
ab1f7d2a 187MustHaveApp(wxGetSingleChoiceIndex);
d14a1e28
RD
188int wxGetSingleChoiceIndex(const wxString& message, const wxString& caption,
189 int choices, wxString* choices_array,
190 wxWindow *parent = NULL,
191 int x = -1, int y = -1,
a72f4631 192 bool centre = true,
d14a1e28
RD
193 int width=150, int height=200);
194
195
ab1f7d2a 196MustHaveApp(wxMessageBox);
d14a1e28
RD
197int wxMessageBox(const wxString& message,
198 const wxString& caption = wxPyEmptyString,
199 int style = wxOK | wxCENTRE,
200 wxWindow *parent = NULL,
201 int x = -1, int y = -1);
202
aeee37c3 203// WXWIN_COMPATIBILITY_2_4
2f91e3df 204#if 0
ab1f7d2a 205MustHaveApp(wxGetNumberFromUser);
d14a1e28
RD
206long 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);
02b800ce 213%pythoncode { GetNumberFromUser = wx._deprecated(GetNumberFromUser) }
2f91e3df 214#endif
02b800ce 215
d14a1e28
RD
216// GDI Functions
217
ab1f7d2a 218MustHaveApp(wxColourDisplay);
d14a1e28
RD
219bool wxColourDisplay();
220
ab1f7d2a 221MustHaveApp(wxDisplayDepth);
d14a1e28 222int wxDisplayDepth();
ab1f7d2a
RD
223
224MustHaveApp(wxGetDisplayDepth);
d14a1e28
RD
225int wxGetDisplayDepth();
226
ab1f7d2a 227MustHaveApp(wxDisplaySize);
322913ce
RD
228DocDeclA(
229 void, wxDisplaySize(int* OUTPUT, int* OUTPUT),
230 "DisplaySize() -> (width, height)");
ab1f7d2a
RD
231
232MustHaveApp(wxGetDisplaySize);
d14a1e28
RD
233wxSize wxGetDisplaySize();
234
ab1f7d2a 235MustHaveApp(wxDisplaySizeMM);
322913ce
RD
236DocDeclA(
237 void, wxDisplaySizeMM(int* OUTPUT, int* OUTPUT),
238 "DisplaySizeMM() -> (width, height)");
ab1f7d2a
RD
239
240MustHaveApp(wxGetDisplaySizeMM);
d14a1e28
RD
241wxSize wxGetDisplaySizeMM();
242
ab1f7d2a 243MustHaveApp(wxClientDisplayRect);
322913ce
RD
244DocDeclA(
245 void, wxClientDisplayRect(int *OUTPUT, int *OUTPUT, int *OUTPUT, int *OUTPUT),
246 "ClientDisplayRect() -> (x, y, width, height)");
ab1f7d2a
RD
247
248MustHaveApp(wxGetClientDisplayRect);
d14a1e28
RD
249wxRect wxGetClientDisplayRect();
250
ab1f7d2a
RD
251
252MustHaveApp(wxSetCursor);
d14a1e28
RD
253void wxSetCursor(wxCursor& cursor);
254
255
2327fb3b
RD
256MustHaveApp(wxGetXDisplay);
257DocStr(wxGetXDisplay,
258"Returns a swigified pointer to the X11 display. Returns None on
259other platforms.", "");
260%inline %{
261 void* wxGetXDisplay()
262 {
263#ifdef __WXGTK__
264 return wxGetDisplay();
265#else
266 return NULL;
267#endif
268 }
269%}
270
d14a1e28
RD
271
272// Miscellaneous functions
273
ab1f7d2a 274MustHaveApp(wxBeginBusyCursor);
d14a1e28 275void wxBeginBusyCursor(wxCursor *cursor = wxHOURGLASS_CURSOR);
ab1f7d2a 276
095315e2
RD
277
278MustHaveApp(wxGetMousePosition);
279DocDeclStr(
280 wxPoint, wxGetMousePosition(),
281 "Get the current mouse position on the screen.", "");
282
283MustHaveApp(FindWindowAtPointer);
284DocStr(FindWindowAtPointer,
285 "Returns the window currently under the mouse pointer, if it belongs to
286 this application. Otherwise it returns None.", "");
287%inline %{
288 wxWindow* FindWindowAtPointer() {
289 wxPoint unused;
290 return wxFindWindowAtPointer(unused);
291 }
292%}
293
294
ab1f7d2a 295MustHaveApp(wxGetActiveWindow);
095315e2
RD
296DocDeclStr(
297 wxWindow *, wxGetActiveWindow(),
298 "Get the currently active window of this application, or None", "");
299
d14a1e28 300
ab1f7d2a 301MustHaveApp(wxGenericFindWindowAtPoint);
d14a1e28 302wxWindow* wxGenericFindWindowAtPoint(const wxPoint& pt);
ab1f7d2a
RD
303
304MustHaveApp(wxFindWindowAtPoint);
d14a1e28
RD
305wxWindow* wxFindWindowAtPoint(const wxPoint& pt);
306
ab1f7d2a 307MustHaveApp(wxGetTopLevelParent);
d14a1e28
RD
308wxWindow* wxGetTopLevelParent(wxWindow *win);
309
d14a1e28 310
aa2fc802
RD
311DocDeclStr(
312 bool , wxLaunchDefaultBrowser(const wxString& url),
313 "Launches the user's default browser and tells it to open the location
314at ``url``. Returns ``True`` if the application was successfully
315launched.", "");
d14a1e28
RD
316
317
89c876de 318
ab1f7d2a 319MustHaveApp(wxGetKeyState);
ad411ab2
RD
320DocDeclStr(
321 bool , wxGetKeyState(wxKeyCode key),
322 "Get the state of a key (true if pressed or toggled on, false if not.)
323This is generally most useful getting the state of the modifier or
095315e2
RD
324toggle keys. On some platforms those may be the only keys that this
325function is able to detect.
ad411ab2
RD
326", "");
327
57b1892f
RD
328
329
095315e2
RD
330//---------------------------------------------------------------------------
331
332DocStr(wxMouseState,
333"`wx.MouseState` is used to hold information about mouse button and
334modifier key states and is what is returned from `wx.GetMouseState`.",
335"");
336
337class wxMouseState
338{
339public:
340 wxMouseState();
341 ~wxMouseState();
342
343 wxCoord GetX();
344 wxCoord GetY();
345
346 bool LeftDown();
347 bool MiddleDown();
348 bool RightDown();
349
350 bool ControlDown();
351 bool ShiftDown();
352 bool AltDown();
353 bool MetaDown();
354 bool CmdDown();
355
356 void SetX(wxCoord x);
357 void SetY(wxCoord y);
358
359 void SetLeftDown(bool down);
360 void SetMiddleDown(bool down);
361 void SetRightDown(bool down);
362
363 void SetControlDown(bool down);
364 void SetShiftDown(bool down);
365 void SetAltDown(bool down);
366 void SetMetaDown(bool down);
367
368 %pythoncode {
369 x = property(GetX, SetX)
370 y = property(GetY, SetY)
371 leftDown = property(LeftDown, SetLeftDown)
372 middleDown = property(MiddleDown, SetMiddleDown)
373 rightDown = property(RightDown, SetRightDown)
374 controlDown = property(ControlDown, SetControlDown)
375 shiftDown = property(ShiftDown, SetShiftDown)
376 altDown = property(AltDown, SetAltDown)
377 metaDown = property(MetaDown, SetMetaDown)
378 cmdDown = property(CmdDown)
379 }
380};
381
382
383DocDeclStr(
384 wxMouseState , wxGetMouseState(),
385 "Returns the current state of the mouse. Returns an instance of a
386`wx.MouseState` object that contains the current position of the mouse
387pointer in screen coordinants, as well as boolean values indicating
388the up/down status of the mouse buttons and the modifier keys.", "");
389
390
d14a1e28
RD
391//---------------------------------------------------------------------------
392
ab1f7d2a
RD
393MustHaveApp(wxWakeUpMainThread);
394
d14a1e28
RD
395#if defined(__WXMSW__) || defined(__WXMAC__)
396void wxWakeUpMainThread();
397#else
398%inline %{
399 void wxWakeUpMainThread() {}
400%}
401#endif
402
ab1f7d2a
RD
403
404MustHaveApp(wxMutexGuiEnter);
d14a1e28 405void wxMutexGuiEnter();
ab1f7d2a
RD
406
407MustHaveApp(wxMutexGuiLeave);
d14a1e28
RD
408void wxMutexGuiLeave();
409
410
ab1f7d2a 411MustHaveApp(wxMutexGuiLocker);
d14a1e28
RD
412class wxMutexGuiLocker {
413public:
414 wxMutexGuiLocker();
415 ~wxMutexGuiLocker();
416};
417
418
ab1f7d2a 419MustHaveApp(wxThread);
d14a1e28
RD
420%inline %{
421 bool wxThread_IsMain() {
422#ifdef WXP_WITH_THREAD
423 return wxThread::IsMain();
424#else
a72f4631 425 return true;
d14a1e28
RD
426#endif
427 }
428%}
429
aeee37c3
RD
430//---------------------------------------------------------------------------
431
432// enum wxPowerType
433// {
434// wxPOWER_SOCKET,
435// wxPOWER_BATTERY,
436// wxPOWER_UNKNOWN
437// };
438
439// DocDeclStr(
440// wxPowerType , wxGetPowerType(),
441// "Returns the type of power source as one of wx.POWER_SOCKET,
442// wx.POWER_BATTERY or wx.POWER_UNKNOWN. wx.POWER_UNKNOWN is also the
443// default on platforms where this feature is not implemented.", "");
444
445
446// enum wxBatteryState
447// {
448// wxBATTERY_NORMAL_STATE, // system is fully usable
449// wxBATTERY_LOW_STATE, // start to worry
450// wxBATTERY_CRITICAL_STATE, // save quickly
451// wxBATTERY_SHUTDOWN_STATE, // too late
452// wxBATTERY_UNKNOWN_STATE
453// };
454
455// DocDeclStr(
456// wxBatteryState , wxGetBatteryState(),
457// "Returns battery state as one of wx.BATTERY_NORMAL_STATE,
458// wx.BATTERY_LOW_STATE}, wx.BATTERY_CRITICAL_STATE,
459// wx.BATTERY_SHUTDOWN_STATE or wx.BATTERY_UNKNOWN_STATE.
460// wx.BATTERY_UNKNOWN_STATE is also the default on platforms where this
461// feature is not implemented.", "");
462
463
464
d14a1e28
RD
465//---------------------------------------------------------------------------
466//---------------------------------------------------------------------------