From 2b897e4c4a0cf9d67095b4d4d37d852f61d02667 Mon Sep 17 00:00:00 2001 From: Neil Date: Fri, 28 Mar 2025 15:52:24 +1100 Subject: Standardize access to system colours through GetSysColor and avoid casts. --- win32/PlatWin.cxx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'win32/PlatWin.cxx') diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx index f14661164..b93616b77 100644 --- a/win32/PlatWin.cxx +++ b/win32/PlatWin.cxx @@ -695,12 +695,17 @@ void Menu::Show(Point pt, const Window &w) { Destroy(); } +ColourRGBA ColourFromSys(int nIndex) noexcept { + const DWORD colourValue = ::GetSysColor(nIndex); + return ColourRGBA::FromRGB(colourValue); +} + ColourRGBA Platform::Chrome() { - return ColourRGBA::FromRGB(static_cast(::GetSysColor(COLOR_3DFACE))); + return ColourFromSys(COLOR_3DFACE); } ColourRGBA Platform::ChromeHighlight() { - return ColourRGBA::FromRGB(static_cast(::GetSysColor(COLOR_3DHIGHLIGHT))); + return ColourFromSys(COLOR_3DHIGHLIGHT); } const char *Platform::DefaultFont() { -- cgit v1.2.3