# HG changeset patch # User bsmith@81767d24-ef19-dc11-ae90-00e081727c95 # Date 1335802923 0 # Node ID 35c5314083a79abb8e2452ade1eb7253a7e5964c # Parent 96fcc01693cf0ed37e02fa38015a94bbf5626583 Initial verison of self-drawn static text control on OS/2. This works around Unicode issues with the system control. May need work to fill in the background color when set. diff -r 96fcc01693cf -r 35c5314083a7 os2/dw.c --- a/os2/dw.c Mon Apr 30 12:22:37 2012 +0000 +++ b/os2/dw.c Mon Apr 30 16:22:03 2012 +0000 @@ -2034,7 +2034,34 @@ { PFNWP myfunc = blah->oldproc; - return myfunc(hWnd, msg, mp1, mp2); + switch(msg) + { + case WM_PAINT: + { + HPS hpsPaint; + RECTL rclPaint; + int len = WinQueryWindowTextLength(hWnd); + ULONG style = WinQueryWindowULong(hWnd, QWL_STYLE) & (DT_TOP|DT_VCENTER|DT_BOTTOM|DT_LEFT|DT_CENTER|DT_RIGHT|DT_WORDBREAK); + char *tempbuf = alloca(len + 2); + ULONG fcolor = DT_TEXTATTRS, bcolor = DT_TEXTATTRS; + + WinQueryWindowText(hWnd, len + 1, (PSZ)tempbuf); + + hpsPaint = WinBeginPaint(hWnd, 0, 0); + WinQueryWindowRect(hWnd, &rclPaint); + if(WinQueryPresParam(hWnd, PP_BACKGROUNDCOLOR, 0, NULL, sizeof(bcolor), &bcolor, QPF_NOINHERIT) || + WinQueryPresParam(hWnd, PP_BACKGROUNDCOLORINDEX, 0, NULL, sizeof(bcolor), &bcolor, QPF_NOINHERIT)) + GpiSetBackColor(hpsPaint, bcolor); + if(WinQueryPresParam(hWnd, PP_FOREGROUNDCOLOR, 0, NULL, sizeof(fcolor), &fcolor, QPF_NOINHERIT) || + WinQueryPresParam(hWnd, PP_FOREGROUNDCOLORINDEX, 0, NULL, sizeof(fcolor), &fcolor, QPF_NOINHERIT)) + GpiSetColor(hpsPaint, fcolor); + WinDrawText(hpsPaint, -1, tempbuf, &rclPaint, DT_TEXTATTRS, DT_TEXTATTRS, style | DT_TEXTATTRS | DT_ERASERECT); + WinEndPaint(hpsPaint); + return (MRESULT)TRUE; + } + default: + return myfunc(hWnd, msg, mp1, mp2); + } } return WinDefWindowProc(hWnd, msg, mp1, mp2);