Set StyleSettings::DisableColor value in Win

WinSalFrame::UpdateSettings function loads colors from the widget
toolkit into the StyleSettings objects. Themes uses these colors as
default values.

I tried using `OpenThemeData(mhWnd, L"Button")` to get the fill color
value for background color, but didn't get the appropriate color.
For the time being, modifying the ButtonRect luminance for the disabled
state. Would replace it with something more appropriate as the Win32
welding work progresses.

Change-Id: Ied04a8c6c6cb01b1388ef1d744077ae6dfd27b1b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/179439
Reviewed-by: Sahil Gautam <sahil.gautam.extern@allotropia.de>
Reviewed-by: Heiko Tietze <heiko.tietze@documentfoundation.org>
Tested-by: Jenkins
Tested-by: Heiko Tietze <heiko.tietze@documentfoundation.org>
This commit is contained in:
Sahil Gautam
2024-12-27 02:41:49 +05:30
parent 589cd1b840
commit b9464eadfc

View File

@@ -543,25 +543,28 @@ static bool drawThemedControl(HDC hDC, ControlType nType, int iPart, int iState,
if (iPart == BP_PUSHBUTTON)
{
Color aButtonColor = ThemeColors::GetThemeColors().GetButtonColor();
const Color& rButtonRectColor = ThemeColors::GetThemeColors().GetDisabledColor();
Color aButtonRectColor = ThemeColors::GetThemeColors().GetDisabledColor();
if (iState == PBS_PRESSED)
aButtonColor.Merge(rButtonRectColor, 230);
aButtonColor.Merge(aButtonRectColor, 230);
else if (iState == PBS_DISABLED)
aButtonColor = ThemeColors::GetThemeColors().GetDisabledColor();
if (UseDarkMode())
aButtonRectColor.DecreaseLuminance(150);
else
aButtonRectColor.IncreaseLuminance(150);
else if (iState == PBS_HOT)
aButtonColor.Merge(rButtonRectColor, 170);
aButtonColor.Merge(aButtonRectColor, 170);
else if (iState == PBS_DEFAULTED)
aButtonColor.Merge(rButtonRectColor, 150);
aButtonColor.Merge(aButtonRectColor, 150);
ScopedHBRUSH hbrush(CreateSolidBrush(RGB(aButtonColor.GetRed(),
aButtonColor.GetGreen(),
aButtonColor.GetBlue())));
FillRect(hDC, &rc, hbrush.get());
hbrush = ScopedHBRUSH(CreateSolidBrush(RGB(rButtonRectColor.GetRed(),
rButtonRectColor.GetGreen(),
rButtonRectColor.GetBlue())));
hbrush = ScopedHBRUSH(CreateSolidBrush(RGB(aButtonRectColor.GetRed(),
aButtonRectColor.GetGreen(),
aButtonRectColor.GetBlue())));
FrameRect(hDC, &rc, hbrush.get());
return true;
}