summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorAlexander Neumann <alexander.neumann@picos-software.com>2020-09-03 16:17:02 +0200
committerAlexander Neumann <alexander.neumann@picos-software.com>2020-09-03 16:17:02 +0200
commit5d9132a89763dee9c0664a599da7a8a733a7dd31 (patch)
tree013924828ef9b51b81843932b9e8fbd76662b0b9
parentNotifyIcon: Don't destroy the associated window (diff)
downloadwireguard-windows-5d9132a89763dee9c0664a599da7a8a733a7dd31.tar.xz
wireguard-windows-5d9132a89763dee9c0664a599da7a8a733a7dd31.zip
ListBox/ListItemStyle: Allow override of TextColor
-rw-r--r--listbox.go1
-rw-r--r--models.go3
2 files changed, 3 insertions, 1 deletions
diff --git a/listbox.go b/listbox.go
index 52f01b8e..b777ebbd 100644
--- a/listbox.go
+++ b/listbox.go
@@ -704,6 +704,7 @@ func (lb *ListBox) WndProc(hwnd win.HWND, msg uint32, wParam, lParam uintptr) ui
} else {
lb.style.LineColor = RGB(255, 255, 255)
}
+ lb.style.defaultTextColor = lb.style.TextColor
lb.style.DrawBackground()
diff --git a/models.go b/models.go
index 7bb397b1..7a2d6c0d 100644
--- a/models.go
+++ b/models.go
@@ -394,6 +394,7 @@ type ListItemStyler interface {
type ListItemStyle struct {
BackgroundColor Color
TextColor Color
+ defaultTextColor Color
LineColor Color
Font *Font
index int
@@ -476,7 +477,7 @@ func (lis *ListItemStyle) DrawBackground() error {
// DrawText draws text inside given bounds specified in native pixels.
func (lis *ListItemStyle) DrawText(text string, bounds Rectangle, format DrawTextFormat) error {
- if lis.hTheme != 0 {
+ if lis.hTheme != 0 && lis.TextColor == lis.defaultTextColor {
if lis.Font != nil {
hFontOld := win.SelectObject(lis.hdc, win.HGDIOBJ(lis.Font.handleForDPI(lis.dpi)))
defer win.SelectObject(lis.hdc, hFontOld)