Invisible Ownerdrawn buttons

Arnaud ANDRE aandr at info.fundp.ac.be
Mon Mar 31 11:56:16 CST 2003


Changelog :
    wine/controls/button.c : get hbrush from WM_LCOLORBTN and is drawn grey
                                           by default

A very ridiculous patch but at least it fixes Bugzilla #54. The 
WM_LCOLORBTN isn't very useful but it's still the normal windows 
behaviour. Going back to see if i can do another tasklet...

Arnaud ANDRE
-------------- next part --------------
--- wine/controls/button.c	2003-03-31 19:40:16.000000000 +0200
+++ button.c	2003-03-31 19:37:15.000000000 +0200
@@ -1077,6 +1077,7 @@
     HRGN clipRegion;
     RECT clipRect;
     UINT id = GetWindowLongA( hwnd, GWL_ID );
+    HBRUSH hBrush,hOldBrush;
 
     dis.CtlType    = ODT_BUTTON;
     dis.CtlID      = id;
@@ -1090,6 +1091,13 @@
     dis.itemData   = 0;
     GetClientRect( hwnd, &dis.rcItem );
 
+    /* Send WM_CTLCOLORBTN to allow changing the Text/Bk color and/or the brush */
+    hBrush = SendMessageW( GetParent(hwnd), WM_CTLCOLORBTN, (WPARAM)hDC, (LPARAM)hwnd );
+    if( !hBrush )
+      hBrush = (HBRUSH)GetSysColorBrush(COLOR_BTNFACE);
+
+    hOldBrush =(HBRUSH)SelectObject(hDC,hBrush);
+
     clipRegion = CreateRectRgnIndirect(&dis.rcItem);
     if (GetClipRgn(hDC, clipRegion) != 1)
     {
@@ -1101,6 +1109,8 @@
     IntersectClipRect(hDC, clipRect.left,  clipRect.top, clipRect.right, clipRect.bottom);
 
     SetBkColor( hDC, GetSysColor( COLOR_BTNFACE ) );
+    FillRect( hDC, &dis.rcItem, hBrush );
     SendMessageW( GetParent(hwnd), WM_DRAWITEM, id, (LPARAM)&dis );
     SelectClipRgn(hDC, clipRegion);
+    SelectObject(hDC,hOldBrush);
 }


More information about the wine-patches mailing list