Ignore:
Timestamp:
Dec 26, 2001, 12:35:39 PM (24 years ago)
Author:
sandervl
Message:

WM_CTLCOLOR fix for buttonsbutton.cpp

File:
1 edited

Legend:

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

    r7409 r7683  
    1 /* $Id: button.cpp,v 1.44 2001-11-21 11:51:37 sandervl Exp $ */
     1/* $Id: button.cpp,v 1.45 2001-12-26 11:35:38 sandervl Exp $ */
    22/* File: button.cpp -- Button type widgets
    33 *
     
    10281028    if (infoPtr->hFont) SelectObject( hDC, infoPtr->hFont );
    10291029
    1030     /* GetControlBrush16 sends WM_CTLCOLORBTN, plus it returns default brush
    1031      * if parent didn't return valid one. So we kill two hares at once
    1032      */
    1033     hBrush = GetControlBrush( hwnd, hDC, CTLCOLOR_BTN );
    1034 
    1035     /* In order to make things right, draw the rectangle background! */
    1036     if ( !(infoPtr->state & BUTTON_HASFOCUS) && (action == ODA_DRAWENTIRE) )
    1037     {
    1038         colour = GetBkColor(hDC);
    1039         hPen = CreatePen( PS_SOLID, 1, colour );
    1040         if ( hPen )
    1041         {
    1042             hOldBrush = SelectObject( hDC, hBrush );
    1043             hOldPen = SelectObject( hDC, hPen );
    1044             Rectangle( hDC, client.left, client.top, client.right, client.bottom );
    1045             SelectObject( hDC, hOldPen );
    1046             SelectObject( hDC, hOldBrush );
    1047             DeleteObject( hPen );
    1048         }
    1049     }
     1030#ifdef __WIN32OS2__
     1031    //(Auto)Check, (Auto)Radio & (Auto)3State buttons send WM_CTLCOLORSTATIC
     1032    //instead of WM_CTLCOLORBTN (verified in NT4)
     1033    hBrush = SendMessageW( GetParent(hwnd), WM_CTLCOLORSTATIC, hDC, (LPARAM)hwnd );
     1034    if (!hBrush) /* did the app forget to call defwindowproc ? */
     1035        hBrush = DefWindowProcW( GetParent(hwnd), WM_CTLCOLORSTATIC, hDC, (LPARAM)hwnd );
     1036#endif
    10501037
    10511038    if (dwStyle & BS_LEFTTEXT)
     
    10771064    {
    10781065        UINT state;
     1066
     1067        /* Since WM_ERASEBKGND does nothing, first prepare background */
     1068        if (action == ODA_SELECT) FillRect( hDC, &rbox, hBrush );
     1069        else FillRect( hDC, &client, hBrush );
    10791070
    10801071        if (((dwStyle & 0x0f) == BS_RADIOBUTTON) ||
Note: See TracChangeset for help on using the changeset viewer.