Added SetListStyles() to DropDown. Resolves #621

pull/626/head
Oliver 3 years ago
parent 36f5c190ea
commit 29d673af0c

@ -200,6 +200,17 @@ func (d *DropDown) SetPrefixTextColor(color tcell.Color) *DropDown {
return d
}
// SetListStyles sets the styles of the items in the drop-down list (unselected
// as well as selected items). Style attributes are currently ignored but may be
// used in the future.
func (d *DropDown) SetListStyles(unselected, selected tcell.Style) *DropDown {
fg, bg, _ := unselected.Decompose()
d.list.SetMainTextColor(fg).SetBackgroundColor(bg)
fg, bg, _ = selected.Decompose()
d.list.SetSelectedTextColor(fg).SetSelectedBackgroundColor(bg)
return d
}
// SetFormAttributes sets attributes shared by all form items.
func (d *DropDown) SetFormAttributes(labelWidth int, labelColor, bgColor, fieldTextColor, fieldBgColor tcell.Color) FormItem {
d.labelWidth = labelWidth

@ -412,9 +412,6 @@ func (g *Grid) Draw(screen tcell.Screen) {
row = g.rows[index]
}
if row > 0 {
if row < g.minHeight {
row = g.minHeight
}
continue // Not proportional. We already know the width.
} else if row == 0 {
row = 1
@ -435,9 +432,6 @@ func (g *Grid) Draw(screen tcell.Screen) {
column = g.columns[index]
}
if column > 0 {
if column < g.minWidth {
column = g.minWidth
}
continue // Not proportional. We already know the height.
} else if column == 0 {
column = 1

Loading…
Cancel
Save