]> git.saurik.com Git - wxWidgets.git/blobdiff - src/os2/window.cpp
Last correction for makefile.g95: win32 mkdir does not like forward slashes as directory
[wxWidgets.git] / src / os2 / window.cpp
index 70e3b0958e5aeb6981ea452808b4b79023b12503..846ed5696f5a2c0a5ae410293f3b9b9bfeba781c 100644 (file)
@@ -388,37 +388,12 @@ bool wxWindowOS2::Create(
 
         pParent->AddChild(this);
         hParent = GetWinHwnd(pParent);
 
         pParent->AddChild(this);
         hParent = GetWinHwnd(pParent);
-        //
-        // OS2 uses normal coordinates, no bassackwards Windows ones
-        //
-        if (pParent->IsKindOf(CLASSINFO(wxGenericScrolledWindow)) ||
-            pParent->IsKindOf(CLASSINFO(wxScrolledWindow))
-           )
-        {
-            wxWindow*               pGrandParent = NULL;
 
 
-            pGrandParent = pParent->GetParent();
-            if (pGrandParent)
-                nTempy = pGrandParent->GetSize().y - (vPos.y + rSize.y);
-            else
-                nTempy = pParent->GetSize().y - (vPos.y + rSize.y);
-        }
-        else
-            nTempy = pParent->GetSize().y - (vPos.y + rSize.y);
-        vPos.y = nTempy;
         if ( pParent->IsKindOf(CLASSINFO(wxGenericScrolledWindow)) ||
              pParent->IsKindOf(CLASSINFO(wxScrolledWindow))
            )
             ulCreateFlags |= WS_CLIPSIBLINGS;
     }
         if ( pParent->IsKindOf(CLASSINFO(wxGenericScrolledWindow)) ||
              pParent->IsKindOf(CLASSINFO(wxScrolledWindow))
            )
             ulCreateFlags |= WS_CLIPSIBLINGS;
     }
-    else
-    {
-        RECTL                   vRect;
-
-        ::WinQueryWindowRect(HWND_DESKTOP, &vRect);
-        hParent = HWND_DESKTOP;
-        vPos.y = vRect.yTop - (vPos.y + rSize.y);
-    }
 
     //
     // Most wxSTYLES are really PM Class specific styles and will be
 
     //
     // Most wxSTYLES are really PM Class specific styles and will be
@@ -614,10 +589,72 @@ bool wxWindowOS2::SetFont(
 
     if (hWnd != 0)
     {
 
     if (hWnd != 0)
     {
-        wxChar                      zFont[128];
+        char                        zFont[128];
+        char                        zFacename[30];
+        char                        zWeight[30];
+        char                        zStyle[30];
+
+        //
+        // The fonts available for Presentation Params are just three
+        // outline fonts, the rest are available to the GPI, so we must
+        // map the families to one of these three
+        //
+        switch(rFont.GetFamily())
+        {
+            case wxSCRIPT:
+            case wxDECORATIVE:
+            case wxROMAN:
+                strcpy(zFacename,"Times New Roman");
+                break;
+
+            case wxTELETYPE:
+            case wxMODERN:
+                strcpy(zFacename, "Courier");
+                break;
+
+            case wxSWISS:
+            case wxDEFAULT:
+            default:
+                strcpy(zFacename, "Helvetica");
+                break;
+        }
+
+        switch(rFont.GetWeight())
+        {
+            default:
+            case wxNORMAL:
+            case wxLIGHT:
+                zWeight[0] = '\0';
+                break;
 
 
-        sprintf(zFont, "%d.%s", rFont.GetPointSize(), rFont.GetFaceName().c_str());
-        return (bool)::WinSetPresParam(hWnd, PP_FONTNAMESIZE, strlen(zFont), (PVOID)zFont);
+            case wxBOLD:
+            case wxFONTWEIGHT_MAX:
+                strcpy(zWeight, "Bold");
+                break;
+        }
+        switch(rFont.GetStyle())
+        {
+            case wxITALIC:
+            case wxSLANT:
+                strcpy(zStyle, "Italic");
+                break;
+
+            default:
+                zStyle[0] = '\0';
+                break;
+        }
+        sprintf(zFont, "%d.%s", rFont.GetPointSize(), zFacename);
+        if (zWeight[0] != '\0')
+        {
+            strcat(zFont, " ");
+            strcat(zFont, zWeight);
+        }
+        if (zStyle[0] != '\0')
+        {
+            strcat(zFont, " ");
+            strcat(zFont, zStyle);
+        }
+        ::WinSetPresParam(hWnd, PP_FONTNAMESIZE, strlen(zFont) + 1, (PVOID)zFont);
     }
     return(TRUE);
 }
     }
     return(TRUE);
 }
