]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/utils.cpp
Compile fix for GTK 1.0
[wxWidgets.git] / src / msw / utils.cpp
index 0f5ebc51abc8cb85d755685c2973cf9607efa4ca..697de7232a1197abbf3f91949781baf5b0065ecb 100644 (file)
@@ -299,6 +299,27 @@ class wxSleepTimer: public wxTimer
 
 static wxTimer *wxTheSleepTimer = NULL;
 
+void wxUsleep(unsigned long milliseconds)
+{
+#ifdef __WIN32__
+    ::Sleep(milliseconds);
+#else
+  if (inTimer)
+    return;
+
+  wxTheSleepTimer = new wxSleepTimer;
+  inTimer = TRUE;
+  wxTheSleepTimer->Start(milliseconds);
+  while (inTimer)
+  {
+    if (wxTheApp->Pending())
+      wxTheApp->Dispatch();
+  }
+  delete wxTheSleepTimer;
+  wxTheSleepTimer = NULL;
+#endif
+}
+
 void wxSleep(int nSecs)
 {
 #if 0 // WIN32 hangs app
@@ -537,7 +558,6 @@ void wxEndBusyCursor()
     wxCHECK_RET( gs_wxBusyCursorCount > 0,
                  "no matching wxBeginBusyCursor() for wxEndBusyCursor()" );
 
-    gs_wxBusyCursorCount--;
     if ( --gs_wxBusyCursorCount == 0 )
     {
         ::SetCursor(gs_wxBusyCursorOld);
@@ -776,6 +796,10 @@ bool wxDirExists(const wxString& dir)
 #endif
 }
 
+// ---------------------------------------------------------------------------
+// window information functions
+// ---------------------------------------------------------------------------
+
 wxString WXDLLEXPORT wxGetWindowText(WXHWND hWnd)
 {
     wxString str;
@@ -786,6 +810,58 @@ wxString WXDLLEXPORT wxGetWindowText(WXHWND hWnd)
     return str;
 }
 
+wxString WXDLLEXPORT wxGetWindowClass(WXHWND hWnd)
+{
+    wxString str;
+
+    int len = 256; // some starting value
+
+    for ( ;; )
+    {
+        // as we've #undefined GetClassName we must now manually choose the
+        // right function to call
+        int count =
+
+        #ifndef __WIN32__
+            GetClassName
+        #else // Win32
+            #ifdef UNICODE
+                GetClassNameW
+            #else // !Unicode
+                #ifdef __TWIN32__
+                    GetClassName
+                #else // !Twin32
+                    GetClassNameA
+                #endif // Twin32/!Twin32
+            #endif // Unicode/ANSI
+        #endif // Win16/32
+                                    ((HWND)hWnd, str.GetWriteBuf(len), len);
+
+        str.UngetWriteBuf();
+        if ( count == len )
+        {
+            // the class name might have been truncated, retry with larger
+            // buffer
+            len *= 2;
+        }
+        else
+        {
+            break;
+        }
+    }
+
+    return str;
+}
+
+WXWORD WXDLLEXPORT wxGetWindowId(WXHWND hWnd)
+{
+#ifndef __WIN32__
+    return GetWindowWord((HWND)hWnd, GWW_ID);
+#else // Win32
+    return GetWindowLong((HWND)hWnd, GWL_ID);
+#endif // Win16/32
+}
+
 #if 0
 //------------------------------------------------------------------------
 // wild character routines