]> git.saurik.com Git - wxWidgets.git/blobdiff - src/os2/utilsgui.cpp
move code ignoring VK_SPACE and VK_RETURN WM_CHAR messages to MSWDefWindowProc()...
[wxWidgets.git] / src / os2 / utilsgui.cpp
index 492cfa2e61d743bba45a2be2e3f347bcc0ed16ec..a48d2a09369511990a0a8d185dfaa199895e5015 100644 (file)
@@ -31,6 +31,9 @@
     #include "wx/cursor.h"
 #endif //WX_PRECOMP
 
+#include "wx/apptrait.h"
+#include "wx/timer.h"
+
 #include "wx/os2/private.h"     // includes <windows.h>
 
 // ============================================================================
@@ -54,8 +57,6 @@ public:
     }
 };
 
-static wxTimer*                     wxTheSleepTimer = NULL;
-
 // Reading and writing resources (eg WIN.INI, .Xdefaults)
 #if wxUSE_RESOURCES
 bool wxWriteResource(
@@ -332,7 +333,6 @@ bool wxCheckForInterrupt(
         QMSG                        vMsg;
         HAB                         hab = 0;
         HWND                        hwndFilter = NULLHANDLE;
-        HWND                        hwndWin= (HWND) pWnd->GetHWND();
 
         while(::WinPeekMsg(hab, &vMsg, hwndFilter, 0, 0, PM_REMOVE))
         {
@@ -470,6 +470,42 @@ void wxClientDisplayRect(int *x, int *y, int *width, int *height)
     wxDisplaySize(width, height);
 }
 
+void wxGUIAppTraits::InitializeGui(unsigned long &ulHab)
+{
+    ulHab = ::WinInitialize(0);
+}
+
+void wxGUIAppTraits::TerminateGui(unsigned long ulHab)
+{
+    ::WinTerminate(ulHab);
+}
+
+wxToolkitInfo & wxGUIAppTraits::GetToolkitInfo()
+{
+    static wxToolkitInfo           vInfo;
+    ULONG                           ulSysInfo[QSV_MAX] = {0};
+    APIRET                          ulrc;
+
+    vInfo.shortName = _T("PM");
+    vInfo.name = _T("wxOS2");
+#ifdef __WXUNIVERSAL__
+    vInfo.shortName << _T("univ");
+    vInfo.name << _T("/wxUniversal");
+#endif
+    ulrc = ::DosQuerySysInfo( 1L
+                             ,QSV_MAX
+                             ,(PVOID)ulSysInfo
+                             ,sizeof(ULONG) * QSV_MAX
+                            );
+    if (ulrc == 0L)
+    {
+        vInfo.versionMajor = ulSysInfo[QSV_VERSION_MAJOR] / 10;
+        vInfo.versionMinor = ulSysInfo[QSV_VERSION_MINOR];
+    }
+    vInfo.os = wxOS2_PM;
+    return vInfo;
+}
+
 // ---------------------------------------------------------------------------
 // window information functions
 // ---------------------------------------------------------------------------
@@ -479,10 +515,12 @@ wxString WXDLLEXPORT wxGetWindowText(
 )
 {
     wxString                        vStr;
-    long                            lLen = ::WinQueryWindowTextLength((HWND)hWnd) + 1;
 
-    ::WinQueryWindowText((HWND)hWnd, lLen, vStr.GetWriteBuf((int)lLen));
-    vStr.UngetWriteBuf();
+    if ( hWnd )
+    {
+       long                lLen = ::WinQueryWindowTextLength((HWND)hWnd) + 1;
+       ::WinQueryWindowText((HWND)hWnd, lLen, wxStringBuffer(vStr, lLen));
+    }
 
     return vStr;
 }
@@ -492,22 +530,24 @@ wxString WXDLLEXPORT wxGetWindowClass(
 )
 {
     wxString                        vStr;
-    int                             nLen = 256; // some starting value
-
-    for ( ;; )
+    if ( hWnd )
     {
-        int                         nCount = ::WinQueryClassName((HWND)hWnd, nLen, vStr.GetWriteBuf(nLen));
-
-        vStr.UngetWriteBuf();
-        if (nCount == nLen )
-        {
-            // the class name might have been truncated, retry with larger
-            // buffer
-            nLen *= 2;
-        }
-        else
-        {
-            break;
+        int                         nLen = 256; // some starting value
+
+       for ( ;; )
+       {
+           int                     nCount = ::WinQueryClassName((HWND)hWnd, nLen, wxStringBuffer(vStr, nLen));
+
+           if (nCount == nLen )
+           {
+               // the class name might have been truncated, retry with larger
+               // buffer
+               nLen *= 2;
+           }
+           else
+           {
+               break;
+           }
         }
     }
     return vStr;