Changeset 4674 for trunk/src


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

Location:
trunk/src/user32
Files:
4 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
  • trunk/src/user32/dc.cpp

    r4597 r4674  
    1 /* $Id: dc.cpp,v 1.78 2000-11-15 13:57:56 sandervl Exp $ */
     1/* $Id: dc.cpp,v 1.79 2000-11-22 13:44:49 sandervl Exp $ */
    22
    33/*
     
    12321232        }
    12331233        else {
     1234            dprintf2(("WinInvalidateRect (%d,%d)(%d,%d)", rectl.xLeft, rectl.yBottom, rectl.xRight, rectl.yTop));
    12341235            success = WinInvalidateRect (hwnd, &rectl, IncludeChildren);
    12351236//SvL: If all children are included, then WinInvalidateRect is called
  • trunk/src/user32/syscolor.cpp

    r4494 r4674  
    1 /* $Id: syscolor.cpp,v 1.23 2000-10-17 17:11:07 sandervl Exp $ */
     1/* $Id: syscolor.cpp,v 1.24 2000-11-22 13:44:50 sandervl Exp $ */
    22
    33/*
     
    2727#define DBG_LOCALLOG    DBG_syscolor
    2828#include "dbglocal.h"
     29
     30#define CTLCOLOR_MAX   CTLCOLOR_STATIC
    2931
    3032//SvL: Open32 colors are much better than those in the table below
     
    306308    return hPattern55AABitmap;
    307309}
     310//******************************************************************************
     311//******************************************************************************
     312HBRUSH WIN32API GetControlBrush(HWND hwnd, HDC hdc, DWORD ctlType)
     313{
     314 HBRUSH bkgBrush = 0;
     315
     316    if(ctlType <= CTLCOLOR_MAX)
     317    {
     318        bkgBrush = (HBRUSH)SendMessageA(GetParent(hwnd), WM_CTLCOLORMSGBOX + ctlType,
     319                                        (WPARAM)hdc, (LPARAM)hwnd );
     320
     321        if(GetObjectType(bkgBrush) != OBJ_BRUSH)
     322             bkgBrush = DefWindowProcA(hwnd, WM_CTLCOLORMSGBOX + ctlType, hdc, ctlType);
     323    }
     324    return bkgBrush;
     325}
     326//******************************************************************************
     327//******************************************************************************
  • trunk/src/user32/syscolor.h

    r2873 r4674  
    1 /* $Id: syscolor.h,v 1.12 2000-02-23 17:05:17 cbratschi Exp $ */
     1/* $Id: syscolor.h,v 1.13 2000-11-22 13:44:50 sandervl Exp $ */
    22
    33/*
     
    2222extern BOOL SYSCOLOR_GetUseWinColors(VOID);
    2323
     24HBRUSH WIN32API GetControlBrush(HWND hwnd, HDC hdc, DWORD ctlType);
     25
    2426#endif  /* __WINE_SYSCOLOR_H */
Note: See TracChangeset for help on using the changeset viewer.