@@ -1373,49 +1410,36 @@ void wxWindowOS2::DoGetPosition(
 ) const
 {
     HWND                            hWnd = GetHwnd();
 ) const
 {
     HWND                            hWnd = GetHwnd();
-    RECT                            vRect;
+    SWP                             vSwp;
     POINTL                          vPoint;
     POINTL                          vPoint;
+    wxWindow*                       pParent = GetParent();
 
 
-    ::WinQueryWindowRect(hWnd, &vRect);
+    //
+    // It would seem that WinQueryWindowRect would be the correlary to
+    // the WIN32 WinGetRect, but unlike WinGetRect which returns the window
+    // origin position in screen coordinates, WinQueryWindowRect returns it
+    // relative to itself, i.e. (0,0).  To get the same under PM we must
+    // us WinQueryWindowPos.  This call, unlike the WIN32 call, however,
+    // returns a position relative to it's parent, so no parent adujstments
+    // are needed under OS/2.  Also, windows should be created using
+    // wxWindow coordinates, i.e 0,0 is the TOP left so vSwp will already
+    // reflect that.
+    //
+    ::WinQueryWindowPos(hWnd, &vSwp);
 
 
-    vPoint.x = vRect.xLeft;
-    vPoint.y = vRect.yBottom;
+    vPoint.x = vSwp.x;
+    vPoint.y = vSwp.y;
 
     //
 
     //
-    // We do the adjustments with respect to the parent only for the "real"
-    // children, not for the dialogs/frames
+    // We may be faking the client origin. So a window that's really at (0,
+    // 30) may appear (to wxWin apps) to be at (0, 0).
     //
     //
-    if (!IsTopLevel())
+    if (pParent)
     {
     {
-        HWND                        hParentWnd = 0;
-        wxWindow*                   pParent = GetParent();
-
-        if (pParent)
-            hParentWnd = GetWinHwnd(pParent);
+        wxPoint                     vPt(pParent->GetClientAreaOrigin());
 
 
-        //
-        // Since we now have the absolute screen coords, if there's a parent we
-        // must subtract its bottom left corner
-        //
-        if (hParentWnd)
-        {
-            RECTL                   vRect2;
-
-            ::WinQueryWindowRect(hParentWnd, &vRect2);
-            vPoint.x -= vRect.xLeft;
-            vPoint.y -= vRect.yBottom;
-        }
-
-        //
-        // We may be faking the client origin. So a window that's really at (0,
-        // 30) may appear (to wxWin apps) to be at (0, 0).
-        //
-        if (pParent) {
-            wxPoint                     vPt(pParent->GetClientAreaOrigin());
-
-            vPoint.x -= vPt.x;
-            vPoint.y -= vPt.y;
-        }
+        vPoint.x -= vPt.x;
+        vPoint.y -= vPt.y;
     }
 
     if (pX)
     }
 
     if (pX)
@@ -1430,18 +1454,14 @@ void wxWindowOS2::DoScreenToClient(
 ) const
 {
     HWND                            hWnd = GetHwnd();
 ) const
 {
     HWND                            hWnd = GetHwnd();
-    POINTL                          ptl;
-
-    ptl.x = pX ? *pX : 0;
-    ptl.y = pY ? *pY : 0;
+    SWP                             vSwp;
 
 
-    ::WinMapWindowPoints(HWND_DESKTOP, hWnd, &ptl, 1);
+    ::WinQueryWindowPos(hWnd, &vSwp);
 
     if (pX)
 
     if (pX)
-        *pX = ptl.x;
+        *pX += vSwp.x;
     if (pY)
     if (pY)
-        *pY = ptl.y;
-
+        *pY += vSwp.y;
 } // end of wxWindowOS2::DoScreenToClient
 
 void wxWindowOS2::DoClientToScreen(
 } // end of wxWindowOS2::DoScreenToClient
 
 void wxWindowOS2::DoClientToScreen(
@@ -1450,17 +1470,14 @@ void wxWindowOS2::DoClientToScreen(
 ) const
 {
     HWND                            hWnd = GetHwnd();
 ) const
 {
     HWND                            hWnd = GetHwnd();
-    POINTL                          ptl;
-
-    ptl.x = pX ? *pX : 0;
-    ptl.y = pY ? *pY : 0;
+    SWP                             vSwp;
 
 
-    ::WinMapWindowPoints(hWnd, HWND_DESKTOP, &ptl, 1);
+    ::WinQueryWindowPos(hWnd, &vSwp);
 
     if (pX)
 
     if (pX)
-        *pX = ptl.x;
+        *pX += vSwp.x;
     if (pY)
     if (pY)
-        *pY = ptl.y;
+        *pY += vSwp.y;
 } // end of wxWindowOS2::DoClientToScreen
 
 //
 } // end of wxWindowOS2::DoClientToScreen
 
 //
@@ -1498,29 +1515,41 @@ void wxWindowOS2::DoMoveWindow(
 , int                               nHeight
 )
 {
 , int                               nHeight
 )
 {
-#if 0 // x and y coords should already be in os2 coordinates
     RECTL                           vRect;
     HWND                            hParent;
     wxWindow*                       pParent = GetParent();
 
     if (pParent)
     RECTL                           vRect;
     HWND                            hParent;
     wxWindow*                       pParent = GetParent();
 
     if (pParent)
+    {
         hParent = GetWinHwnd(pParent);
         hParent = GetWinHwnd(pParent);
+        if (pParent->IsKindOf(CLASSINFO(wxFrame)))
+        {
+            if (IsKindOf(CLASSINFO(wxStatusBar)) ||
+                IsKindOf(CLASSINFO(wxMenuBar)) ||
+                IsKindOf(CLASSINFO(wxToolBar))
+               )
+                nY = pParent->GetSize().y - (nY + nHeight);
+            else
+                nY = pParent->GetClientSize().y - (nY + nHeight);
+        }
+        else
+            nY = pParent->GetSize().y - (nY + nHeight);
+    }
     else
     else
-        hParent = HWND_DESKTOP;
-    ::WinQueryWindowRect(hParent, &vRect);
-    nY = vRect.yTop - (nY + nHeight);
-#endif
-    if ( !::WinSetWindowPos( GetHwnd()
-                            ,HWND_TOP
-                            ,(LONG)nX
-                            ,(LONG)nY
-                            ,(LONG)nWidth
-                            ,(LONG)nHeight
-                            ,SWP_SIZE | SWP_MOVE
-                           ))
     {
     {
-        wxLogLastError("MoveWindow");
+        RECTL                       vRect;
+
+        ::WinQueryWindowRect(HWND_DESKTOP, &vRect);
+        nY = vRect.yTop - (nY + nHeight);
     }
     }
+    ::WinSetWindowPos( GetHwnd()
+                      ,HWND_TOP
+                      ,(LONG)nX
+                      ,(LONG)nY
+                      ,(LONG)nWidth
+                      ,(LONG)nHeight
+                      ,SWP_ZORDER | SWP_SIZE | SWP_MOVE | SWP_SHOW
+                     );
 } // end of wxWindowOS2::DoMoveWindow
 
 //
 } // end of wxWindowOS2::DoMoveWindow
 
 //
