From 4d4cbf6e4a93962ed1207407709ae8d2a355e86b Mon Sep 17 00:00:00 2001 From: rigelrozanski Date: Tue, 25 Feb 2020 18:07:27 -0500 Subject: [PATCH 1/2] list style --- list.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/list.go b/list.go index 22eafc1..a6c75ad 100644 --- a/list.go +++ b/list.go @@ -11,6 +11,7 @@ type List struct { items []string selected int pos int + style string onItemActivated func(*List) onSelectionChanged func(*List) @@ -20,6 +21,7 @@ type List struct { func NewList() *List { return &List{ selected: -1, + style: "list.item", } } @@ -37,6 +39,10 @@ func (l *List) Draw(p *Painter) { } } +func (l *List) SetStyle(style string) { + l.style = style +} + // SizeHint returns the recommended size for the list. func (l *List) SizeHint() image.Point { var width int From fb4ea0dde3cdd0ab963cd81577cca2c1b5e6c823 Mon Sep 17 00:00:00 2001 From: rigelrozanski Date: Tue, 25 Feb 2020 18:58:12 -0500 Subject: [PATCH 2/2] correction --- list.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/list.go b/list.go index a6c75ad..deb87db 100644 --- a/list.go +++ b/list.go @@ -28,7 +28,7 @@ func NewList() *List { // Draw draws the list. func (l *List) Draw(p *Painter) { for i, item := range l.items { - style := "list.item" + style := l.style if i == l.selected-l.pos { style += ".selected" }