]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/utilscmn.cpp
VA 4.0 fixes
[wxWidgets.git] / src / common / utilscmn.cpp
index 9dd4d99b3e0abd75eb624a1c3e1caf7c31229d90..9af79de3296495dc1990c7d8bfc6467896988ebd 100644 (file)
     #include <clib.h>
 #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
@@ -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__
@@ -1048,3 +1055,37 @@ wxString wxGetHomeDir()
 
     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