1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: SWIG interface defs for various functions and such
7 // Created: 3-July-1997
9 // Copyright: (c) 2003 by Total Control Software
10 // Licence: wxWindows license
11 /////////////////////////////////////////////////////////////////////////////
17 #include <wx/stockitem.h>
20 //---------------------------------------------------------------------------
22 MAKE_CONST_WXSTRING(FileSelectorPromptStr);
23 MAKE_CONST_WXSTRING(FileSelectorDefaultWildcardStr);
24 MAKE_CONST_WXSTRING(DirSelectorPromptStr);
26 //---------------------------------------------------------------------------
31 void wxRegisterId(long id);
32 long wxGetCurrentId();
34 // Returns true if the ID is in the list of recognized stock actions
35 bool wxIsStockID(wxWindowID id);
37 // Returns true of the label is empty or label of a stock button with
39 bool wxIsStockLabel(wxWindowID id, const wxString& label);
41 // Returns label that should be used for given stock UI element (e.g. "&OK"
43 wxString wxGetStockLabel(wxWindowID id,
44 bool withCodes = true,
45 wxString accelerator = wxPyEmptyString);
51 MustHaveApp(wxEndBusyCursor);
52 void wxEndBusyCursor();
54 long wxGetElapsedTime(bool resetTimer = true);
55 %pythoncode { GetElapsedTime = wx._deprecated(GetElapsedTime) }
59 bool wxShell(const wxString& command = wxPyEmptyString);
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 */
76 wxGTK_WIN32, /* GTK on Win32 */
77 wxGTK_OS2, /* GTK on OS/2 */
78 wxGTK_BEOS, /* GTK on BeOS */
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 */
104 int, wxGetOsVersion(int *OUTPUT, int *OUTPUT),
105 "GetOsVersion() -> (platform, major, minor)");
107 wxString wxGetOsDescription();
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);
118 %typemap(out) wxMemorySize {
120 $result = PyLong_FromLongLong($1.GetValue());
122 $result = PyInt_FromLong($1);
126 #if defined(__WXMSW__) || defined(__WXMAC__)
127 wxMemorySize wxGetFreeMemory();
130 wxMemorySize wxGetFreeMemory()
131 { wxPyRaiseNotImplemented(); return 0; }
137 wxSHUTDOWN_POWEROFF, // power off the computer
138 wxSHUTDOWN_REBOOT // shutdown and reboot
141 // Shutdown or reboot the PC
142 MustHaveApp(wxShutdown);
143 bool wxShutdown(wxShutdownFlags wFlags);
146 void wxSleep(int secs);
147 void wxMilliSleep(unsigned long milliseconds);
148 void wxMicroSleep(unsigned long microseconds);
149 %pythoncode { Usleep = MilliSleep }
151 void wxEnableTopLevelWindows(bool enable);
153 wxString wxStripMenuCodes(const wxString& in);
156 wxString wxGetEmailAddress();
157 wxString wxGetHostName();
158 wxString wxGetFullHostName();
159 wxString wxGetUserId();
160 wxString wxGetUserName();
161 wxString wxGetHomeDir();
162 wxString wxGetUserHome(const wxString& user = wxPyEmptyString);
164 unsigned long wxGetProcessId();
171 MustHaveApp(wxFileSelector);
172 wxString wxFileSelector(const wxString& message = wxPyFileSelectorPromptStr,
173 const wxString& default_path = wxPyEmptyString,
174 const wxString& default_filename = wxPyEmptyString,
175 const wxString& default_extension = wxPyEmptyString,
176 const wxString& wildcard = wxPyFileSelectorDefaultWildcardStr,
178 wxWindow *parent = NULL,
179 int x = -1, int y = -1);
181 // TODO: wxFileSelectorEx
184 // Ask for filename to load
185 MustHaveApp(wxLoadFileSelector);
186 wxString wxLoadFileSelector(const wxString& what,
187 const wxString& extension,
188 const wxString& default_name = wxPyEmptyString,
189 wxWindow *parent = NULL);
191 // Ask for filename to save
192 MustHaveApp(wxSaveFileSelector);
193 wxString wxSaveFileSelector(const wxString& what,
194 const wxString& extension,
195 const wxString& default_name = wxPyEmptyString,
196 wxWindow *parent = NULL);
199 MustHaveApp(wxDirSelector);
200 wxString wxDirSelector(const wxString& message = wxPyDirSelectorPromptStr,
201 const wxString& defaultPath = wxPyEmptyString,
202 long style = wxDD_DEFAULT_STYLE,
203 const wxPoint& pos = wxDefaultPosition,
204 wxWindow *parent = NULL);
206 MustHaveApp(wxGetTextFromUser);
207 wxString wxGetTextFromUser(const wxString& message,
208 const wxString& caption = wxPyEmptyString,
209 const wxString& default_value = wxPyEmptyString,
210 wxWindow *parent = NULL,
211 int x = -1, int y = -1,
214 MustHaveApp(wxGetPasswordFromUser);
215 wxString wxGetPasswordFromUser(const wxString& message,
216 const wxString& caption = wxPyEmptyString,
217 const wxString& default_value = wxPyEmptyString,
218 wxWindow *parent = NULL);
221 // TODO: Need to custom wrap this one...
222 // int wxGetMultipleChoice(char* message, char* caption,
223 // int LCOUNT, char** choices,
224 // int nsel, int *selection,
225 // wxWindow *parent = NULL, int x = -1, int y = -1,
226 // bool centre = true, int width=150, int height=200);
229 MustHaveApp(wxGetSingleChoice);
230 wxString wxGetSingleChoice(const wxString& message, const wxString& caption,
231 int choices, wxString* choices_array,
232 wxWindow *parent = NULL,
233 int x = -1, int y = -1,
235 int width=150, int height=200);
237 MustHaveApp(wxGetSingleChoiceIndex);
238 int wxGetSingleChoiceIndex(const wxString& message, const wxString& caption,
239 int choices, wxString* choices_array,
240 wxWindow *parent = NULL,
241 int x = -1, int y = -1,
243 int width=150, int height=200);
246 MustHaveApp(wxMessageBox);
247 int wxMessageBox(const wxString& message,
248 const wxString& caption = wxPyEmptyString,
249 int style = wxOK | wxCENTRE,
250 wxWindow *parent = NULL,
251 int x = -1, int y = -1);
253 MustHaveApp(wxGetNumberFromUser);
254 long wxGetNumberFromUser(const wxString& message,
255 const wxString& prompt,
256 const wxString& caption,
258 long min = 0, long max = 100,
259 wxWindow *parent = NULL,
260 const wxPoint& pos = wxDefaultPosition);
264 MustHaveApp(wxColourDisplay);
265 bool wxColourDisplay();
267 MustHaveApp(wxDisplayDepth);
268 int wxDisplayDepth();
270 MustHaveApp(wxGetDisplayDepth);
271 int wxGetDisplayDepth();
273 MustHaveApp(wxDisplaySize);
275 void, wxDisplaySize(int* OUTPUT, int* OUTPUT),
276 "DisplaySize() -> (width, height)");
278 MustHaveApp(wxGetDisplaySize);
279 wxSize wxGetDisplaySize();
281 MustHaveApp(wxDisplaySizeMM);
283 void, wxDisplaySizeMM(int* OUTPUT, int* OUTPUT),
284 "DisplaySizeMM() -> (width, height)");
286 MustHaveApp(wxGetDisplaySizeMM);
287 wxSize wxGetDisplaySizeMM();
289 MustHaveApp(wxClientDisplayRect);
291 void, wxClientDisplayRect(int *OUTPUT, int *OUTPUT, int *OUTPUT, int *OUTPUT),
292 "ClientDisplayRect() -> (x, y, width, height)");
294 MustHaveApp(wxGetClientDisplayRect);
295 wxRect wxGetClientDisplayRect();
298 MustHaveApp(wxSetCursor);
299 void wxSetCursor(wxCursor& cursor);
302 MustHaveApp(wxGetXDisplay);
303 DocStr(wxGetXDisplay,
304 "Returns a swigified pointer to the X11 display. Returns None on
305 other platforms.", "");
307 void* wxGetXDisplay()
310 return wxGetDisplay();
318 // Miscellaneous functions
320 MustHaveApp(wxBeginBusyCursor);
321 void wxBeginBusyCursor(wxCursor *cursor = wxHOURGLASS_CURSOR);
324 MustHaveApp(wxGetMousePosition);
326 wxPoint, wxGetMousePosition(),
327 "Get the current mouse position on the screen.", "");
329 MustHaveApp(FindWindowAtPointer);
330 DocStr(FindWindowAtPointer,
331 "Returns the window currently under the mouse pointer, if it belongs to
332 this application. Otherwise it returns None.", "");
334 wxWindow* FindWindowAtPointer() {
336 return wxFindWindowAtPointer(unused);
341 MustHaveApp(wxGetActiveWindow);
343 wxWindow *, wxGetActiveWindow(),
344 "Get the currently active window of this application, or None", "");
347 MustHaveApp(wxGenericFindWindowAtPoint);
348 wxWindow* wxGenericFindWindowAtPoint(const wxPoint& pt);
350 MustHaveApp(wxFindWindowAtPoint);
351 wxWindow* wxFindWindowAtPoint(const wxPoint& pt);
353 MustHaveApp(wxGetTopLevelParent);
354 wxWindow* wxGetTopLevelParent(wxWindow *win);
358 bool , wxLaunchDefaultBrowser(const wxString& url),
359 "Launches the user's default browser and tells it to open the location
360 at ``url``. Returns ``True`` if the application was successfully
365 MustHaveApp(wxGetKeyState);
367 bool , wxGetKeyState(wxKeyCode key),
368 "Get the state of a key (true if pressed or toggled on, false if not.)
369 This is generally most useful getting the state of the modifier or
370 toggle keys. On some platforms those may be the only keys that this
371 function is able to detect.
376 //---------------------------------------------------------------------------
379 "`wx.MouseState` is used to hold information about mouse button and
380 modifier key states and is what is returned from `wx.GetMouseState`.",
402 void SetX(wxCoord x);
403 void SetY(wxCoord y);
405 void SetLeftDown(bool down);
406 void SetMiddleDown(bool down);
407 void SetRightDown(bool down);
409 void SetControlDown(bool down);
410 void SetShiftDown(bool down);
411 void SetAltDown(bool down);
412 void SetMetaDown(bool down);
415 x = property(GetX, SetX)
416 y = property(GetY, SetY)
417 leftDown = property(LeftDown, SetLeftDown)
418 middleDown = property(MiddleDown, SetMiddleDown)
419 rightDown = property(RightDown, SetRightDown)
420 controlDown = property(ControlDown, SetControlDown)
421 shiftDown = property(ShiftDown, SetShiftDown)
422 altDown = property(AltDown, SetAltDown)
423 metaDown = property(MetaDown, SetMetaDown)
424 cmdDown = property(CmdDown)
430 wxMouseState , wxGetMouseState(),
431 "Returns the current state of the mouse. Returns an instance of a
432 `wx.MouseState` object that contains the current position of the mouse
433 pointer in screen coordinants, as well as boolean values indicating
434 the up/down status of the mouse buttons and the modifier keys.", "");
437 //---------------------------------------------------------------------------
439 MustHaveApp(wxWakeUpMainThread);
441 #if defined(__WXMSW__) || defined(__WXMAC__)
442 void wxWakeUpMainThread();
445 void wxWakeUpMainThread() {}
450 MustHaveApp(wxMutexGuiEnter);
451 void wxMutexGuiEnter();
453 MustHaveApp(wxMutexGuiLeave);
454 void wxMutexGuiLeave();
457 MustHaveApp(wxMutexGuiLocker);
458 class wxMutexGuiLocker {
465 MustHaveApp(wxThread);
467 bool wxThread_IsMain() {
468 #ifdef WXP_WITH_THREAD
469 return wxThread::IsMain();
476 //---------------------------------------------------------------------------
477 //---------------------------------------------------------------------------