aboutsummaryrefslogtreecommitdiffhomepage
path: root/win32
diff options
context:
space:
mode:
Diffstat (limited to 'win32')
-rw-r--r--win32/ListBox.cxx3
-rw-r--r--win32/PlatWin.cxx9
-rw-r--r--win32/PlatWin.h2
-rw-r--r--win32/ScintillaWin.cxx2
4 files changed, 11 insertions, 5 deletions
diff --git a/win32/ListBox.cxx b/win32/ListBox.cxx
index 88b44d9ed..68fe48d27 100644
--- a/win32/ListBox.cxx
+++ b/win32/ListBox.cxx
@@ -117,8 +117,7 @@ ColourRGBA ColourElement(std::optional<ColourRGBA> colour, int nIndex) {
if (colour.has_value()) {
return colour.value();
}
- const DWORD colourValue = ::GetSysColor(nIndex);
- return ColourRGBA(colourValue);
+ return ColourFromSys(nIndex);
}
struct LBGraphics {
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<int>(::GetSysColor(COLOR_3DFACE)));
+ return ColourFromSys(COLOR_3DFACE);
}
ColourRGBA Platform::ChromeHighlight() {
- return ColourRGBA::FromRGB(static_cast<int>(::GetSysColor(COLOR_3DHIGHLIGHT)));
+ return ColourFromSys(COLOR_3DHIGHLIGHT);
}
const char *Platform::DefaultFont() {
diff --git a/win32/PlatWin.h b/win32/PlatWin.h
index ec39b0870..1edad6044 100644
--- a/win32/PlatWin.h
+++ b/win32/PlatWin.h
@@ -44,6 +44,8 @@ constexpr SIZE SizeOfRect(RECT rc) noexcept {
return { rc.right - rc.left, rc.bottom - rc.top };
}
+ColourRGBA ColourFromSys(int nIndex) noexcept;
+
constexpr HWND HwndFromWindowID(WindowID wid) noexcept {
return static_cast<HWND>(wid);
}
diff --git a/win32/ScintillaWin.cxx b/win32/ScintillaWin.cxx
index 0dc8acf68..77fed597c 100644
--- a/win32/ScintillaWin.cxx
+++ b/win32/ScintillaWin.cxx
@@ -2617,7 +2617,7 @@ void ScintillaWin::UpdateBaseElements() {
};
bool changed = false;
for (const ElementToIndex &ei : eti) {
- changed = vs.SetElementBase(ei.element, ColourRGBA::FromRGB(static_cast<int>(::GetSysColor(ei.nIndex)))) || changed;
+ changed = vs.SetElementBase(ei.element, ColourFromSys(ei.nIndex)) || changed;
}
if (changed) {
Redraw();