Mercurial > dwindows
comparison os2/dw.c @ 1789:a640714f9087
Fix handling the DW_DT_WORDBREAK flag on OS/2 to cause static text to word wrap.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Sat, 04 Aug 2012 01:14:17 +0000 |
parents | 86ace55df07b |
children | b0bdec1b820c |
comparison
equal
deleted
inserted
replaced
1788:9d499b162fe1 | 1789:a640714f9087 |
---|---|
1614 WinQueryPresParam(hWnd, PP_BACKGROUNDCOLORINDEX, 0, NULL, sizeof(bcolor), &bcolor, QPF_NOINHERIT)) | 1614 WinQueryPresParam(hWnd, PP_BACKGROUNDCOLORINDEX, 0, NULL, sizeof(bcolor), &bcolor, QPF_NOINHERIT)) |
1615 GpiSetBackColor(hpsPaint, bcolor); | 1615 GpiSetBackColor(hpsPaint, bcolor); |
1616 if(WinQueryPresParam(hWnd, PP_FOREGROUNDCOLOR, 0, NULL, sizeof(fcolor), &fcolor, QPF_NOINHERIT) || | 1616 if(WinQueryPresParam(hWnd, PP_FOREGROUNDCOLOR, 0, NULL, sizeof(fcolor), &fcolor, QPF_NOINHERIT) || |
1617 WinQueryPresParam(hWnd, PP_FOREGROUNDCOLORINDEX, 0, NULL, sizeof(fcolor), &fcolor, QPF_NOINHERIT)) | 1617 WinQueryPresParam(hWnd, PP_FOREGROUNDCOLORINDEX, 0, NULL, sizeof(fcolor), &fcolor, QPF_NOINHERIT)) |
1618 GpiSetColor(hpsPaint, fcolor); | 1618 GpiSetColor(hpsPaint, fcolor); |
1619 WinDrawText(hpsPaint, -1, (PCH)tempbuf, &rclPaint, DT_TEXTATTRS, DT_TEXTATTRS, style | DT_TEXTATTRS | DT_ERASERECT); | 1619 if(style & DT_WORDBREAK) |
1620 { | |
1621 int thisheight; | |
1622 LONG drawn, totaldrawn = 0; | |
1623 | |
1624 dw_font_text_extents_get(hWnd, NULL, tempbuf, NULL, &thisheight); | |
1625 | |
1626 /* until all chars drawn */ | |
1627 for(; totaldrawn != len; rclPaint.yTop -= thisheight) | |
1628 { | |
1629 /* draw the text */ | |
1630 drawn = WinDrawText(hpsPaint, len - totaldrawn, (PCH)tempbuf + totaldrawn, | |
1631 &rclPaint, DT_TEXTATTRS, DT_TEXTATTRS, style | DT_TEXTATTRS | DT_ERASERECT); | |
1632 if(drawn) | |
1633 totaldrawn += drawn; | |
1634 else | |
1635 break; | |
1636 } | |
1637 } | |
1638 else | |
1639 WinDrawText(hpsPaint, -1, (PCH)tempbuf, &rclPaint, DT_TEXTATTRS, DT_TEXTATTRS, style | DT_TEXTATTRS | DT_ERASERECT); | |
1620 } | 1640 } |
1621 | 1641 |
1622 /* Function: BubbleProc | 1642 /* Function: BubbleProc |
1623 * Abstract: Subclass procedure for bubble help | 1643 * Abstract: Subclass procedure for bubble help |
1624 */ | 1644 */ |
6490 */ | 6510 */ |
6491 HWND API dw_entryfield_new(char *text, ULONG id) | 6511 HWND API dw_entryfield_new(char *text, ULONG id) |
6492 { | 6512 { |
6493 | 6513 |
6494 WindowData *blah = calloc(1, sizeof(WindowData)); | 6514 WindowData *blah = calloc(1, sizeof(WindowData)); |
6515 ENTRYFDATA efd = { sizeof(ENTRYFDATA), 32000, 0, 0 }; | |
6495 HWND tmp = WinCreateWindow(HWND_OBJECT, | 6516 HWND tmp = WinCreateWindow(HWND_OBJECT, |
6496 WC_ENTRYFIELD, | 6517 WC_ENTRYFIELD, |
6497 (PSZ)text, | 6518 (PSZ)text, |
6498 WS_VISIBLE | ES_MARGIN | | 6519 WS_VISIBLE | ES_MARGIN | |
6499 ES_AUTOSCROLL | WS_TABSTOP, | 6520 ES_AUTOSCROLL | WS_TABSTOP, |
6500 0,0,2000,1000, | 6521 0,0,2000,1000, |
6501 NULLHANDLE, | 6522 NULLHANDLE, |
6502 HWND_TOP, | 6523 HWND_TOP, |
6503 id, | 6524 id, |
6504 NULL, | 6525 (PVOID)&efd, |
6505 NULL); | 6526 NULL); |
6506 blah->oldproc = WinSubclassWindow(tmp, _entryproc); | 6527 blah->oldproc = WinSubclassWindow(tmp, _entryproc); |
6507 WinSetWindowPtr(tmp, QWP_USER, blah); | 6528 WinSetWindowPtr(tmp, QWP_USER, blah); |
6508 dw_window_set_font(tmp, DefaultFont); | 6529 dw_window_set_font(tmp, DefaultFont); |
6509 dw_window_set_color(tmp, DW_CLR_BLACK, DW_CLR_WHITE); | 6530 dw_window_set_color(tmp, DW_CLR_BLACK, DW_CLR_WHITE); |