]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/utilscmn.cpp
compilation fix
[wxWidgets.git] / src / common / utilscmn.cpp
index 57fcf3bd32171acdbcb48a155c9770cb478207de..be9df90d2fb7162e8d935856b423a59d4b10c564 100644 (file)
@@ -748,6 +748,27 @@ whereami(name)
 
 #endif
 
+
+// Yield to other apps/messages and disable user input
+bool wxSafeYield(wxWindow *win)
+{
+   wxNode *node;
+   for ( node = wxTopLevelWindows.GetFirst();
+         node;
+         node = node->GetNext() )
+      ((wxWindow*)node->GetData())->Enable(FALSE);
+   
+   // always enable ourselves
+   if(win) win->Enable(true);
+   bool rc = wxYield();
+
+   for ( node = wxTopLevelWindows.GetFirst();
+         node;
+         node = node->GetNext() )
+      ((wxWindow*)node->GetData())->Enable(TRUE);
+   return rc;
+}
+
 /*
  * N.B. these convenience functions must be separate from msgdlgg.cpp, textdlgg.cpp
  * since otherwise the generic code may be pulled in unnecessarily.
@@ -801,19 +822,6 @@ int isascii( int c )
 }
 #endif
 
-// Overloaded functions, taking a wxString
-bool wxGetHostName(wxString& name)
-{
-    bool success = wxGetHostName(wxBuffer, 500);
-    if (success)
-    {
-        name = wxBuffer;
-        return TRUE;
-    }
-    else
-        return FALSE;
-}
-
 bool wxGetUserId(wxString& buf)
 {
     bool success = wxGetUserId(wxBuffer, 500);
@@ -838,3 +846,13 @@ bool wxGetUserName(wxString& buf)
         return FALSE;
 }
 
+bool wxGetHostName(wxString& buf)
+{
+    static const size_t hostnameSize = 257;
+    bool ok = wxGetHostName(buf.GetWriteBuf(hostnameSize), hostnameSize);
+
+    buf.UngetWriteBuf();
+
+    return ok;
+}
+