comctl32/syslink: Fix painting of background color for transparent controls.
This commit is contained in:
parent
8407559167
commit
e0cc9a798b
|
@ -94,7 +94,6 @@ typedef struct
|
||||||
COLORREF TextColor; /* Color of the text */
|
COLORREF TextColor; /* Color of the text */
|
||||||
COLORREF LinkColor; /* Color of links */
|
COLORREF LinkColor; /* Color of links */
|
||||||
COLORREF VisitedColor; /* Color of visited links */
|
COLORREF VisitedColor; /* Color of visited links */
|
||||||
COLORREF BackColor; /* Background color, set on creation */
|
|
||||||
WCHAR BreakChar; /* Break Character for the current font */
|
WCHAR BreakChar; /* Break Character for the current font */
|
||||||
BOOL IgnoreReturn; /* (infoPtr->Style & LWS_IGNORERETURN) on creation */
|
BOOL IgnoreReturn; /* (infoPtr->Style & LWS_IGNORERETURN) on creation */
|
||||||
} SYSLINK_INFO;
|
} SYSLINK_INFO;
|
||||||
|
@ -819,10 +818,12 @@ static LRESULT SYSLINK_Draw (const SYSLINK_INFO *infoPtr, HDC hdc)
|
||||||
HFONT hOldFont;
|
HFONT hOldFont;
|
||||||
COLORREF OldTextColor, OldBkColor;
|
COLORREF OldTextColor, OldBkColor;
|
||||||
HBRUSH hBrush;
|
HBRUSH hBrush;
|
||||||
|
UINT text_flags = ETO_CLIPPED;
|
||||||
|
UINT mode = GetBkMode( hdc );
|
||||||
|
|
||||||
hOldFont = SelectObject(hdc, infoPtr->Font);
|
hOldFont = SelectObject(hdc, infoPtr->Font);
|
||||||
OldTextColor = SetTextColor(hdc, infoPtr->TextColor);
|
OldTextColor = SetTextColor(hdc, infoPtr->TextColor);
|
||||||
OldBkColor = SetBkColor(hdc, infoPtr->BackColor);
|
OldBkColor = SetBkColor(hdc, comctl32_color.clrWindow);
|
||||||
|
|
||||||
GetClientRect(infoPtr->Self, &rc);
|
GetClientRect(infoPtr->Self, &rc);
|
||||||
rc.right -= SL_RIGHTMARGIN + SL_LEFTMARGIN;
|
rc.right -= SL_RIGHTMARGIN + SL_LEFTMARGIN;
|
||||||
|
@ -832,9 +833,13 @@ static LRESULT SYSLINK_Draw (const SYSLINK_INFO *infoPtr, HDC hdc)
|
||||||
|
|
||||||
hBrush = (HBRUSH)SendMessageW(infoPtr->Notify, WM_CTLCOLORSTATIC,
|
hBrush = (HBRUSH)SendMessageW(infoPtr->Notify, WM_CTLCOLORSTATIC,
|
||||||
(WPARAM)hdc, (LPARAM)infoPtr->Self);
|
(WPARAM)hdc, (LPARAM)infoPtr->Self);
|
||||||
if (!hBrush)
|
if (!(infoPtr->Style & LWS_TRANSPARENT))
|
||||||
hBrush = CreateSolidBrush(infoPtr->BackColor);
|
{
|
||||||
FillRect(hdc, &rc, hBrush);
|
FillRect(hdc, &rc, hBrush);
|
||||||
|
if (GetBkMode( hdc ) == OPAQUE) text_flags |= ETO_OPAQUE;
|
||||||
|
}
|
||||||
|
else SetBkMode( hdc, TRANSPARENT );
|
||||||
|
|
||||||
DeleteObject(hBrush);
|
DeleteObject(hBrush);
|
||||||
|
|
||||||
for(Current = infoPtr->Items; Current != NULL; Current = Current->Next)
|
for(Current = infoPtr->Items; Current != NULL; Current = Current->Next)
|
||||||
|
@ -863,7 +868,7 @@ static LRESULT SYSLINK_Draw (const SYSLINK_INFO *infoPtr, HDC hdc)
|
||||||
while(n > 0)
|
while(n > 0)
|
||||||
{
|
{
|
||||||
tx += bl->nSkip;
|
tx += bl->nSkip;
|
||||||
ExtTextOutW(hdc, bl->rc.left, bl->rc.top, ETO_OPAQUE | ETO_CLIPPED, &bl->rc, tx, bl->nChars, NULL);
|
ExtTextOutW(hdc, bl->rc.left, bl->rc.top, text_flags, &bl->rc, tx, bl->nChars, NULL);
|
||||||
if((Current->Type == slLink) && (Current->u.Link.state & LIS_FOCUSED) && infoPtr->HasFocus)
|
if((Current->Type == slLink) && (Current->u.Link.state & LIS_FOCUSED) && infoPtr->HasFocus)
|
||||||
{
|
{
|
||||||
COLORREF PrevTextColor;
|
COLORREF PrevTextColor;
|
||||||
|
@ -881,7 +886,7 @@ static LRESULT SYSLINK_Draw (const SYSLINK_INFO *infoPtr, HDC hdc)
|
||||||
SetBkColor(hdc, OldBkColor);
|
SetBkColor(hdc, OldBkColor);
|
||||||
SetTextColor(hdc, OldTextColor);
|
SetTextColor(hdc, OldTextColor);
|
||||||
SelectObject(hdc, hOldFont);
|
SelectObject(hdc, hOldFont);
|
||||||
|
SetBkMode(hdc, mode);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1549,6 +1554,17 @@ static LRESULT WINAPI SysLinkWindowProc(HWND hwnd, UINT message,
|
||||||
return SYSLINK_Paint (infoPtr, (HDC)wParam);
|
return SYSLINK_Paint (infoPtr, (HDC)wParam);
|
||||||
|
|
||||||
case WM_ERASEBKGND:
|
case WM_ERASEBKGND:
|
||||||
|
if (!(infoPtr->Style & LWS_TRANSPARENT))
|
||||||
|
{
|
||||||
|
HDC hdc = (HDC)wParam;
|
||||||
|
HBRUSH brush = CreateSolidBrush( comctl32_color.clrWindow );
|
||||||
|
RECT rect;
|
||||||
|
|
||||||
|
GetClipBox( hdc, &rect );
|
||||||
|
FillRect( hdc, &rect, brush );
|
||||||
|
DeleteObject( brush );
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case WM_SETCURSOR:
|
case WM_SETCURSOR:
|
||||||
|
@ -1731,8 +1747,6 @@ static LRESULT WINAPI SysLinkWindowProc(HWND hwnd, UINT message,
|
||||||
infoPtr->TextColor = comctl32_color.clrWindowText;
|
infoPtr->TextColor = comctl32_color.clrWindowText;
|
||||||
infoPtr->LinkColor = comctl32_color.clrHighlight;
|
infoPtr->LinkColor = comctl32_color.clrHighlight;
|
||||||
infoPtr->VisitedColor = comctl32_color.clrHighlight;
|
infoPtr->VisitedColor = comctl32_color.clrHighlight;
|
||||||
infoPtr->BackColor = infoPtr->Style & LWS_TRANSPARENT ?
|
|
||||||
comctl32_color.clrWindow : comctl32_color.clrBtnFace;
|
|
||||||
infoPtr->BreakChar = ' ';
|
infoPtr->BreakChar = ' ';
|
||||||
infoPtr->IgnoreReturn = infoPtr->Style & LWS_IGNORERETURN;
|
infoPtr->IgnoreReturn = infoPtr->Style & LWS_IGNORERETURN;
|
||||||
TRACE("SysLink Ctrl creation, hwnd=%p\n", hwnd);
|
TRACE("SysLink Ctrl creation, hwnd=%p\n", hwnd);
|
||||||
|
@ -1750,8 +1764,6 @@ static LRESULT WINAPI SysLinkWindowProc(HWND hwnd, UINT message,
|
||||||
|
|
||||||
case WM_SYSCOLORCHANGE:
|
case WM_SYSCOLORCHANGE:
|
||||||
COMCTL32_RefreshSysColors();
|
COMCTL32_RefreshSysColors();
|
||||||
if (infoPtr->Style & LWS_TRANSPARENT)
|
|
||||||
infoPtr->BackColor = comctl32_color.clrWindow;
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Reference in New Issue