Use correct font for ownerdraw buttons
Michael Kaufmann
hallo at michael-kaufmann.ch
Mon Aug 16 17:06:31 CDT 2004
This patch fixes a font issue with buttons that have the BS_OWNERDRAW
style. It's necessary to select the font set by WM_SETFONT into the
device context before WM_DRAWITEM is sent. Windows does this too: It's
undocumented, but some custom controls (e.g. CButtonST) rely on this.
The other controls that support owner draw styles (combo box, list box,
menu) already do this correctly.
Changelog:
* controls/button.c:
Use correct font for ownerdraw buttons
diff -u -r1.72 button.c
--- controls/button.c 16 Aug 2004 20:00:41 -0000 1.72
+++ controls/button.c 16 Aug 2004 20:51:45 -0000
@@ -1035,6 +1035,7 @@
RECT clipRect;
UINT id = GetWindowLongA( hwnd, GWL_ID );
HWND parent;
+ HFONT hPrevFont;
dis.CtlType = ODT_BUTTON;
dis.CtlID = id;
@@ -1058,9 +1059,11 @@
DPtoLP(hDC, (LPPOINT) &clipRect, 2);
IntersectClipRect(hDC, clipRect.left, clipRect.top, clipRect.right, clipRect.bottom);
+ hPrevFont = (get_button_font(hwnd)) ? SelectObject(hDC, get_button_font(hwnd)) : 0;
parent = GetParent(hwnd);
if (!parent) parent = hwnd;
SendMessageW( parent, WM_CTLCOLORBTN, (WPARAM)hDC, (LPARAM)hwnd );
SendMessageW( GetParent(hwnd), WM_DRAWITEM, id, (LPARAM)&dis );
+ if (hPrevFont) SelectObject(hDC, hPrevFont);
SelectClipRgn(hDC, clipRegion);
}
More information about the wine-patches
mailing list