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);
 
  63     int, wxGetOsVersion(int *OUTPUT, int *OUTPUT),
 
  64     "GetOsVersion() -> (platform, major, minor)");
 
  66 wxString wxGetOsDescription();
 
  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"
 
  74 // int wxParseCommonDialogsFilter(const wxString& wildCard, wxArrayString& descriptions, wxArrayString& filters);
 
  76 #if defined(__WXMSW__) || defined(__WXMAC__)
 
  77 wxMemorySize wxGetFreeMemory();
 
  80     wxMemorySize wxGetFreeMemory()
 
  81         { wxPyRaiseNotImplemented(); return 0; }
 
  87     wxSHUTDOWN_POWEROFF,    // power off the computer
 
  88     wxSHUTDOWN_REBOOT       // shutdown and reboot
 
  91 // Shutdown or reboot the PC
 
  92 MustHaveApp(wxShutdown);
 
  93 bool wxShutdown(wxShutdownFlags wFlags);
 
  96 void wxSleep(int secs);
 
  97 void wxMilliSleep(unsigned long milliseconds);
 
  98 void wxMicroSleep(unsigned long microseconds);
 
  99 %pythoncode { Usleep = MilliSleep }
 
 101 void wxEnableTopLevelWindows(bool enable);
 
 103 wxString wxStripMenuCodes(const wxString& in);
 
 106 wxString wxGetEmailAddress();
 
 107 wxString wxGetHostName();
 
 108 wxString wxGetFullHostName();
 
 109 wxString wxGetUserId();
 
 110 wxString wxGetUserName();
 
 111 wxString wxGetHomeDir();
 
 112 wxString wxGetUserHome(const wxString& user = wxPyEmptyString);
 
 114 unsigned long wxGetProcessId();
 
 121 MustHaveApp(wxFileSelector);
 
 122 wxString 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,
 
 128                         wxWindow *parent = NULL,
 
 129                         int x = -1, int y = -1);
 
 131 // TODO: wxFileSelectorEx
 
 134 // Ask for filename to load
 
 135 MustHaveApp(wxLoadFileSelector);
 
 136 wxString wxLoadFileSelector(const wxString& what,
 
 137                             const wxString& extension,
 
 138                             const wxString& default_name = wxPyEmptyString,
 
 139                             wxWindow *parent = NULL);
 
 141 // Ask for filename to save
 
 142 MustHaveApp(wxSaveFileSelector);
 
 143 wxString wxSaveFileSelector(const wxString& what,
 
 144                             const wxString& extension,
 
 145                             const wxString& default_name = wxPyEmptyString,
 
 146                             wxWindow *parent = NULL);
 
 149 MustHaveApp(wxDirSelector);
 
 150 wxString 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);
 
 156 MustHaveApp(wxGetTextFromUser);
 
 157 wxString 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,
 
 164 MustHaveApp(wxGetPasswordFromUser);
 
 165 wxString wxGetPasswordFromUser(const wxString& message,
 
 166                                const wxString& caption = wxPyEmptyString,
 
 167                                const wxString& default_value = wxPyEmptyString,
 
 168                                wxWindow *parent = NULL);
 
 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,
 
 176 //                         bool centre = true, int width=150, int height=200);
 
 179 MustHaveApp(wxGetSingleChoice);
 
 180 wxString wxGetSingleChoice(const wxString& message, const wxString& caption,
 
 181                            int choices, wxString* choices_array,
 
 182                            wxWindow *parent = NULL,
 
 183                            int x = -1, int y = -1,
 
 185                            int width=150, int height=200);
 
 187 MustHaveApp(wxGetSingleChoiceIndex);
 
 188 int wxGetSingleChoiceIndex(const wxString& message, const wxString& caption,
 
 189                            int choices, wxString* choices_array,
 
 190                            wxWindow *parent = NULL,
 
 191                            int x = -1, int y = -1,
 
 193                            int width=150, int height=200);
 
 196 MustHaveApp(wxMessageBox);
 
 197 int 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);
 
 203 // WXWIN_COMPATIBILITY_2_4
 
 205 MustHaveApp(wxGetNumberFromUser);
 
 206 long wxGetNumberFromUser(const wxString& message,
 
 207                          const wxString& prompt,
 
 208                          const wxString& caption,
 
 210                          long min = 0, long max = 100,
 
 211                          wxWindow *parent = NULL,
 
 212                          const wxPoint& pos = wxDefaultPosition);
 
 213 %pythoncode { GetNumberFromUser = wx._deprecated(GetNumberFromUser) }
 
 218 MustHaveApp(wxColourDisplay);
 
 219 bool wxColourDisplay();
 
 221 MustHaveApp(wxDisplayDepth);
 
 222 int wxDisplayDepth();
 
 224 MustHaveApp(wxGetDisplayDepth);
 
 225 int wxGetDisplayDepth();
 
 227 MustHaveApp(wxDisplaySize);
 
 229     void, wxDisplaySize(int* OUTPUT, int* OUTPUT),
 
 230     "DisplaySize() -> (width, height)");
 
 232 MustHaveApp(wxGetDisplaySize);
 
 233 wxSize wxGetDisplaySize();
 
 235 MustHaveApp(wxDisplaySizeMM);
 
 237     void, wxDisplaySizeMM(int* OUTPUT, int* OUTPUT),
 
 238     "DisplaySizeMM() -> (width, height)");
 
 240 MustHaveApp(wxGetDisplaySizeMM);
 
 241 wxSize wxGetDisplaySizeMM();
 
 243 MustHaveApp(wxClientDisplayRect);
 
 245     void, wxClientDisplayRect(int *OUTPUT, int *OUTPUT, int *OUTPUT, int *OUTPUT),
 
 246     "ClientDisplayRect() -> (x, y, width, height)");
 
 248 MustHaveApp(wxGetClientDisplayRect);
 
 249 wxRect wxGetClientDisplayRect();
 
 252 MustHaveApp(wxSetCursor);
 
 253 void wxSetCursor(wxCursor& cursor);
 
 256 MustHaveApp(wxGetXDisplay);
 
 257 DocStr(wxGetXDisplay,
 
 258 "Returns a swigified pointer to the X11 display.  Returns None on
 
 259 other platforms.", "");
 
 261     void* wxGetXDisplay()
 
 264         return wxGetDisplay();
 
 272 // Miscellaneous functions
 
 274 MustHaveApp(wxBeginBusyCursor);
 
 275 void wxBeginBusyCursor(wxCursor *cursor = wxHOURGLASS_CURSOR);
 
 278 MustHaveApp(wxGetMousePosition);
 
 280     wxPoint, wxGetMousePosition(),
 
 281     "Get the current mouse position on the screen.", "");
 
 283 MustHaveApp(FindWindowAtPointer);
 
 284 DocStr(FindWindowAtPointer,
 
 285        "Returns the window currently under the mouse pointer, if it belongs to
 
 286     this application.  Otherwise it returns None.", "");
 
 288     wxWindow* FindWindowAtPointer() {
 
 290         return wxFindWindowAtPointer(unused);
 
 295 MustHaveApp(wxGetActiveWindow);
 
 297     wxWindow *, wxGetActiveWindow(),
 
 298     "Get the currently active window of this application, or None", "");
 
 301 MustHaveApp(wxGenericFindWindowAtPoint);
 
 302 wxWindow* wxGenericFindWindowAtPoint(const wxPoint& pt);
 
 304 MustHaveApp(wxFindWindowAtPoint);
 
 305 wxWindow* wxFindWindowAtPoint(const wxPoint& pt);
 
 307 MustHaveApp(wxGetTopLevelParent);
 
 308 wxWindow* wxGetTopLevelParent(wxWindow *win);
 
 312     bool , wxLaunchDefaultBrowser(const wxString& url),
 
 313     "Launches the user's default browser and tells it to open the location
 
 314 at ``url``.  Returns ``True`` if the application was successfully
 
 319 MustHaveApp(wxGetKeyState);
 
 321     bool , wxGetKeyState(wxKeyCode key),
 
 322     "Get the state of a key (true if pressed or toggled on, false if not.)
 
 323 This is generally most useful getting the state of the modifier or
 
 324 toggle keys.  On some platforms those may be the only keys that this
 
 325 function is able to detect.
 
 330 //---------------------------------------------------------------------------
 
 333 "`wx.MouseState` is used to hold information about mouse button and
 
 334 modifier key states and is what is returned from `wx.GetMouseState`.",
 
 356     void        SetX(wxCoord x);
 
 357     void        SetY(wxCoord y);
 
 359     void        SetLeftDown(bool down);
 
 360     void        SetMiddleDown(bool down);
 
 361     void        SetRightDown(bool down);
 
 363     void        SetControlDown(bool down);
 
 364     void        SetShiftDown(bool down);
 
 365     void        SetAltDown(bool down);
 
 366     void        SetMetaDown(bool down);
 
 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)
 
 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
 
 387 pointer in screen coordinants, as well as boolean values indicating
 
 388 the up/down status of the mouse buttons and the modifier keys.", "");
 
 391 //---------------------------------------------------------------------------
 
 393 MustHaveApp(wxWakeUpMainThread);
 
 395 #if defined(__WXMSW__) || defined(__WXMAC__)
 
 396 void wxWakeUpMainThread();
 
 399     void wxWakeUpMainThread() {}
 
 404 MustHaveApp(wxMutexGuiEnter);
 
 405 void wxMutexGuiEnter();
 
 407 MustHaveApp(wxMutexGuiLeave);
 
 408 void wxMutexGuiLeave();
 
 411 MustHaveApp(wxMutexGuiLocker);
 
 412 class wxMutexGuiLocker  {
 
 419 MustHaveApp(wxThread);
 
 421     bool wxThread_IsMain() {
 
 422 #ifdef WXP_WITH_THREAD
 
 423         return wxThread::IsMain();
 
 430 //---------------------------------------------------------------------------
 
 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.", "");
 
 446 // enum wxBatteryState
 
 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
 
 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.", "");
 
 465 //---------------------------------------------------------------------------
 
 466 //---------------------------------------------------------------------------