changeset 1979:290e661abb63

Win: Fix groupbox label background color in dark mode by subclassing the frame.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Tue, 13 Aug 2019 00:20:52 +0000
parents a2a0a18678cd
children 38a455d2096c
files win/dw.c
diffstat 1 files changed, 13 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/win/dw.c	Thu Aug 08 18:15:00 2019 +0000
+++ b/win/dw.c	Tue Aug 13 00:20:52 2019 +0000
@@ -3029,6 +3029,17 @@
          {
             ColorInfo *thiscinfo = (ColorInfo *)GetWindowLongPtr((HWND)mp2, GWLP_USERDATA);
             
+            if(msg == WM_CTLCOLORBTN)
+            {
+               /* Groupbox color info is on the frame window it is attached to */
+               if(GetWindowLongPtr((HWND)mp2, GWL_STYLE) & BS_GROUPBOX)
+               {
+                  Box *framebox = (Box *)GetWindowLongPtr(hWnd, GWLP_USERDATA);
+                  if(framebox)
+                     thiscinfo = &framebox->cinfo;
+               }
+            }
+            
             if(thiscinfo && thiscinfo->fore != -1 && thiscinfo->back != -1)
             {
                int thisback = thiscinfo->back;
@@ -3037,7 +3048,7 @@
                if(thiscinfo->fore != DW_CLR_DEFAULT)
                {
                   int fore = _internal_color(thiscinfo->fore);
-               
+
                   SetTextColor((HDC)mp1, RGB(DW_RED_VALUE(fore),
                                        DW_GREEN_VALUE(fore),
                                        DW_BLUE_VALUE(fore)));
@@ -5612,6 +5623,7 @@
                             NULL);
 
    SetWindowLongPtr(hwndframe, GWLP_USERDATA, (LONG_PTR)newbox);
+   newbox->cinfo.pOldProc = SubclassWindow(hwndframe, _colorwndproc);
    dw_window_set_font(hwndframe, DefaultFont);
    return hwndframe;
 }