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);
58 bool wxShell(const wxString& command = wxPyEmptyString);
62 int, wxGetOsVersion(int *OUTPUT, int *OUTPUT),
63 "GetOsVersion() -> (platform, major, minor)");
65 wxString wxGetOsDescription();
68 // // Parses the wildCard, returning the number of filters.
69 // // Returns 0 if none or if there's a problem,
70 // // The arrays will contain an equal number of items found before the error.
71 // // wildCard is in the form:
72 // // "All files (*)|*|Image Files (*.jpeg *.png)|*.jpg;*.png"
73 // int wxParseCommonDialogsFilter(const wxString& wildCard, wxArrayString& descriptions, wxArrayString& filters);
75 #if defined(__WXMSW__) || defined(__WXMAC__)
76 wxMemorySize wxGetFreeMemory();
79 wxMemorySize wxGetFreeMemory()
80 { wxPyRaiseNotImplemented(); return 0; }
86 wxSHUTDOWN_POWEROFF, // power off the computer
87 wxSHUTDOWN_REBOOT // shutdown and reboot
90 // Shutdown or reboot the PC
91 MustHaveApp(wxShutdown);
92 bool wxShutdown(wxShutdownFlags wFlags);
95 void wxSleep(int secs);
96 void wxMilliSleep(unsigned long milliseconds);
97 void wxMicroSleep(unsigned long microseconds);
98 %pythoncode { Usleep = MilliSleep }
100 void wxEnableTopLevelWindows(bool enable);
102 wxString wxStripMenuCodes(const wxString& in);
105 wxString wxGetEmailAddress();
106 wxString wxGetHostName();
107 wxString wxGetFullHostName();
108 wxString wxGetUserId();
109 wxString wxGetUserName();
110 wxString wxGetHomeDir();
111 wxString wxGetUserHome(const wxString& user = wxPyEmptyString);
113 unsigned long wxGetProcessId();
120 MustHaveApp(wxFileSelector);
121 wxString wxFileSelector(const wxString& message = wxPyFileSelectorPromptStr,
122 const wxString& default_path = wxPyEmptyString,
123 const wxString& default_filename = wxPyEmptyString,
124 const wxString& default_extension = wxPyEmptyString,
125 const wxString& wildcard = wxPyFileSelectorDefaultWildcardStr,
127 wxWindow *parent = NULL,
128 int x = -1, int y = -1);
130 // TODO: wxFileSelectorEx
133 // Ask for filename to load
134 MustHaveApp(wxLoadFileSelector);
135 wxString wxLoadFileSelector(const wxString& what,
136 const wxString& extension,
137 const wxString& default_name = wxPyEmptyString,
138 wxWindow *parent = NULL);
140 // Ask for filename to save
141 MustHaveApp(wxSaveFileSelector);
142 wxString wxSaveFileSelector(const wxString& what,
143 const wxString& extension,
144 const wxString& default_name = wxPyEmptyString,
145 wxWindow *parent = NULL);
148 MustHaveApp(wxDirSelector);
149 wxString wxDirSelector(const wxString& message = wxPyDirSelectorPromptStr,
150 const wxString& defaultPath = wxPyEmptyString,
151 long style = wxDD_DEFAULT_STYLE,
152 const wxPoint& pos = wxDefaultPosition,
153 wxWindow *parent = NULL);
155 MustHaveApp(wxGetTextFromUser);
156 wxString wxGetTextFromUser(const wxString& message,
157 const wxString& caption = wxPyEmptyString,
158 const wxString& default_value = wxPyEmptyString,
159 wxWindow *parent = NULL,
160 int x = -1, int y = -1,
163 MustHaveApp(wxGetPasswordFromUser);
164 wxString wxGetPasswordFromUser(const wxString& message,
165 const wxString& caption = wxPyEmptyString,
166 const wxString& default_value = wxPyEmptyString,
167 wxWindow *parent = NULL);
170 // TODO: Need to custom wrap this one...
171 // int wxGetMultipleChoice(char* message, char* caption,
172 // int LCOUNT, char** choices,
173 // int nsel, int *selection,
174 // wxWindow *parent = NULL, int x = -1, int y = -1,
175 // bool centre = true, int width=150, int height=200);
178 MustHaveApp(wxGetSingleChoice);
179 wxString wxGetSingleChoice(const wxString& message, const wxString& caption,
180 int choices, wxString* choices_array,
181 wxWindow *parent = NULL,
182 int x = -1, int y = -1,
184 int width=150, int height=200);
186 MustHaveApp(wxGetSingleChoiceIndex);
187 int wxGetSingleChoiceIndex(const wxString& message, const wxString& caption,
188 int choices, wxString* choices_array,
189 wxWindow *parent = NULL,
190 int x = -1, int y = -1,
192 int width=150, int height=200);
195 MustHaveApp(wxMessageBox);
196 int wxMessageBox(const wxString& message,
197 const wxString& caption = wxPyEmptyString,
198 int style = wxOK | wxCENTRE,
199 wxWindow *parent = NULL,
200 int x = -1, int y = -1);
202 // WXWIN_COMPATIBILITY_2_4
204 MustHaveApp(wxGetNumberFromUser);
205 long wxGetNumberFromUser(const wxString& message,
206 const wxString& prompt,
207 const wxString& caption,
209 long min = 0, long max = 100,
210 wxWindow *parent = NULL,
211 const wxPoint& pos = wxDefaultPosition);
212 %pythoncode { GetNumberFromUser = wx._deprecated(GetNumberFromUser) }
217 MustHaveApp(wxColourDisplay);
218 bool wxColourDisplay();
220 MustHaveApp(wxDisplayDepth);
221 int wxDisplayDepth();
223 MustHaveApp(wxGetDisplayDepth);
224 int wxGetDisplayDepth();
226 MustHaveApp(wxDisplaySize);
228 void, wxDisplaySize(int* OUTPUT, int* OUTPUT),
229 "DisplaySize() -> (width, height)");
231 MustHaveApp(wxGetDisplaySize);
232 wxSize wxGetDisplaySize();
234 MustHaveApp(wxDisplaySizeMM);
236 void, wxDisplaySizeMM(int* OUTPUT, int* OUTPUT),
237 "DisplaySizeMM() -> (width, height)");
239 MustHaveApp(wxGetDisplaySizeMM);
240 wxSize wxGetDisplaySizeMM();
242 MustHaveApp(wxClientDisplayRect);
244 void, wxClientDisplayRect(int *OUTPUT, int *OUTPUT, int *OUTPUT, int *OUTPUT),
245 "ClientDisplayRect() -> (x, y, width, height)");
247 MustHaveApp(wxGetClientDisplayRect);
248 wxRect wxGetClientDisplayRect();
251 MustHaveApp(wxSetCursor);
252 void wxSetCursor(wxCursor& cursor);
255 MustHaveApp(wxGetXDisplay);
256 DocStr(wxGetXDisplay,
257 "Returns a swigified pointer to the X11 display. Returns None on
258 other platforms.", "");
260 void* wxGetXDisplay()
263 return wxGetDisplay();
271 // Miscellaneous functions
273 MustHaveApp(wxBeginBusyCursor);
274 void wxBeginBusyCursor(wxCursor *cursor = wxHOURGLASS_CURSOR);
277 MustHaveApp(wxGetMousePosition);
279 wxPoint, wxGetMousePosition(),
280 "Get the current mouse position on the screen.", "");
282 MustHaveApp(FindWindowAtPointer);
283 DocStr(FindWindowAtPointer,
284 "Returns the window currently under the mouse pointer, if it belongs to
285 this application. Otherwise it returns None.", "");
287 wxWindow* FindWindowAtPointer() {
289 return wxFindWindowAtPointer(unused);
294 MustHaveApp(wxGetActiveWindow);
296 wxWindow *, wxGetActiveWindow(),
297 "Get the currently active window of this application, or None", "");
300 MustHaveApp(wxGenericFindWindowAtPoint);
301 wxWindow* wxGenericFindWindowAtPoint(const wxPoint& pt);
303 MustHaveApp(wxFindWindowAtPoint);
304 wxWindow* wxFindWindowAtPoint(const wxPoint& pt);
306 MustHaveApp(wxGetTopLevelParent);
307 wxWindow* wxGetTopLevelParent(wxWindow *win);
311 bool , wxLaunchDefaultBrowser(const wxString& url),
312 "Launches the user's default browser and tells it to open the location
313 at ``url``. Returns ``True`` if the application was successfully
318 MustHaveApp(wxGetKeyState);
320 bool , wxGetKeyState(wxKeyCode key),
321 "Get the state of a key (true if pressed or toggled on, false if not.)
322 This is generally most useful getting the state of the modifier or
323 toggle keys. On some platforms those may be the only keys that this
324 function is able to detect.
329 //---------------------------------------------------------------------------
332 "`wx.MouseState` is used to hold information about mouse button and
333 modifier key states and is what is returned from `wx.GetMouseState`.",
355 void SetX(wxCoord x);
356 void SetY(wxCoord y);
358 void SetLeftDown(bool down);
359 void SetMiddleDown(bool down);
360 void SetRightDown(bool down);
362 void SetControlDown(bool down);
363 void SetShiftDown(bool down);
364 void SetAltDown(bool down);
365 void SetMetaDown(bool down);
368 x = property(GetX, SetX)
369 y = property(GetY, SetY)
370 leftDown = property(LeftDown, SetLeftDown)
371 middleDown = property(MiddleDown, SetMiddleDown)
372 rightDown = property(RightDown, SetRightDown)
373 controlDown = property(ControlDown, SetControlDown)
374 shiftDown = property(ShiftDown, SetShiftDown)
375 altDown = property(AltDown, SetAltDown)
376 metaDown = property(MetaDown, SetMetaDown)
377 cmdDown = property(CmdDown)
383 wxMouseState , wxGetMouseState(),
384 "Returns the current state of the mouse. Returns an instance of a
385 `wx.MouseState` object that contains the current position of the mouse
386 pointer in screen coordinants, as well as boolean values indicating
387 the up/down status of the mouse buttons and the modifier keys.", "");
390 //---------------------------------------------------------------------------
392 MustHaveApp(wxWakeUpMainThread);
394 #if defined(__WXMSW__) || defined(__WXMAC__)
395 void wxWakeUpMainThread();
398 void wxWakeUpMainThread() {}
403 MustHaveApp(wxMutexGuiEnter);
404 void wxMutexGuiEnter();
406 MustHaveApp(wxMutexGuiLeave);
407 void wxMutexGuiLeave();
410 MustHaveApp(wxMutexGuiLocker);
411 class wxMutexGuiLocker {
418 MustHaveApp(wxThread);
420 bool wxThread_IsMain() {
421 #ifdef WXP_WITH_THREAD
422 return wxThread::IsMain();
429 //---------------------------------------------------------------------------
439 // wxPowerType , wxGetPowerType(),
440 // "Returns the type of power source as one of wx.POWER_SOCKET,
441 // wx.POWER_BATTERY or wx.POWER_UNKNOWN. wx.POWER_UNKNOWN is also the
442 // default on platforms where this feature is not implemented.", "");
445 // enum wxBatteryState
447 // wxBATTERY_NORMAL_STATE, // system is fully usable
448 // wxBATTERY_LOW_STATE, // start to worry
449 // wxBATTERY_CRITICAL_STATE, // save quickly
450 // wxBATTERY_SHUTDOWN_STATE, // too late
451 // wxBATTERY_UNKNOWN_STATE
455 // wxBatteryState , wxGetBatteryState(),
456 // "Returns battery state as one of wx.BATTERY_NORMAL_STATE,
457 // wx.BATTERY_LOW_STATE}, wx.BATTERY_CRITICAL_STATE,
458 // wx.BATTERY_SHUTDOWN_STATE or wx.BATTERY_UNKNOWN_STATE.
459 // wx.BATTERY_UNKNOWN_STATE is also the default on platforms where this
460 // feature is not implemented.", "");
464 //---------------------------------------------------------------------------
465 //---------------------------------------------------------------------------