X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/a541c325865cd11d1ba8ef25333b8650b2823c8a..40f7145ca55ccf1b197e70acf79bbd4aa5d85145:/wxPython/src/misc2.i diff --git a/wxPython/src/misc2.i b/wxPython/src/misc2.i index 74c55bd82f..eb1c5a8eb0 100644 --- a/wxPython/src/misc2.i +++ b/wxPython/src/misc2.i @@ -20,7 +20,6 @@ #include #include #include -#include #include #include @@ -50,40 +49,57 @@ %import utils.i +//---------------------------------------------------------------------- + +%{ + // Put some wx default wxChar* values into wxStrings. + DECLARE_DEF_STRING(FileSelectorPromptStr); + DECLARE_DEF_STRING(FileSelectorDefaultWildcardStr); + DECLARE_DEF_STRING(DirSelectorPromptStr); + static const wxString wxPyEmptyString(wxT("")); +%} + //--------------------------------------------------------------------------- // Dialog Functions -wxString wxFileSelector(const wxChar* message = wxFileSelectorPromptStr, - const wxChar* default_path = NULL, - const wxChar* default_filename = NULL, - const wxChar* default_extension = NULL, - const wxChar* wildcard = wxFileSelectorDefaultWildcardStr, +wxString wxFileSelector(const wxString& message = wxPyFileSelectorPromptStr, + const wxString& default_path = wxPyEmptyString, + const wxString& default_filename = wxPyEmptyString, + const wxString& default_extension = wxPyEmptyString, + const wxString& wildcard = wxPyFileSelectorDefaultWildcardStr, int flags = 0, wxWindow *parent = NULL, int x = -1, int y = -1); // Ask for filename to load -wxString wxLoadFileSelector(const wxChar *what, - const wxChar *extension, - const wxChar *default_name = NULL, +wxString wxLoadFileSelector(const wxString& what, + const wxString& extension, + const wxString& default_name = wxPyEmptyString, wxWindow *parent = NULL); // Ask for filename to save -wxString wxSaveFileSelector(const wxChar *what, - const wxChar *extension, - const wxChar *default_name = NULL, +wxString wxSaveFileSelector(const wxString& what, + const wxString& extension, + const wxString& default_name = wxPyEmptyString, wxWindow *parent = NULL); + +wxString wxDirSelector(const wxString& message = wxPyDirSelectorPromptStr, + const wxString& defaultPath = wxPyEmptyString, + long style = wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxDD_NEW_DIR_BUTTON, + const wxPoint& pos = wxDefaultPosition, + wxWindow *parent = NULL); + wxString wxGetTextFromUser(const wxString& message, - const wxString& caption = wxEmptyString, - const wxString& default_value = wxEmptyString, + const wxString& caption = wxPyEmptyString, + const wxString& default_value = wxPyEmptyString, wxWindow *parent = NULL, int x = -1, int y = -1, bool centre = TRUE); wxString wxGetPasswordFromUser(const wxString& message, - const wxString& caption = wxEmptyString, - const wxString& default_value = wxEmptyString, + const wxString& caption = wxPyEmptyString, + const wxString& default_value = wxPyEmptyString, wxWindow *parent = NULL); @@ -111,7 +127,7 @@ int wxGetSingleChoiceIndex(const wxString& message, const wxString& caption, int wxMessageBox(const wxString& message, - const wxString& caption = wxEmptyString, + const wxString& caption = wxPyEmptyString, int style = wxOK | wxCENTRE, wxWindow *parent = NULL, int x = -1, int y = -1); @@ -163,15 +179,15 @@ void wxFlushEvents(); //--------------------------------------------------------------------------- // Resource System -bool wxResourceAddIdentifier(char *name, int value); +bool wxResourceAddIdentifier(char* name, int value); void wxResourceClear(void); -wxBitmap wxResourceCreateBitmap(char *resource); -wxIcon wxResourceCreateIcon(char *resource); -wxMenuBar * wxResourceCreateMenuBar(char *resource); -int wxResourceGetIdentifier(char *name); -bool wxResourceParseData(char *resource, wxResourceTable *table = NULL); -bool wxResourceParseFile(char *filename, wxResourceTable *table = NULL); -bool wxResourceParseString(char *resource, wxResourceTable *table = NULL); +wxBitmap wxResourceCreateBitmap(char* resource); +wxIcon wxResourceCreateIcon(char* resource); +wxMenuBar * wxResourceCreateMenuBar(char* resource); +int wxResourceGetIdentifier(char* name); +bool wxResourceParseData(char* resource, wxResourceTable *table = NULL); +bool wxResourceParseFile(char* filename, wxResourceTable *table = NULL); +bool wxResourceParseString(char* resource, wxResourceTable *table = NULL); //--------------------------------------------------------------------------- // System Settings @@ -355,52 +371,6 @@ public: //---------------------------------------------------------------------- -%{ -class wxPyFontEnumerator : public wxFontEnumerator { -public: - wxPyFontEnumerator() {} - ~wxPyFontEnumerator() {} - - DEC_PYCALLBACK_BOOL_STRING(OnFacename); - DEC_PYCALLBACK_BOOL_STRINGSTRING(OnFontEncoding); - - PYPRIVATE; -}; - -IMP_PYCALLBACK_BOOL_STRING(wxPyFontEnumerator, wxFontEnumerator, OnFacename); -IMP_PYCALLBACK_BOOL_STRINGSTRING(wxPyFontEnumerator, wxFontEnumerator, OnFontEncoding); - -%} - -%name(wxFontEnumerator) class wxPyFontEnumerator { -public: - wxPyFontEnumerator(); - ~wxPyFontEnumerator(); - void _setCallbackInfo(PyObject* self, PyObject* _class, bool incref); - %pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxFontEnumerator, 0)" - - bool EnumerateFacenames( - wxFontEncoding encoding = wxFONTENCODING_SYSTEM, // all - bool fixedWidthOnly = FALSE); - bool EnumerateEncodings(const char* facename = ""); - - //wxArrayString* GetEncodings(); - //wxArrayString* GetFacenames(); - %addmethods { - PyObject* GetEncodings() { - wxArrayString* arr = self->GetEncodings(); - return wxArrayString2PyList_helper(*arr); - } - - PyObject* GetFacenames() { - wxArrayString* arr = self->GetFacenames(); - return wxArrayString2PyList_helper(*arr); - } - } -}; - -//---------------------------------------------------------------------- - class wxBusyCursor { public: wxBusyCursor(wxCursor* cursor = wxHOURGLASS_CURSOR); @@ -598,7 +568,7 @@ public: static void Suspend(); static void Resume(); - void SetVerbose(bool bVerbose = TRUE); + static void SetVerbose(bool bVerbose = TRUE); static void DontCreateOnDemand(); static void SetTraceMask(wxTraceMask ulMask); @@ -606,10 +576,10 @@ public: static void RemoveTraceMask(const wxString& str); static void ClearTraceMasks(); - static void SetTimestamp(const wxChar *ts); - static const wxChar *GetTimestamp(); + static void SetTimestamp(const wxString& ts); + static const wxString& GetTimestamp(); - bool GetVerbose() const { return m_bVerbose; } + bool GetVerbose() const; static wxTraceMask GetTraceMask(); static bool IsAllowedTraceMask(const wxString& mask); @@ -622,6 +592,7 @@ public: return msg; } } + }; @@ -661,14 +632,6 @@ public: }; -class wxLogNull -{ -public: - wxLogNull(); - ~wxLogNull(); -}; - - class wxLogChain : public wxLog { public: @@ -692,9 +655,19 @@ void wxLogStatus(const wxString& szFormat); %name(wxLogStatusFrame)void wxLogStatus(wxFrame *pFrame, const wxString& szFormat); void wxLogSysError(const wxString& szFormat); +// Suspress logging while an instance of this class exists +class wxLogNull +{ +public: + wxLogNull(); + ~wxLogNull(); +}; + + + %{ -// A Log class that can be derived from in wxPython +// A wxLog class that can be derived from in wxPython class wxPyLog : public wxLog { public: wxPyLog() : wxLog() {} @@ -796,9 +769,26 @@ public: }; +enum +{ + // execute the process asynchronously + wxEXEC_ASYNC = 0, + + // execute it synchronously, i.e. wait until it finishes + wxEXEC_SYNC = 1, + + // under Windows, don't hide the child even if it's IO is redirected (this + // is done by default) + wxEXEC_NOHIDE = 2, + + // under Unix, if the process is the group leader then killing -pid kills + // all children as well as pid + wxEXEC_MAKE_GROUP_LEADER = 4 +}; + long wxExecute(const wxString& command, - int sync = FALSE, + int flags = wxEXEC_ASYNC, wxPyProcess *process = NULL); //---------------------------------------------------------------------- @@ -980,10 +970,10 @@ class wxFileTypeInfo public: // ctors // a normal item - wxFileTypeInfo(const char *mimeType, - const char *openCmd, - const char *printCmd, - const char *desc); + wxFileTypeInfo(const char* mimeType, + const char* openCmd, + const char* printCmd, + const char* desc); // the array elements correspond to the parameters of the ctor above in @@ -1051,8 +1041,8 @@ public: { public: // ctors - MessageParameters(const wxString& filename=wxEmptyString, - const wxString& mimetype=wxEmptyString); + MessageParameters(const wxString& filename=wxPyEmptyString, + const wxString& mimetype=wxPyEmptyString); // accessors (called by GetOpenCommand) // filename @@ -1161,7 +1151,7 @@ public: // get the command to open/execute the file of given type %addmethods { PyObject* GetOpenCommand(const wxString& filename, - const wxString& mimetype=wxEmptyString) { + const wxString& mimetype=wxPyEmptyString) { wxString str; if (self->GetOpenCommand(&str, wxFileType::MessageParameters(filename, mimetype))) { #if wxUSE_UNICODE @@ -1178,7 +1168,7 @@ public: // get the command to print the file of given type %addmethods { PyObject* GetPrintCommand(const wxString& filename, - const wxString& mimetype=wxEmptyString) { + const wxString& mimetype=wxPyEmptyString) { wxString str; if (self->GetPrintCommand(&str, wxFileType::MessageParameters(filename, mimetype))) { #if wxUSE_UNICODE @@ -1195,7 +1185,7 @@ public: // Get all commands defined for this file type %addmethods { PyObject* GetAllCommands(const wxString& filename, - const wxString& mimetype=wxEmptyString) { + const wxString& mimetype=wxPyEmptyString) { wxArrayString verbs; wxArrayString commands; if (self->GetAllCommands(&verbs, &commands, @@ -1218,7 +1208,7 @@ public: bool SetCommand(const wxString& cmd, const wxString& verb, bool overwriteprompt = TRUE); - bool SetDefaultIcon(const wxString& cmd = wxEmptyString, int index = 0); + bool SetDefaultIcon(const wxString& cmd = wxPyEmptyString, int index = 0); // remove the association for this filetype from the system MIME database: @@ -1262,7 +1252,7 @@ public: // use the extraDir parameter if you want to look for files in another // directory void Initialize(int mailcapStyle = wxMAILCAP_STANDARD, - const wxString& extraDir = wxEmptyString); + const wxString& extraDir = wxPyEmptyString); // and this function clears all the data from the manager void ClearData(); @@ -1360,7 +1350,7 @@ public: void Save(wxConfigBase& config); void AddFilesToMenu(); - %name(AddFilesToSingleMenu)void AddFilesToMenu(wxMenu* menu); + %name(AddFilesToThisMenu)void AddFilesToMenu(wxMenu* menu); // Accessors wxString GetHistoryFile(int i) const; @@ -1376,7 +1366,6 @@ public: %init %{ - wxPyPtrTypeMap_Add("wxFontEnumerator", "wxPyFontEnumerator"); wxPyPtrTypeMap_Add("wxDragImage", "wxGenericDragImage"); wxPyPtrTypeMap_Add("wxProcess", "wxPyProcess"); %}