Invisible Ownerdrawn buttons

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
--- 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);
 }

[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux