X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/bbeb6c2bc2365fb93a4de48b4f51d36af91c321c..9b1801c19c82340be79810c8b7617b05caa0cd59:/src/common/utilscmn.cpp diff --git a/src/common/utilscmn.cpp b/src/common/utilscmn.cpp index a96372e00d..9af79de329 100644 --- a/src/common/utilscmn.cpp +++ b/src/common/utilscmn.cpp @@ -70,14 +70,6 @@ #include #endif -// Pattern matching code. (FIXME) -// Yes, this path is deliberate (for Borland compilation) -#ifdef wx_mac /* MATTHEW: [5] Mac doesn't like paths with "/" */ -#include "glob.inc" -#else -#include "../common/glob.inc" -#endif - #ifdef __WXMSW__ #include "windows.h" #endif @@ -130,7 +122,7 @@ int strncasecmp(const char *str_1, const char *str_2, size_t maxchar) } #endif // wxMAC -#ifdef __VMS__ +#if defined( __VMS__ ) && ( __VMS_VER < 70000000 ) // we have no strI functions under VMS, therefore I have implemented // an inefficient but portable version: convert copies of strings to lowercase // and then use the normal comparison @@ -151,7 +143,7 @@ int strcasecmp(const char *str_1, const char *str_2) myLowerString(temp1); myLowerString(temp2); - int result = strcmp(temp1,temp2); + int result = wxStrcmp(temp1,temp2); delete[] temp1; delete[] temp2; @@ -873,19 +865,14 @@ int wxMessageBox(const wxString& message, const wxString& caption, long style, { case wxID_OK: return wxOK; - break; case wxID_YES: return wxYES; - break; case wxID_NO: return wxNO; - break; default: case wxID_CANCEL: return wxCANCEL; - break; } - return ans; } #if wxUSE_TEXTDLG @@ -893,12 +880,32 @@ wxString wxGetTextFromUser(const wxString& message, const wxString& caption, const wxString& defaultValue, wxWindow *parent, int x, int y, bool WXUNUSED(centre) ) { + wxString str; wxTextEntryDialog dialog(parent, message, caption, defaultValue, wxOK|wxCANCEL, wxPoint(x, y)); if (dialog.ShowModal() == wxID_OK) - return dialog.GetValue(); - else - return wxString(""); + { + str = dialog.GetValue(); + } + + return str; } + +wxString wxGetPasswordFromUser(const wxString& message, + const wxString& caption, + const wxString& defaultValue, + wxWindow *parent) +{ + wxString str; + wxTextEntryDialog dialog(parent, message, caption, defaultValue, + wxOK | wxCANCEL | wxTE_PASSWORD); + if ( dialog.ShowModal() == wxID_OK ) + { + str = dialog.GetValue(); + } + + return str; +} + #endif // wxUSE_TEXTDLG #ifdef __MWERKS__ @@ -1041,3 +1048,44 @@ wxString wxGetFullHostName() return buf; } +wxString wxGetHomeDir() +{ + wxString home; + wxGetHomeDir(&home); + + return home; +} + +#if 0 + +wxString wxGetCurrentDir() +{ + wxString dir; + size_t len = 1024; + bool ok; + do + { + ok = getcwd(dir.GetWriteBuf(len + 1), len) != NULL; + dir.UngetWriteBuf(); + + if ( !ok ) + { + if ( errno != ERANGE ) + { + wxLogSysError(_T("Failed to get current directory")); + + return wxEmptyString; + } + else + { + // buffer was too small, retry with a larger one + len *= 2; + } + } + //else: ok + } while ( !ok ); + + return dir; +} + +#endif // 0