@@ -1614,79 +1643,28 @@ void wxWindowOS2::DoSetClientSize(
 {
     wxWindow*                       pParent = GetParent();
     HWND                            hWnd = GetHwnd();
 {
     wxWindow*                       pParent = GetParent();
     HWND                            hWnd = GetHwnd();
-#if 0
     HWND                            hParentWnd = (HWND)0;
     HWND                            hParentWnd = (HWND)0;
-    HWND                            hClientWnd = (HWND)0;
+    POINTL                          vPoint;
     RECTL                           vRect;
     RECTL                           vRect;
-    RECT                            vRect2;
-    RECT                            vRect3;
+    RECTL                           vRect2;
+    RECTL                           vRect3;
+    HWND                            hClientWnd = (HWND)0;
 
 
-    hClientWnd = ::WinWindowFromID(GetHwnd(), FID_CLIENT);
+    hClientWnd = ::WinWindowFromID(hWnd, FID_CLIENT);
     ::WinQueryWindowRect(hClientWnd, &vRect2);
     ::WinQueryWindowRect(hClientWnd, &vRect2);
-
-    if (pParent)
-        hParentWnd = (HWND) pParent->GetHWND();
-
     ::WinQueryWindowRect(hWnd, &vRect);
     ::WinQueryWindowRect(hParentWnd, &vRect3);
     ::WinQueryWindowRect(hWnd, &vRect);
     ::WinQueryWindowRect(hParentWnd, &vRect3);
-    //
-    // Find the difference between the entire window (title bar and all)
-    // and the client area; add this to the new client size to move the
-    // window. OS/2 is backward from windows on height
-    //
+
     int                             nActualWidth = vRect2.xRight - vRect2.xLeft - vRect.xRight + nWidth;
     int                             nActualHeight = vRect2.yTop - vRect2.yBottom - vRect.yTop + nHeight;
 
     int                             nActualWidth = vRect2.xRight - vRect2.xLeft - vRect.xRight + nWidth;
     int                             nActualHeight = vRect2.yTop - vRect2.yBottom - vRect.yTop + nHeight;
 
-    //
-    // If there's a parent, must subtract the parent's bottom left corner
-    // since MoveWindow moves relative to the parent
-    //
-    POINTL                          vPoint;
-
     vPoint.x = vRect2.xLeft;
     vPoint.y = vRect2.yBottom;
     if (pParent)
     vPoint.x = vRect2.xLeft;
     vPoint.y = vRect2.yBottom;
     if (pParent)
-    {             x
+    {
         vPoint.x -= vRect3.xLeft;
         vPoint.y -= vRect3.yBottom;
     }
         vPoint.x -= vRect3.xLeft;
         vPoint.y -= vRect3.yBottom;
     }
-#else
-    HWND                            hParentWnd = (HWND)0;
-    HWND                            hClientWnd = (HWND)0;
-    RECTL                           vRect;
-    RECT                            vRect2;
-
-    hClientWnd = ::WinWindowFromID(GetHwnd(), FID_CLIENT);
-    ::WinQueryWindowRect(hClientWnd, &vRect2);
-    ::WinQueryWindowRect(hWnd, &vRect2);
-
-    if (pParent)
-        hParentWnd = (HWND) pParent->GetHWND();
-
-    ::WinQueryWindowRect(hWnd, &vRect);
-    //
-    // Find the difference between the entire window (title bar and all)
-    // and the client area; add this to the new client size to move the
-    // window. OS/2 is backward from windows on height
-    //
-    int nActualWidth  = vRect2.xRight - vRect2.xLeft - vRect.xRight + nWidth;
-    int nActualHeight = vRect2.yTop - vRect2.yBottom - vRect.yTop + nHeight;
-
-    nActualWidth  = nWidth;
-    nActualHeight = nHeight;
-    //
-    // If there's a parent, must subtract the parent's bottom left corner
-    // since MoveWindow moves relative to the parent
-    //
-    POINTL                          vPoint;
-
-    vPoint.x = vRect2.xLeft;
-    vPoint.y = vRect2.yBottom;
-    if (pParent)
-    {
-        ::WinMapWindowPoints(hWnd, hParentWnd, &vPoint, 1);
-    }
-#endif
 
     DoMoveWindow(vPoint.x, vPoint.y, nActualWidth, nActualHeight);
 
 
     DoMoveWindow(vPoint.x, vPoint.y, nActualWidth, nActualHeight);
 
@@ -1745,55 +1723,94 @@ void wxWindowOS2::GetTextExtent(
 , const wxFont*                     pTheFont
 ) const
 {
 , const wxFont*                     pTheFont
 ) const
 {
-    const wxFont*                   pFontToUse = pTheFont;
-    HPS                             hPs;
-
-    hPs = ::WinGetPS(GetHwnd());
+    POINTL                          avPoint[TXTBOX_COUNT];
+    POINTL                          vPtMin;
+    POINTL                          vPtMax;
+    int                             i;
+    int                             l;
+    FONTMETRICS                     vFM; // metrics structure
+    BOOL                            bRc;
+    char*                           pStr;
+    ERRORID                         vErrorCode; // last error id code
+    HPS                             hPS;
 
 
-    // Just prevent compiler warnings
-    wxString dummy = rString;
-    pX = pX;
-    pY = pY;
-    pDescent = pDescent;
-    pExternalLeading = pExternalLeading;
-/*
-// TODO: Will have to play with fonts later
 
 
-    if (!pFontToUse)
-        pFontToUse = &m_font;
+    hPS = ::WinGetPS(GetHwnd());
 
 
-    HFONT                           hFnt = 0;
-    HFONT                           hFfontOld = 0;
+    l = rString.Length();
+    if (l > 0L)
+    {
+        pStr = (PCH)rString.c_str();
 
 
-    if (pFontToUse && pFontToUse->Ok())
+        //
+        // In world coordinates.
+        //
+        bRc = ::GpiQueryTextBox( hPS
+                                ,l
+                                ,pStr
+                                ,TXTBOX_COUNT // return maximum information
+                                ,avPoint      // array of coordinates points
+                               );
+        if (bRc)
+        {
+            vPtMin.x = avPoint[0].x;
+            vPtMax.x = avPoint[0].x;
+            vPtMin.y = avPoint[0].y;
+            vPtMax.y = avPoint[0].y;
+            for (i = 1; i < 4; i++)
+            {
+                if(vPtMin.x > avPoint[i].x) vPtMin.x = avPoint[i].x;
+                if(vPtMin.y > avPoint[i].y) vPtMin.y = avPoint[i].y;
+                if(vPtMax.x < avPoint[i].x) vPtMax.x = avPoint[i].x;
+                if(vPtMax.y < avPoint[i].y) vPtMax.y = avPoint[i].y;
+            }
+            bRc = ::GpiQueryFontMetrics( hPS
+                                        ,sizeof(FONTMETRICS)
+                                        ,&vFM
+                                       );
+            if (!bRc)
+            {
+                vPtMin.x = 0;
+                vPtMin.y = 0;
+                vPtMax.x = 0;
+                vPtMax.y = 0;
+            }
+        }
+        else
+        {
+            vPtMin.x = 0;
+            vPtMin.y = 0;
+            vPtMax.x = 0;
+            vPtMax.y = 0;
+        }
+    }
+    else
     {
     {
-        ::GpiCreateLog
-        hFnt = (HFONT)((wxFont *)pFontToUse)->GetResourceHandle(); // const_cast
-        if (hFnt)
-            hFontOld = (HFONT)SelectObject(dc,fnt);
+        vPtMin.x = 0;
+        vPtMin.y = 0;
+        vPtMax.x = 0;
+        vPtMax.y = 0;
     }
     }
-
-    SIZE sizeRect;
-    TEXTMETRIC tm;
-    GetTextExtentPoint(dc, string, (int)string.Length(), &sizeRect);
-    GetTextMetrics(dc, &tm);
-
-    if ( fontToUse && fnt && hfontOld )
-        SelectObject(dc, hfontOld);
-
-    ReleaseDC(hWnd, dc);
-
-    if ( x )
-        *x = sizeRect.cx;
-    if ( y )
-        *y = sizeRect.cy;
-    if ( descent )
-        *descent = tm.tmDescent;
-    if ( externalLeading )
-        *externalLeading = tm.tmExternalLeading;
-*/
-    ::WinReleasePS(hPs);
-}
+    if (pX)
+        *pX = (vPtMax.x - vPtMin.x + 1);
+    if (pY)
+        *pY = (vPtMax.y - vPtMin.y + 1);
+    if (pDescent)
+    {
+        if (bRc)
+            *pDescent = vFM.lMaxDescender;
+        else
+            *pDescent = 0;
+    }
+    if (pExternalLeading)
+    {
+        if (bRc)
+            *pExternalLeading = vFM.lExternalLeading;
+        else
+            *pExternalLeading = 0;
+    }
+    ::WinReleasePS(hPS);
+} // end of wxWindow::GetTextExtent
 
 #if wxUSE_CARET && WXWIN_COMPATIBILITY
 // ---------------------------------------------------------------------------
 
 #if wxUSE_CARET && WXWIN_COMPATIBILITY
 // ---------------------------------------------------------------------------
@@ -2448,7 +2465,7 @@ MRESULT wxWindowOS2::OS2WindowProc(
                 if (uKeyFlags & KC_KEYUP)
                 {
                     //TODO: check if the cast to WXWORD isn't causing trouble
                 if (uKeyFlags & KC_KEYUP)
                 {
                     //TODO: check if the cast to WXWORD isn't causing trouble
-                    bProcessed = HandleKeyUp((WXWORD)wParam, lParam);
+                    bProcessed = HandleKeyUp((WXDWORD)wParam, lParam);
                     break;
                 }
                 else // keydown event
                     break;
                 }
                 else // keydown event
@@ -2458,7 +2475,7 @@ MRESULT wxWindowOS2::OS2WindowProc(
                     // return 0 now (we've handled it). DON't RETURN
                     // we still need to process further
                     //
                     // return 0 now (we've handled it). DON't RETURN
                     // we still need to process further
                     //
-                    HandleKeyDown((WXWORD)wParam, lParam);
+                    HandleKeyDown((WXDWORD)wParam, lParam);
                     if (uKeyFlags & KC_VIRTUALKEY)
                     {
                         USHORT          uVk = SHORT2FROMMP((MPARAM)lParam);
                     if (uKeyFlags & KC_VIRTUALKEY)
                     {
                         USHORT          uVk = SHORT2FROMMP((MPARAM)lParam);
@@ -2492,13 +2509,13 @@ MRESULT wxWindowOS2::OS2WindowProc(
                             case VK_DOWN:
                             case VK_UP:
                             default:
                             case VK_DOWN:
                             case VK_UP:
                             default:
-                                bProcessed = HandleChar((WXWORD)wParam, lParam);
+                                bProcessed = HandleChar((WXDWORD)wParam, lParam);
                          }
                          break;
                     }
                     else // WM_CHAR -- Always an ASCII character
                     {
                          }
                          break;
                     }
                     else // WM_CHAR -- Always an ASCII character
                     {
-                        bProcessed = HandleChar((WXWORD)wParam, lParam, TRUE);
+                        bProcessed = HandleChar((WXDWORD)wParam, lParam, TRUE);
                         break;
                     }
                 }
                         break;
                     }
                 }
@@ -2542,20 +2559,6 @@ MRESULT wxWindowOS2::OS2WindowProc(
             mResult = (MRESULT)(FALSE);
             break;
 
             mResult = (MRESULT)(FALSE);
             break;
 
-        //
-        // Instead of CTLCOLOR messages PM sends QUERYWINDOWPARAMS to
-        // things such as colors and fonts and such
-        //
-        case WM_QUERYWINDOWPARAMS:
-            {
-                PWNDPARAMS          pWndParams = (PWNDPARAMS)wParam;
-
-                bProcessed = HandleWindowParams( pWndParams
-                                                ,lParam
-                                               );
-            }
-            break;
-
             // the return value for this message is ignored
         case WM_SYSCOLORCHANGE:
             bProcessed = HandleSysColorChange();
             // the return value for this message is ignored
         case WM_SYSCOLORCHANGE:
             bProcessed = HandleSysColorChange();
@@ -2565,11 +2568,6 @@ MRESULT wxWindowOS2::OS2WindowProc(
             bProcessed = HandlePaletteChanged();
             break;
 
             bProcessed = HandlePaletteChanged();
             break;
 
-        case WM_PRESPARAMCHANGED:
-            bProcessed = HandlePresParamChanged(wParam);
-            break;
-
-
         // move all drag and drops to wxDrg
         case WM_ENDDRAG:
             bProcessed = HandleEndDrag(wParam);
         // move all drag and drops to wxDrg
         case WM_ENDDRAG:
             bProcessed = HandleEndDrag(wParam);
@@ -3282,14 +3280,6 @@ bool wxWindowOS2::HandleCtlColor(
     return TRUE;
 } // end of wxWindowOS2::HandleCtlColor
 
     return TRUE;
 } // end of wxWindowOS2::HandleCtlColor
 
-bool wxWindowOS2::HandleWindowParams(
-  PWNDPARAMS                        WXUNUSED(pWndParams)
-, WXLPARAM                          WXUNUSED(lParam)
-)
-{
-// TODO: I'll do something here, just not sure what yet
-    return TRUE;
-}
 
 // Define for each class of dialog and control
 WXHBRUSH wxWindowOS2::OnCtlColor(WXHDC WXUNUSED(hDC),
 
 // Define for each class of dialog and control
 WXHBRUSH wxWindowOS2::OnCtlColor(WXHDC WXUNUSED(hDC),
@@ -3315,21 +3305,6 @@ bool wxWindowOS2::HandlePaletteChanged()
     return GetEventHandler()->ProcessEvent(vEvent);
 } // end of wxWindowOS2::HandlePaletteChanged
 
     return GetEventHandler()->ProcessEvent(vEvent);
 } // end of wxWindowOS2::HandlePaletteChanged
 
-bool wxWindowOS2::HandlePresParamChanged(
-  WXWPARAM                          WXUNUSED(wParam)
-)
-{
-    //
-    // TODO:  Once again I'll do something here when I need it
-    //
-    //wxQueryNewPaletteEvent event(GetId());
-    //event.SetEventObject(this);
-    // if the background is erased
-//            bProcessed = HandleEraseBkgnd((WXHDC)(HDC)wParam);
-
-    return FALSE; //GetEventHandler()->ProcessEvent(event) && event.GetPaletteRealized();
-}
-
 //
 // Responds to colour changes: passes event on to children.
 //
 //
 // Responds to colour changes: passes event on to children.
 //
@@ -3385,65 +3360,6 @@ bool wxWindowOS2::HandlePaint()
     vEvent.SetEventObject(this);
     bProcessed = GetEventHandler()->ProcessEvent(vEvent);
 
     vEvent.SetEventObject(this);
     bProcessed = GetEventHandler()->ProcessEvent(vEvent);
 
-    if (!bProcessed)
-    {
-        HPS                         hPS;
-
-        hPS = ::WinBeginPaint( GetHwnd()
-                              ,NULLHANDLE
-                              ,&vRect
-                             );
-        if(hPS)
-        {
-#if 0
-            ::GpiCreateLogColorTable( hPS
-                                     ,0L
-                                     ,LCOLF_CONSECRGB
-                                     ,0L
-                                     ,(LONG)wxTheColourDatabase->m_nSize
-                                     ,(PLONG)wxTheColourDatabase->m_palTable
-                                    );
-#endif
-            ::GpiCreateLogColorTable( hPS
-                                     ,0L
-                                     ,LCOLF_RGB
-                                     ,0L
-                                     ,0L
-                                     ,NULL
-                                    );
-
-            ::WinFillRect(hPS, &vRect,  GetBackgroundColour().GetPixel());
-
-            if (m_dwExStyle)
-            {
-                LINEBUNDLE                      vLineBundle;
-
-                vLineBundle.lColor     = 0x00000000; // Black
-                vLineBundle.usMixMode  = FM_OVERPAINT;
-                vLineBundle.fxWidth    = 1;
-                vLineBundle.lGeomWidth = 1;
-                vLineBundle.usType     = LINETYPE_SOLID;
-                vLineBundle.usEnd      = 0;
-                vLineBundle.usJoin     = 0;
-                ::GpiSetAttrs( hPS
-                              ,PRIM_LINE
-                              ,LBB_COLOR | LBB_MIX_MODE | LBB_WIDTH | LBB_GEOM_WIDTH | LBB_TYPE
-                              ,0L
-                              ,&vLineBundle
-                             );
-                ::WinQueryWindowRect(GetHwnd(), &vRect);
-                wxDrawBorder( hPS
-                             ,vRect
-                             ,m_dwExStyle
-                            );
-            }
-            ::WinEndPaint(hPS);
-        }
-    }
-
-    ::GpiDestroyRegion(hPS, hRgn);
-    ::WinReleasePS(hPS);
-
     return GetEventHandler()->ProcessEvent(vEvent); //bProcessed;
 } // end of wxWindowOS2::HandlePaint
 
     return GetEventHandler()->ProcessEvent(vEvent); //bProcessed;
 } // end of wxWindowOS2::HandlePaint
 
