comparison os2/dw.c @ 1686:35c5314083a7

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.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Mon, 30 Apr 2012 16:22:03 +0000
parents b09f5f73189c
children 831aa3a679e6
comparison
equal deleted inserted replaced
1685:96fcc01693cf 1686:35c5314083a7
2032 2032
2033 if(blah && blah->oldproc) 2033 if(blah && blah->oldproc)
2034 { 2034 {
2035 PFNWP myfunc = blah->oldproc; 2035 PFNWP myfunc = blah->oldproc;
2036 2036
2037 return myfunc(hWnd, msg, mp1, mp2); 2037 switch(msg)
2038 {
2039 case WM_PAINT:
2040 {
2041 HPS hpsPaint;
2042 RECTL rclPaint;
2043 int len = WinQueryWindowTextLength(hWnd);
2044 ULONG style = WinQueryWindowULong(hWnd, QWL_STYLE) & (DT_TOP|DT_VCENTER|DT_BOTTOM|DT_LEFT|DT_CENTER|DT_RIGHT|DT_WORDBREAK);
2045 char *tempbuf = alloca(len + 2);
2046 ULONG fcolor = DT_TEXTATTRS, bcolor = DT_TEXTATTRS;
2047
2048 WinQueryWindowText(hWnd, len + 1, (PSZ)tempbuf);
2049
2050 hpsPaint = WinBeginPaint(hWnd, 0, 0);
2051 WinQueryWindowRect(hWnd, &rclPaint);
2052 if(WinQueryPresParam(hWnd, PP_BACKGROUNDCOLOR, 0, NULL, sizeof(bcolor), &bcolor, QPF_NOINHERIT) ||
2053 WinQueryPresParam(hWnd, PP_BACKGROUNDCOLORINDEX, 0, NULL, sizeof(bcolor), &bcolor, QPF_NOINHERIT))
2054 GpiSetBackColor(hpsPaint, bcolor);
2055 if(WinQueryPresParam(hWnd, PP_FOREGROUNDCOLOR, 0, NULL, sizeof(fcolor), &fcolor, QPF_NOINHERIT) ||
2056 WinQueryPresParam(hWnd, PP_FOREGROUNDCOLORINDEX, 0, NULL, sizeof(fcolor), &fcolor, QPF_NOINHERIT))
2057 GpiSetColor(hpsPaint, fcolor);
2058 WinDrawText(hpsPaint, -1, tempbuf, &rclPaint, DT_TEXTATTRS, DT_TEXTATTRS, style | DT_TEXTATTRS | DT_ERASERECT);
2059 WinEndPaint(hpsPaint);
2060 return (MRESULT)TRUE;
2061 }
2062 default:
2063 return myfunc(hWnd, msg, mp1, mp2);
2064 }
2038 } 2065 }
2039 2066
2040 return WinDefWindowProc(hWnd, msg, mp1, mp2); 2067 return WinDefWindowProc(hWnd, msg, mp1, mp2);
2041 } 2068 }
2042 2069