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);
 
  56 MustHaveApp(wxGetMousePosition);
 
  58     void, wxGetMousePosition(int* OUTPUT, int* OUTPUT),
 
  59     "GetMousePosition() -> (x,y)");
 
  63 bool wxShell(const wxString& command = wxPyEmptyString);
 
  67     int, wxGetOsVersion(int *OUTPUT, int *OUTPUT),
 
  68     "GetOsVersion() -> (platform, major, minor)");
 
  70 wxString wxGetOsDescription();
 
  73 // // Parses the wildCard, returning the number of filters.
 
  74 // // Returns 0 if none or if there's a problem,
 
  75 // // The arrays will contain an equal number of items found before the error.
 
  76 // // wildCard is in the form:
 
  77 // // "All files (*)|*|Image Files (*.jpeg *.png)|*.jpg;*.png"
 
  78 // int wxParseCommonDialogsFilter(const wxString& wildCard, wxArrayString& descriptions, wxArrayString& filters);
 
  80 #if defined(__WXMSW__) || defined(__WXMAC__)
 
  81 long wxGetFreeMemory();
 
  84     long wxGetFreeMemory()
 
  85         { wxPyRaiseNotImplemented(); return 0; }
 
  91     wxSHUTDOWN_POWEROFF,    // power off the computer
 
  92     wxSHUTDOWN_REBOOT       // shutdown and reboot
 
  95 // Shutdown or reboot the PC
 
  96 MustHaveApp(wxShutdown);
 
  97 bool wxShutdown(wxShutdownFlags wFlags);
 
 100 void wxSleep(int secs);
 
 101 void wxMilliSleep(unsigned long milliseconds);
 
 102 void wxMicroSleep(unsigned long microseconds);
 
 103 %pythoncode { Usleep = MilliSleep }
 
 105 void wxEnableTopLevelWindows(bool enable);
 
 107 wxString wxStripMenuCodes(const wxString& in);
 
 110 wxString wxGetEmailAddress();
 
 111 wxString wxGetHostName();
 
 112 wxString wxGetFullHostName();
 
 113 wxString wxGetUserId();
 
 114 wxString wxGetUserName();
 
 115 wxString wxGetHomeDir();
 
 116 wxString wxGetUserHome(const wxString& user = wxPyEmptyString);
 
 118 unsigned long wxGetProcessId();
 
 125 MustHaveApp(wxFileSelector);
 
 126 wxString wxFileSelector(const wxString& message = wxPyFileSelectorPromptStr,
 
 127                         const wxString& default_path = wxPyEmptyString,
 
 128                         const wxString& default_filename = wxPyEmptyString,
 
 129                         const wxString& default_extension = wxPyEmptyString,
 
 130                         const wxString& wildcard = wxPyFileSelectorDefaultWildcardStr,
 
 132                         wxWindow *parent = NULL,
 
 133                         int x = -1, int y = -1);
 
 135 // TODO: wxFileSelectorEx
 
 138 // Ask for filename to load
 
 139 MustHaveApp(wxLoadFileSelector);
 
 140 wxString wxLoadFileSelector(const wxString& what,
 
 141                             const wxString& extension,
 
 142                             const wxString& default_name = wxPyEmptyString,
 
 143                             wxWindow *parent = NULL);
 
 145 // Ask for filename to save
 
 146 MustHaveApp(wxSaveFileSelector);
 
 147 wxString wxSaveFileSelector(const wxString& what,
 
 148                             const wxString& extension,
 
 149                             const wxString& default_name = wxPyEmptyString,
 
 150                             wxWindow *parent = NULL);
 
 153 MustHaveApp(wxDirSelector);
 
 154 wxString wxDirSelector(const wxString& message = wxPyDirSelectorPromptStr,
 
 155                        const wxString& defaultPath = wxPyEmptyString,
 
 156                        long style = wxDD_DEFAULT_STYLE,
 
 157                        const wxPoint& pos = wxDefaultPosition,
 
 158                        wxWindow *parent = NULL);
 
 160 MustHaveApp(wxGetTextFromUser);
 
 161 wxString wxGetTextFromUser(const wxString& message,
 
 162                            const wxString& caption = wxPyEmptyString,
 
 163                            const wxString& default_value = wxPyEmptyString,
 
 164                            wxWindow *parent = NULL,
 
 165                            int x = -1, int y = -1,
 
 168 MustHaveApp(wxGetPasswordFromUser);
 
 169 wxString wxGetPasswordFromUser(const wxString& message,
 
 170                                const wxString& caption = wxPyEmptyString,
 
 171                                const wxString& default_value = wxPyEmptyString,
 
 172                                wxWindow *parent = NULL);
 
 175 // TODO: Need to custom wrap this one...
 
 176 // int wxGetMultipleChoice(char* message, char* caption,
 
 177 //                         int LCOUNT, char** choices,
 
 178 //                         int nsel, int *selection,
 
 179 //                         wxWindow *parent = NULL, int x = -1, int y = -1,
 
 180 //                         bool centre = true, int width=150, int height=200);
 
 183 MustHaveApp(wxGetSingleChoice);
 
 184 wxString wxGetSingleChoice(const wxString& message, const wxString& caption,
 
 185                            int choices, wxString* choices_array,
 
 186                            wxWindow *parent = NULL,
 
 187                            int x = -1, int y = -1,
 
 189                            int width=150, int height=200);
 
 191 MustHaveApp(wxGetSingleChoiceIndex);
 
 192 int wxGetSingleChoiceIndex(const wxString& message, const wxString& caption,
 
 193                            int choices, wxString* choices_array,
 
 194                            wxWindow *parent = NULL,
 
 195                            int x = -1, int y = -1,
 
 197                            int width=150, int height=200);
 
 200 MustHaveApp(wxMessageBox);
 
 201 int wxMessageBox(const wxString& message,
 
 202                  const wxString& caption = wxPyEmptyString,
 
 203                  int style = wxOK | wxCENTRE,
 
 204                  wxWindow *parent = NULL,
 
 205                  int x = -1, int y = -1);
 
 207 // WXWIN_COMPATIBILITY_2_4
 
 208 MustHaveApp(wxGetNumberFromUser);
 
 209 long wxGetNumberFromUser(const wxString& message,
 
 210                          const wxString& prompt,
 
 211                          const wxString& caption,
 
 213                          long min = 0, long max = 100,
 
 214                          wxWindow *parent = NULL,
 
 215                          const wxPoint& pos = wxDefaultPosition);
 
 219 MustHaveApp(wxColourDisplay);
 
 220 bool wxColourDisplay();
 
 222 MustHaveApp(wxDisplayDepth);
 
 223 int wxDisplayDepth();
 
 225 MustHaveApp(wxGetDisplayDepth);
 
 226 int wxGetDisplayDepth();
 
 228 MustHaveApp(wxDisplaySize);
 
 230     void, wxDisplaySize(int* OUTPUT, int* OUTPUT),
 
 231     "DisplaySize() -> (width, height)");
 
 233 MustHaveApp(wxGetDisplaySize);
 
 234 wxSize wxGetDisplaySize();
 
 236 MustHaveApp(wxDisplaySizeMM);
 
 238     void, wxDisplaySizeMM(int* OUTPUT, int* OUTPUT),
 
 239     "DisplaySizeMM() -> (width, height)");
 
 241 MustHaveApp(wxGetDisplaySizeMM);
 
 242 wxSize wxGetDisplaySizeMM();
 
 244 MustHaveApp(wxClientDisplayRect);
 
 246     void, wxClientDisplayRect(int *OUTPUT, int *OUTPUT, int *OUTPUT, int *OUTPUT),
 
 247     "ClientDisplayRect() -> (x, y, width, height)");
 
 249 MustHaveApp(wxGetClientDisplayRect);
 
 250 wxRect wxGetClientDisplayRect();
 
 253 MustHaveApp(wxSetCursor);
 
 254 void wxSetCursor(wxCursor& cursor);
 
 257 MustHaveApp(wxGetXDisplay);
 
 258 DocStr(wxGetXDisplay,
 
 259 "Returns a swigified pointer to the X11 display.  Returns None on
 
 260 other platforms.", "");
 
 262     void* wxGetXDisplay()
 
 265         return wxGetDisplay();
 
 273 // Miscellaneous functions
 
 275 MustHaveApp(wxBeginBusyCursor);
 
 276 void wxBeginBusyCursor(wxCursor *cursor = wxHOURGLASS_CURSOR);
 
 278 MustHaveApp(wxGetActiveWindow);
 
 279 wxWindow * wxGetActiveWindow();
 
 281 MustHaveApp(wxGenericFindWindowAtPoint);
 
 282 wxWindow* wxGenericFindWindowAtPoint(const wxPoint& pt);
 
 284 MustHaveApp(wxFindWindowAtPoint);
 
 285 wxWindow* wxFindWindowAtPoint(const wxPoint& pt);
 
 287 MustHaveApp(wxGetTopLevelParent);
 
 288 wxWindow* wxGetTopLevelParent(wxWindow *win);
 
 292     bool , wxLaunchDefaultBrowser(const wxString& url),
 
 293     "Launches the user's default browser and tells it to open the location
 
 294 at ``url``.  Returns ``True`` if the application was successfully
 
 299 MustHaveApp(wxGetKeyState);
 
 301     bool , wxGetKeyState(wxKeyCode key),
 
 302     "Get the state of a key (true if pressed or toggled on, false if not.)
 
 303 This is generally most useful getting the state of the modifier or
 
 304 toggle keys.  On some platforms those may be the only keys that work.
 
 309 //---------------------------------------------------------------------------
 
 311 MustHaveApp(wxWakeUpMainThread);
 
 313 #if defined(__WXMSW__) || defined(__WXMAC__)
 
 314 void wxWakeUpMainThread();
 
 317     void wxWakeUpMainThread() {}
 
 322 MustHaveApp(wxMutexGuiEnter);
 
 323 void wxMutexGuiEnter();
 
 325 MustHaveApp(wxMutexGuiLeave);
 
 326 void wxMutexGuiLeave();
 
 329 MustHaveApp(wxMutexGuiLocker);
 
 330 class wxMutexGuiLocker  {
 
 337 MustHaveApp(wxThread);
 
 339     bool wxThread_IsMain() {
 
 340 #ifdef WXP_WITH_THREAD
 
 341         return wxThread::IsMain();
 
 348 //---------------------------------------------------------------------------
 
 358 //     wxPowerType , wxGetPowerType(),
 
 359 //     "Returns the type of power source as one of wx.POWER_SOCKET,
 
 360 // wx.POWER_BATTERY or wx.POWER_UNKNOWN.  wx.POWER_UNKNOWN is also the
 
 361 // default on platforms where this feature is not implemented.", "");
 
 364 // enum wxBatteryState
 
 366 //     wxBATTERY_NORMAL_STATE,    // system is fully usable
 
 367 //     wxBATTERY_LOW_STATE,       // start to worry
 
 368 //     wxBATTERY_CRITICAL_STATE,  // save quickly
 
 369 //     wxBATTERY_SHUTDOWN_STATE,  // too late
 
 370 //     wxBATTERY_UNKNOWN_STATE
 
 374 //     wxBatteryState , wxGetBatteryState(),
 
 375 //     "Returns battery state as one of wx.BATTERY_NORMAL_STATE,
 
 376 // wx.BATTERY_LOW_STATE}, wx.BATTERY_CRITICAL_STATE,
 
 377 // wx.BATTERY_SHUTDOWN_STATE or wx.BATTERY_UNKNOWN_STATE.
 
 378 // wx.BATTERY_UNKNOWN_STATE is also the default on platforms where this
 
 379 // feature is not implemented.", "");
 
 383 //---------------------------------------------------------------------------
 
 384 //---------------------------------------------------------------------------