@@ -3755,7 +3671,7 @@ wxKeyEvent wxWindowOS2::CreateKeyEvent(
 // WM_KEYDOWN one
 //
 bool wxWindowOS2::HandleChar(
 // WM_KEYDOWN one
 //
 bool wxWindowOS2::HandleChar(
-  WXWORD                            wParam
+  WXDWORD                           wParam
 , WXLPARAM                          lParam
 , bool                              isASCII
 )
 , WXLPARAM                          lParam
 , bool                              isASCII
 )
@@ -3849,7 +3765,7 @@ bool wxWindowOS2::HandleKeyDown(
 } // end of wxWindowOS2::HandleKeyDown
 
 bool wxWindowOS2::HandleKeyUp(
 } // end of wxWindowOS2::HandleKeyDown
 
 bool wxWindowOS2::HandleKeyUp(
-  WXWORD                            wParam
+  WXDWORD                           wParam
 , WXLPARAM                          lParam
 )
 {
 , WXLPARAM                          lParam
 )
 {
@@ -3946,13 +3862,34 @@ bool wxWindowOS2::OS2OnScroll(
 // ===========================================================================
 
 void wxGetCharSize(
 // ===========================================================================
 
 void wxGetCharSize(
-  WXHWND                            WXUNUSED(hWnd)
-, int*                              WXUNUSED(pX)
-, int*                              WXUNUSED(pY)
+  WXHWND                            hWnd
+, int*                              pX
+, int*                              pY
 ,wxFont*                            WXUNUSED(pTheFont)
 )
 {
 ,wxFont*                            WXUNUSED(pTheFont)
 )
 {
-  // TODO: we'll do this later
+    FONTMETRICS                     vFM;
+    HPS                             hPS;
+    BOOL                            rc;
+
+    hPS =::WinGetPS(hWnd);
+
+    rc = ::GpiQueryFontMetrics(hPS, sizeof(FONTMETRICS), &vFM);
+    if (rc)
+    {
+        if (pX)
+            *pX = vFM.lAveCharWidth;
+        if (pY)
+            *pY = vFM.lEmHeight + vFM.lExternalLeading;
+    }
+    else
+    {
+        if (pX)
+            *pX = 10;
+        if (pY)
+            *pY = 15;
+    }
+    ::WinReleasePS(hPS);
 } // end of wxGetCharSize
 
 //
 } // end of wxGetCharSize
 
 //