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);
 
  49 MustHaveApp(wxEndBusyCursor);
 
  50 void wxEndBusyCursor();
 
  52 long wxGetElapsedTime(bool resetTimer = true);
 
  54 MustHaveApp(wxGetMousePosition);
 
  56     void, wxGetMousePosition(int* OUTPUT, int* OUTPUT),
 
  57     "GetMousePosition() -> (x,y)");
 
  61 bool wxShell(const wxString& command = wxPyEmptyString);
 
  65     int, wxGetOsVersion(int *OUTPUT, int *OUTPUT),
 
  66     "GetOsVersion() -> (platform, major, minor)");
 
  68 wxString wxGetOsDescription();
 
  71 // // Parses the wildCard, returning the number of filters.
 
  72 // // Returns 0 if none or if there's a problem,
 
  73 // // The arrays will contain an equal number of items found before the error.
 
  74 // // wildCard is in the form:
 
  75 // // "All files (*)|*|Image Files (*.jpeg *.png)|*.jpg;*.png"
 
  76 // int wxParseCommonDialogsFilter(const wxString& wildCard, wxArrayString& descriptions, wxArrayString& filters);
 
  78 #if defined(__WXMSW__) || defined(__WXMAC__)
 
  79 long wxGetFreeMemory();
 
  82     long wxGetFreeMemory()
 
  83         { wxPyRaiseNotImplemented(); return 0; }
 
  89     wxSHUTDOWN_POWEROFF,    // power off the computer
 
  90     wxSHUTDOWN_REBOOT       // shutdown and reboot
 
  93 // Shutdown or reboot the PC
 
  94 MustHaveApp(wxShutdown);
 
  95 bool wxShutdown(wxShutdownFlags wFlags);
 
  98 void wxSleep(int secs);
 
  99 void wxMilliSleep(unsigned long milliseconds);
 
 100 void wxMicroSleep(unsigned long microseconds);
 
 101 %pythoncode { Usleep = MilliSleep }
 
 103 void wxEnableTopLevelWindows(bool enable);
 
 105 wxString wxStripMenuCodes(const wxString& in);
 
 108 wxString wxGetEmailAddress();
 
 109 wxString wxGetHostName();
 
 110 wxString wxGetFullHostName();
 
 111 wxString wxGetUserId();
 
 112 wxString wxGetUserName();
 
 113 wxString wxGetHomeDir();
 
 114 wxString wxGetUserHome(const wxString& user = wxPyEmptyString);
 
 116 unsigned long wxGetProcessId();
 
 123 MustHaveApp(wxFileSelector);
 
 124 wxString wxFileSelector(const wxString& message = wxPyFileSelectorPromptStr,
 
 125                         const wxString& default_path = wxPyEmptyString,
 
 126                         const wxString& default_filename = wxPyEmptyString,
 
 127                         const wxString& default_extension = wxPyEmptyString,
 
 128                         const wxString& wildcard = wxPyFileSelectorDefaultWildcardStr,
 
 130                         wxWindow *parent = NULL,
 
 131                         int x = -1, int y = -1);
 
 133 // TODO: wxFileSelectorEx
 
 136 // Ask for filename to load
 
 137 MustHaveApp(wxLoadFileSelector);
 
 138 wxString wxLoadFileSelector(const wxString& what,
 
 139                             const wxString& extension,
 
 140                             const wxString& default_name = wxPyEmptyString,
 
 141                             wxWindow *parent = NULL);
 
 143 // Ask for filename to save
 
 144 MustHaveApp(wxSaveFileSelector);
 
 145 wxString wxSaveFileSelector(const wxString& what,
 
 146                             const wxString& extension,
 
 147                             const wxString& default_name = wxPyEmptyString,
 
 148                             wxWindow *parent = NULL);
 
 151 MustHaveApp(wxDirSelector);
 
 152 wxString wxDirSelector(const wxString& message = wxPyDirSelectorPromptStr,
 
 153                        const wxString& defaultPath = wxPyEmptyString,
 
 154                        long style = wxDD_DEFAULT_STYLE,
 
 155                        const wxPoint& pos = wxDefaultPosition,
 
 156                        wxWindow *parent = NULL);
 
 158 MustHaveApp(wxGetTextFromUser);
 
 159 wxString wxGetTextFromUser(const wxString& message,
 
 160                            const wxString& caption = wxPyEmptyString,
 
 161                            const wxString& default_value = wxPyEmptyString,
 
 162                            wxWindow *parent = NULL,
 
 163                            int x = -1, int y = -1,
 
 166 MustHaveApp(wxGetPasswordFromUser);
 
 167 wxString wxGetPasswordFromUser(const wxString& message,
 
 168                                const wxString& caption = wxPyEmptyString,
 
 169                                const wxString& default_value = wxPyEmptyString,
 
 170                                wxWindow *parent = NULL);
 
 173 // TODO: Need to custom wrap this one...
 
 174 // int wxGetMultipleChoice(char* message, char* caption,
 
 175 //                         int LCOUNT, char** choices,
 
 176 //                         int nsel, int *selection,
 
 177 //                         wxWindow *parent = NULL, int x = -1, int y = -1,
 
 178 //                         bool centre = true, int width=150, int height=200);
 
 181 MustHaveApp(wxGetSingleChoice);
 
 182 wxString wxGetSingleChoice(const wxString& message, const wxString& caption,
 
 183                            int choices, wxString* choices_array,
 
 184                            wxWindow *parent = NULL,
 
 185                            int x = -1, int y = -1,
 
 187                            int width=150, int height=200);
 
 189 MustHaveApp(wxGetSingleChoiceIndex);
 
 190 int wxGetSingleChoiceIndex(const wxString& message, const wxString& caption,
 
 191                            int choices, wxString* choices_array,
 
 192                            wxWindow *parent = NULL,
 
 193                            int x = -1, int y = -1,
 
 195                            int width=150, int height=200);
 
 198 MustHaveApp(wxMessageBox);
 
 199 int wxMessageBox(const wxString& message,
 
 200                  const wxString& caption = wxPyEmptyString,
 
 201                  int style = wxOK | wxCENTRE,
 
 202                  wxWindow *parent = NULL,
 
 203                  int x = -1, int y = -1);
 
 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);
 
 216 MustHaveApp(wxColourDisplay);
 
 217 bool wxColourDisplay();
 
 219 MustHaveApp(wxDisplayDepth);
 
 220 int wxDisplayDepth();
 
 222 MustHaveApp(wxGetDisplayDepth);
 
 223 int wxGetDisplayDepth();
 
 225 MustHaveApp(wxDisplaySize);
 
 227     void, wxDisplaySize(int* OUTPUT, int* OUTPUT),
 
 228     "DisplaySize() -> (width, height)");
 
 230 MustHaveApp(wxGetDisplaySize);
 
 231 wxSize wxGetDisplaySize();
 
 233 MustHaveApp(wxDisplaySizeMM);
 
 235     void, wxDisplaySizeMM(int* OUTPUT, int* OUTPUT),
 
 236     "DisplaySizeMM() -> (width, height)");
 
 238 MustHaveApp(wxGetDisplaySizeMM);
 
 239 wxSize wxGetDisplaySizeMM();
 
 241 MustHaveApp(wxClientDisplayRect);
 
 243     void, wxClientDisplayRect(int *OUTPUT, int *OUTPUT, int *OUTPUT, int *OUTPUT),
 
 244     "ClientDisplayRect() -> (x, y, width, height)");
 
 246 MustHaveApp(wxGetClientDisplayRect);
 
 247 wxRect wxGetClientDisplayRect();
 
 250 MustHaveApp(wxSetCursor);
 
 251 void wxSetCursor(wxCursor& cursor);
 
 255 // Miscellaneous functions
 
 257 MustHaveApp(wxBeginBusyCursor);
 
 258 void wxBeginBusyCursor(wxCursor *cursor = wxHOURGLASS_CURSOR);
 
 260 MustHaveApp(wxGetActiveWindow);
 
 261 wxWindow * wxGetActiveWindow();
 
 263 MustHaveApp(wxGenericFindWindowAtPoint);
 
 264 wxWindow* wxGenericFindWindowAtPoint(const wxPoint& pt);
 
 266 MustHaveApp(wxFindWindowAtPoint);
 
 267 wxWindow* wxFindWindowAtPoint(const wxPoint& pt);
 
 269 MustHaveApp(wxGetTopLevelParent);
 
 270 wxWindow* wxGetTopLevelParent(wxWindow *win);
 
 272 //bool wxSpawnBrowser(wxWindow *parent, wxString href);
 
 277 MustHaveApp(wxGetKeyState);
 
 279     bool , wxGetKeyState(wxKeyCode key),
 
 280     "Get the state of a key (true if pressed or toggled on, false if not.)
 
 281 This is generally most useful getting the state of the modifier or
 
 282 toggle keys.  On some platforms those may be the only keys that work.
 
 287 //---------------------------------------------------------------------------
 
 289 MustHaveApp(wxWakeUpMainThread);
 
 291 #if defined(__WXMSW__) || defined(__WXMAC__)
 
 292 void wxWakeUpMainThread();
 
 295     void wxWakeUpMainThread() {}
 
 300 MustHaveApp(wxMutexGuiEnter);
 
 301 void wxMutexGuiEnter();
 
 303 MustHaveApp(wxMutexGuiLeave);
 
 304 void wxMutexGuiLeave();
 
 307 MustHaveApp(wxMutexGuiLocker);
 
 308 class wxMutexGuiLocker  {
 
 315 MustHaveApp(wxThread);
 
 317     bool wxThread_IsMain() {
 
 318 #ifdef WXP_WITH_THREAD
 
 319         return wxThread::IsMain();
 
 326 //---------------------------------------------------------------------------
 
 327 //---------------------------------------------------------------------------