]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/utilscmn.cpp
Warning fix and source cleaning.
[wxWidgets.git] / src / common / utilscmn.cpp
index 4e4d3a92807d2213d62ba25328ae0f11b671b1c9..d3ecc68a974b63366ddc0d858127756f2c4ce2ad 100644 (file)
@@ -95,7 +95,7 @@
     #include <sys/stat.h>
 #endif
 
-#ifdef __WXMSW__
+#if defined(__WXMSW__)
     #include "wx/msw/private.h"
 #endif
 
@@ -330,10 +330,10 @@ wxString wxGetEmailAddress()
     wxString email;
 
     wxString host = wxGetFullHostName();
-    if ( !host.IsEmpty() )
+    if ( !host.empty() )
     {
         wxString user = wxGetUserId();
-        if ( !user.IsEmpty() )
+        if ( !user.empty() )
         {
             email << user << wxT('@') << host;
         }
@@ -479,13 +479,14 @@ static bool ReadAll(wxInputStream *is, wxArrayString& output)
 // public versions of wxExecute() below
 static long wxDoExecuteWithCapture(const wxString& command,
                                    wxArrayString& output,
-                                   wxArrayString* error)
+                                   wxArrayString* error,
+                                   int flags)
 {
     // create a wxProcess which will capture the output
     wxProcess *process = new wxProcess;
     process->Redirect();
 
-    long rc = wxExecute(command, wxEXEC_SYNC, process);
+    long rc = wxExecute(command, wxEXEC_SYNC | flags, process);
 
 #if wxUSE_STREAMS
     if ( rc != -1 )
@@ -510,16 +511,17 @@ static long wxDoExecuteWithCapture(const wxString& command,
     return rc;
 }
 
-long wxExecute(const wxString& command, wxArrayString& output)
+long wxExecute(const wxString& command, wxArrayString& output, int flags)
 {
-    return wxDoExecuteWithCapture(command, output, NULL);
+    return wxDoExecuteWithCapture(command, output, NULL, flags);
 }
 
 long wxExecute(const wxString& command,
                wxArrayString& output,
-               wxArrayString& error)
+               wxArrayString& error,
+               int flags)
 {
-    return wxDoExecuteWithCapture(command, output, &error);
+    return wxDoExecuteWithCapture(command, output, &error, flags);
 }
 
 // ----------------------------------------------------------------------------
@@ -547,10 +549,13 @@ bool wxYieldIfNeeded()
 // Id generation
 static long wxCurrentId = 100;
 
-long
-wxNewId (void)
+long wxNewId()
 {
-  return wxCurrentId++;
+    // skip the part of IDs space that contains hard-coded values:
+    if (wxCurrentId == wxID_LOWEST)
+        wxCurrentId = wxID_HIGHEST + 1;
+
+    return wxCurrentId++;
 }
 
 long
@@ -806,11 +811,19 @@ wxString wxGetTextFromUser(const wxString& message, const wxString& caption,
 wxString wxGetPasswordFromUser(const wxString& message,
                                const wxString& caption,
                                const wxString& defaultValue,
-                               wxWindow *parent)
+                               wxWindow *parent,
+                               wxCoord x, wxCoord y, bool centre )
 {
     wxString str;
-    wxTextEntryDialog dialog(parent, message, caption, defaultValue,
-                             wxOK | wxCANCEL | wxTE_PASSWORD);
+    long style = wxTextEntryDialogStyle;
+
+    if (centre)
+        style |= wxCENTRE;
+    else
+        style &= ~wxCENTRE;
+
+    wxPasswordEntryDialog dialog(parent, message, caption, defaultValue,
+                             style, wxPoint(x, y));
     if ( dialog.ShowModal() == wxID_OK )
     {
         str = dialog.GetValue();