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);
64 int, wxGetOsVersion(int *OUTPUT, int *OUTPUT),
65 "GetOsVersion() -> (platform, major, minor)");
67 wxString wxGetOsDescription();
70 // Get platform endianness
71 bool wxIsPlatformLittleEndian();
73 // Get platform architecture
74 bool wxIsPlatform64Bit();
78 // // Parses the wildCard, returning the number of filters.
79 // // Returns 0 if none or if there's a problem,
80 // // The arrays will contain an equal number of items found before the error.
81 // // wildCard is in the form:
82 // // "All files (*)|*|Image Files (*.jpeg *.png)|*.jpg;*.png"
83 // int wxParseCommonDialogsFilter(const wxString& wildCard, wxArrayString& descriptions, wxArrayString& filters);
86 %typemap(out) wxMemorySize {
88 $result = PyLong_FromLongLong($1.GetValue());
90 $result = PyInt_FromLong($1);
94 #if defined(__WXMSW__) || defined(__WXMAC__)
95 wxMemorySize wxGetFreeMemory();
98 wxMemorySize wxGetFreeMemory()
99 { wxPyRaiseNotImplemented(); return 0; }
105 wxSHUTDOWN_POWEROFF, // power off the computer
106 wxSHUTDOWN_REBOOT // shutdown and reboot
109 // Shutdown or reboot the PC
110 MustHaveApp(wxShutdown);
111 bool wxShutdown(wxShutdownFlags wFlags);
114 void wxSleep(int secs);
115 void wxMilliSleep(unsigned long milliseconds);
116 void wxMicroSleep(unsigned long microseconds);
117 %pythoncode { Usleep = MilliSleep }
119 void wxEnableTopLevelWindows(bool enable);
121 wxString wxStripMenuCodes(const wxString& in);
124 wxString wxGetEmailAddress();
125 wxString wxGetHostName();
126 wxString wxGetFullHostName();
127 wxString wxGetUserId();
128 wxString wxGetUserName();
129 wxString wxGetHomeDir();
130 wxString wxGetUserHome(const wxString& user = wxPyEmptyString);
132 unsigned long wxGetProcessId();
139 MustHaveApp(wxFileSelector);
140 wxString wxFileSelector(const wxString& message = wxPyFileSelectorPromptStr,
141 const wxString& default_path = wxPyEmptyString,
142 const wxString& default_filename = wxPyEmptyString,
143 const wxString& default_extension = wxPyEmptyString,
144 const wxString& wildcard = wxPyFileSelectorDefaultWildcardStr,
146 wxWindow *parent = NULL,
147 int x = -1, int y = -1);
149 // TODO: wxFileSelectorEx
152 // Ask for filename to load
153 MustHaveApp(wxLoadFileSelector);
154 wxString wxLoadFileSelector(const wxString& what,
155 const wxString& extension,
156 const wxString& default_name = wxPyEmptyString,
157 wxWindow *parent = NULL);
159 // Ask for filename to save
160 MustHaveApp(wxSaveFileSelector);
161 wxString wxSaveFileSelector(const wxString& what,
162 const wxString& extension,
163 const wxString& default_name = wxPyEmptyString,
164 wxWindow *parent = NULL);
167 MustHaveApp(wxDirSelector);
168 wxString wxDirSelector(const wxString& message = wxPyDirSelectorPromptStr,
169 const wxString& defaultPath = wxPyEmptyString,
170 long style = wxDD_DEFAULT_STYLE,
171 const wxPoint& pos = wxDefaultPosition,
172 wxWindow *parent = NULL);
174 MustHaveApp(wxGetTextFromUser);
175 wxString wxGetTextFromUser(const wxString& message,
176 const wxString& caption = wxPyEmptyString,
177 const wxString& default_value = wxPyEmptyString,
178 wxWindow *parent = NULL,
179 int x = -1, int y = -1,
182 MustHaveApp(wxGetPasswordFromUser);
183 wxString wxGetPasswordFromUser(const wxString& message,
184 const wxString& caption = wxPyEmptyString,
185 const wxString& default_value = wxPyEmptyString,
186 wxWindow *parent = NULL);
189 // TODO: Need to custom wrap this one...
190 // int wxGetMultipleChoice(char* message, char* caption,
191 // int LCOUNT, char** choices,
192 // int nsel, int *selection,
193 // wxWindow *parent = NULL, int x = -1, int y = -1,
194 // bool centre = true, int width=150, int height=200);
197 MustHaveApp(wxGetSingleChoice);
198 wxString wxGetSingleChoice(const wxString& message, const wxString& caption,
199 int choices, wxString* choices_array,
200 wxWindow *parent = NULL,
201 int x = -1, int y = -1,
203 int width=150, int height=200);
205 MustHaveApp(wxGetSingleChoiceIndex);
206 int wxGetSingleChoiceIndex(const wxString& message, const wxString& caption,
207 int choices, wxString* choices_array,
208 wxWindow *parent = NULL,
209 int x = -1, int y = -1,
211 int width=150, int height=200);
214 MustHaveApp(wxMessageBox);
215 int wxMessageBox(const wxString& message,
216 const wxString& caption = wxPyEmptyString,
217 int style = wxOK | wxCENTRE,
218 wxWindow *parent = NULL,
219 int x = -1, int y = -1);
221 MustHaveApp(wxGetNumberFromUser);
222 long wxGetNumberFromUser(const wxString& message,
223 const wxString& prompt,
224 const wxString& caption,
226 long min = 0, long max = 100,
227 wxWindow *parent = NULL,
228 const wxPoint& pos = wxDefaultPosition);
232 MustHaveApp(wxColourDisplay);
233 bool wxColourDisplay();
235 MustHaveApp(wxDisplayDepth);
236 int wxDisplayDepth();
238 MustHaveApp(wxGetDisplayDepth);
239 int wxGetDisplayDepth();
241 MustHaveApp(wxDisplaySize);
243 void, wxDisplaySize(int* OUTPUT, int* OUTPUT),
244 "DisplaySize() -> (width, height)");
246 MustHaveApp(wxGetDisplaySize);
247 wxSize wxGetDisplaySize();
249 MustHaveApp(wxDisplaySizeMM);
251 void, wxDisplaySizeMM(int* OUTPUT, int* OUTPUT),
252 "DisplaySizeMM() -> (width, height)");
254 MustHaveApp(wxGetDisplaySizeMM);
255 wxSize wxGetDisplaySizeMM();
257 MustHaveApp(wxClientDisplayRect);
259 void, wxClientDisplayRect(int *OUTPUT, int *OUTPUT, int *OUTPUT, int *OUTPUT),
260 "ClientDisplayRect() -> (x, y, width, height)");
262 MustHaveApp(wxGetClientDisplayRect);
263 wxRect wxGetClientDisplayRect();
266 MustHaveApp(wxSetCursor);
267 void wxSetCursor(wxCursor& cursor);
270 MustHaveApp(wxGetXDisplay);
271 DocStr(wxGetXDisplay,
272 "Returns a swigified pointer to the X11 display. Returns None on
273 other platforms.", "");
275 void* wxGetXDisplay()
278 return wxGetDisplay();
286 // Miscellaneous functions
288 MustHaveApp(wxBeginBusyCursor);
289 void wxBeginBusyCursor(wxCursor *cursor = wxHOURGLASS_CURSOR);
292 MustHaveApp(wxGetMousePosition);
294 wxPoint, wxGetMousePosition(),
295 "Get the current mouse position on the screen.", "");
297 MustHaveApp(FindWindowAtPointer);
298 DocStr(FindWindowAtPointer,
299 "Returns the window currently under the mouse pointer, if it belongs to
300 this application. Otherwise it returns None.", "");
302 wxWindow* FindWindowAtPointer() {
304 return wxFindWindowAtPointer(unused);
309 MustHaveApp(wxGetActiveWindow);
311 wxWindow *, wxGetActiveWindow(),
312 "Get the currently active window of this application, or None", "");
315 MustHaveApp(wxGenericFindWindowAtPoint);
316 wxWindow* wxGenericFindWindowAtPoint(const wxPoint& pt);
318 MustHaveApp(wxFindWindowAtPoint);
319 wxWindow* wxFindWindowAtPoint(const wxPoint& pt);
321 MustHaveApp(wxGetTopLevelParent);
322 wxWindow* wxGetTopLevelParent(wxWindow *win);
326 bool , wxLaunchDefaultBrowser(const wxString& url),
327 "Launches the user's default browser and tells it to open the location
328 at ``url``. Returns ``True`` if the application was successfully
333 MustHaveApp(wxGetKeyState);
335 bool , wxGetKeyState(wxKeyCode key),
336 "Get the state of a key (true if pressed or toggled on, false if not.)
337 This is generally most useful getting the state of the modifier or
338 toggle keys. On some platforms those may be the only keys that this
339 function is able to detect.
344 //---------------------------------------------------------------------------
347 "`wx.MouseState` is used to hold information about mouse button and
348 modifier key states and is what is returned from `wx.GetMouseState`.",
370 void SetX(wxCoord x);
371 void SetY(wxCoord y);
373 void SetLeftDown(bool down);
374 void SetMiddleDown(bool down);
375 void SetRightDown(bool down);
377 void SetControlDown(bool down);
378 void SetShiftDown(bool down);
379 void SetAltDown(bool down);
380 void SetMetaDown(bool down);
383 x = property(GetX, SetX)
384 y = property(GetY, SetY)
385 leftDown = property(LeftDown, SetLeftDown)
386 middleDown = property(MiddleDown, SetMiddleDown)
387 rightDown = property(RightDown, SetRightDown)
388 controlDown = property(ControlDown, SetControlDown)
389 shiftDown = property(ShiftDown, SetShiftDown)
390 altDown = property(AltDown, SetAltDown)
391 metaDown = property(MetaDown, SetMetaDown)
392 cmdDown = property(CmdDown)
398 wxMouseState , wxGetMouseState(),
399 "Returns the current state of the mouse. Returns an instance of a
400 `wx.MouseState` object that contains the current position of the mouse
401 pointer in screen coordinants, as well as boolean values indicating
402 the up/down status of the mouse buttons and the modifier keys.", "");
405 //---------------------------------------------------------------------------
407 MustHaveApp(wxWakeUpMainThread);
409 #if defined(__WXMSW__) || defined(__WXMAC__)
410 void wxWakeUpMainThread();
413 void wxWakeUpMainThread() {}
418 MustHaveApp(wxMutexGuiEnter);
419 void wxMutexGuiEnter();
421 MustHaveApp(wxMutexGuiLeave);
422 void wxMutexGuiLeave();
425 MustHaveApp(wxMutexGuiLocker);
426 class wxMutexGuiLocker {
433 MustHaveApp(wxThread);
435 bool wxThread_IsMain() {
436 #ifdef WXP_WITH_THREAD
437 return wxThread::IsMain();
444 //---------------------------------------------------------------------------
445 //---------------------------------------------------------------------------