mirror of https://github.com/reactos/reactos.git
[EXPLORER] Improve Clock text color for High Contrast (#5180)
Use GetSysColor(COLOR_BTNTEXT) to get the system color in CTrayClockWnd::OnPaint. CORE-18886
This commit is contained in:
parent
faa6f940d5
commit
a027eb7ccb
|
@ -150,11 +150,11 @@ public:
|
||||||
|
|
||||||
CTrayClockWnd::CTrayClockWnd() :
|
CTrayClockWnd::CTrayClockWnd() :
|
||||||
hFont(NULL),
|
hFont(NULL),
|
||||||
|
textColor(0),
|
||||||
dwFlags(0),
|
dwFlags(0),
|
||||||
LineSpacing(0),
|
LineSpacing(0),
|
||||||
VisibleLines(0)
|
VisibleLines(0)
|
||||||
{
|
{
|
||||||
ZeroMemory(&textColor, sizeof(textColor));
|
|
||||||
ZeroMemory(&rcText, sizeof(rcText));
|
ZeroMemory(&rcText, sizeof(rcText));
|
||||||
ZeroMemory(&LocalTime, sizeof(LocalTime));
|
ZeroMemory(&LocalTime, sizeof(LocalTime));
|
||||||
ZeroMemory(&CurrentSize, sizeof(CurrentSize));
|
ZeroMemory(&CurrentSize, sizeof(CurrentSize));
|
||||||
|
@ -173,34 +173,19 @@ LRESULT CTrayClockWnd::OnThemeChanged()
|
||||||
|
|
||||||
if (clockTheme)
|
if (clockTheme)
|
||||||
{
|
{
|
||||||
GetThemeFont(clockTheme,
|
GetThemeFont(clockTheme, NULL, CLP_TIME, 0, TMT_FONT, &clockFont);
|
||||||
NULL,
|
|
||||||
CLP_TIME,
|
|
||||||
0,
|
|
||||||
TMT_FONT,
|
|
||||||
&clockFont);
|
|
||||||
|
|
||||||
hFont = CreateFontIndirectW(&clockFont);
|
hFont = CreateFontIndirectW(&clockFont);
|
||||||
|
|
||||||
GetThemeColor(clockTheme,
|
GetThemeColor(clockTheme, CLP_TIME, 0, TMT_TEXTCOLOR, &textColor);
|
||||||
CLP_TIME,
|
|
||||||
0,
|
|
||||||
TMT_TEXTCOLOR,
|
|
||||||
&textColor);
|
|
||||||
|
|
||||||
if (this->hFont != NULL)
|
if (this->hFont != NULL)
|
||||||
DeleteObject(this->hFont);
|
DeleteObject(this->hFont);
|
||||||
|
|
||||||
SetFont(hFont, FALSE);
|
SetFont(hFont, FALSE);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* We don't need to set a font here, our parent will use
|
|
||||||
* WM_SETFONT to set the right one when themes are not enabled. */
|
|
||||||
textColor = RGB(0, 0, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
CloseThemeData(clockTheme);
|
CloseThemeData(clockTheme);
|
||||||
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -520,14 +505,11 @@ LRESULT CTrayClockWnd::OnPaint(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bH
|
||||||
HFONT hPrevFont;
|
HFONT hPrevFont;
|
||||||
INT iPrevBkMode;
|
INT iPrevBkMode;
|
||||||
UINT i, line;
|
UINT i, line;
|
||||||
|
|
||||||
PAINTSTRUCT ps;
|
PAINTSTRUCT ps;
|
||||||
HDC hDC = (HDC) wParam;
|
HDC hDC = (HDC) wParam;
|
||||||
|
|
||||||
if (wParam == 0)
|
if (wParam == 0)
|
||||||
{
|
|
||||||
hDC = BeginPaint(&ps);
|
hDC = BeginPaint(&ps);
|
||||||
}
|
|
||||||
|
|
||||||
if (hDC == NULL)
|
if (hDC == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -537,7 +519,10 @@ LRESULT CTrayClockWnd::OnPaint(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bH
|
||||||
{
|
{
|
||||||
iPrevBkMode = SetBkMode(hDC, TRANSPARENT);
|
iPrevBkMode = SetBkMode(hDC, TRANSPARENT);
|
||||||
|
|
||||||
SetTextColor(hDC, textColor);
|
if (!IsAppThemed())
|
||||||
|
textColor = ::GetSysColor(COLOR_BTNTEXT);
|
||||||
|
|
||||||
|
::SetTextColor(hDC, textColor);
|
||||||
|
|
||||||
hPrevFont = (HFONT) SelectObject(hDC, hFont);
|
hPrevFont = (HFONT) SelectObject(hDC, hFont);
|
||||||
|
|
||||||
|
@ -567,9 +552,7 @@ LRESULT CTrayClockWnd::OnPaint(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bH
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wParam == 0)
|
if (wParam == 0)
|
||||||
{
|
|
||||||
EndPaint(&ps);
|
EndPaint(&ps);
|
||||||
}
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue