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