Ignore:
Timestamp:
Nov 22, 2000, 2:44:50 PM (25 years ago)
Author:
sandervl
Message:

WM_CTLCOLOR fixes for apps that don't return brushes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/user32/button.cpp

    r3662 r4674  
    1 /* $Id: button.cpp,v 1.37 2000-06-07 14:51:24 sandervl Exp $ */
     1/* $Id: button.cpp,v 1.38 2000-11-22 13:44:49 sandervl Exp $ */
    22/* File: button.cpp -- Button type widgets
    33 *
     
    2121#include <misc.h>
    2222#include "initterm.h"
     23#include "syscolor.h"
    2324
    2425#define DBG_LOCALLOG    DBG_button
     
    951952    if (infoPtr->hFont) SelectObject( hDC, infoPtr->hFont );
    952953
    953     /* Something is still not right, checkboxes (and edit controls)
    954      * in wsping32 have white backgrounds instead of dark grey.
    955      * BUTTON_SEND_CTLCOLOR() is even worse since it returns 0 in this
    956      * particular case and the background is not painted at all.
     954    /* GetControlBrush16 sends WM_CTLCOLORBTN, plus it returns default brush
     955     * if parent didn't return valid one. So we kill two hares at once
    957956     */
    958     //SvL: 20/09/99: This works well for us. Now the background of
    959     //               the dialog button strings in Solitaire is gray
    960     SendMessageA(GetParent(hwnd),WM_CTLCOLORBTN,hDC,hwnd);
    961 
    962     hBrush = GetSysColorBrush(COLOR_BTNFACE);
     957    hBrush = GetControlBrush( hwnd, hDC, CTLCOLOR_BTN );
    963958
    964959    /* In order to make things right, draw the rectangle background! */
     
    10911086    INT textLen;
    10921087    char* text;
     1088    HBRUSH hbr;
    10931089
    10941090    if (action != ODA_DRAWENTIRE) return;
    10951091
    1096     SendMessageA(GetParent(hwnd),WM_CTLCOLORBTN,hDC,hwnd);
     1092    /* GroupBox acts like static control, so it sends CTLCOLORSTATIC */
     1093    hbr = GetControlBrush( hwnd, hDC, CTLCOLOR_STATIC );
    10971094
    10981095    GetClientRect(hwnd,&rc);
     
    11171114      rc.left += 10;
    11181115
    1119       if (dwStyle & WS_DISABLED) DrawDisabledText(hDC,text,&rc,format); else
     1116      if (dwStyle & WS_DISABLED) {
     1117           DrawDisabledText(hDC,text,&rc,format);
     1118      }
     1119      else
    11201120      {
    1121         SetTextColor(hDC,GetSysColor(COLOR_BTNTEXT));
    1122         DrawTextA(hDC,text,-1,&rc,format);
     1121           SetTextColor(hDC,GetSysColor(COLOR_BTNTEXT));
     1122           DrawTextA(hDC,text,-1,&rc,format);
    11231123      }
    11241124
     
    11431143
    11441144    if (infoPtr->hFont) SelectObject( hDC, infoPtr->hFont );
    1145     hBrush = GetSysColorBrush(COLOR_BTNFACE);
    1146 
     1145    hBrush = GetControlBrush( hwnd, hDC, CTLCOLOR_BTN );
     1146
     1147    FillRect( hDC, &rc, hBrush );
    11471148    if ((action == ODA_FOCUS) ||
    11481149        ((action == ODA_DRAWENTIRE) && (infoPtr->state & BUTTON_HASFOCUS) && IsWindowEnabled(hwnd)))
     
    11511152      InflateRect(&rc,-1,-1);
    11521153    }
    1153     FillRect( hDC, &rc, hBrush );
    11541154}
    11551155
Note: See TracChangeset for help on using the changeset viewer.