aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/selecter.go
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2020-05-28 10:32:42 -0400
committerDrew DeVault <sir@cmpwn.com>2020-05-28 10:32:42 -0400
commitcaad1b2c06a0446059ee5ee916e3dce1794b159b (patch)
treeee81255485234137a5902d87d5960ac06618b341 /widgets/selecter.go
parent76a91813d8dc0f0011202f8120fc197097f022aa (diff)
downloadaerc-caad1b2c06a0446059ee5ee916e3dce1794b159b.tar.gz
Revert "Add Style configuration"
This reverts commit 0f78f06610c0e8887aba2ae50e99b86477a384b3.
Diffstat (limited to 'widgets/selecter.go')
-rw-r--r--widgets/selecter.go26
1 files changed, 11 insertions, 15 deletions
diff --git a/widgets/selecter.go b/widgets/selecter.go
index 0faf37ea..7fae9cda 100644
--- a/widgets/selecter.go
+++ b/widgets/selecter.go
@@ -3,27 +3,24 @@ package widgets
import (
"github.com/gdamore/tcell"
- "git.sr.ht/~sircmpwn/aerc/config"
"git.sr.ht/~sircmpwn/aerc/lib/ui"
)
type Selecter struct {
ui.Invalidatable
- chooser bool
- focused bool
- focus int
- options []string
- uiConfig config.UIConfig
+ chooser bool
+ focused bool
+ focus int
+ options []string
onChoose func(option string)
onSelect func(option string)
}
-func NewSelecter(options []string, focus int, uiConfig config.UIConfig) *Selecter {
+func NewSelecter(options []string, focus int) *Selecter {
return &Selecter{
- focus: focus,
- options: options,
- uiConfig: uiConfig,
+ focus: focus,
+ options: options,
}
}
@@ -37,16 +34,15 @@ func (sel *Selecter) Invalidate() {
}
func (sel *Selecter) Draw(ctx *ui.Context) {
- ctx.Fill(0, 0, ctx.Width(), ctx.Height(), ' ',
- sel.uiConfig.GetStyle(config.STYLE_SELECTER_DEFAULT))
+ ctx.Fill(0, 0, ctx.Width(), ctx.Height(), ' ', tcell.StyleDefault)
x := 2
for i, option := range sel.options {
- style := sel.uiConfig.GetStyle(config.STYLE_SELECTER_DEFAULT)
+ style := tcell.StyleDefault
if sel.focus == i {
if sel.focused {
- style = sel.uiConfig.GetStyle(config.STYLE_SELECTER_FOCUSED)
+ style = style.Reverse(true)
} else if sel.chooser {
- style = sel.uiConfig.GetStyle(config.STYLE_SELECTER_CHOOSER)
+ style = style.Bold(true)
}
}
x += ctx.Printf(x, 1, style, "[%s]", option)