Skip to content

Commit

Permalink
Added SetListStyles() to DropDown. Resolves #621
Browse files Browse the repository at this point in the history
  • Loading branch information
Oliver committed Jun 24, 2021
1 parent 36f5c19 commit 29d673a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
11 changes: 11 additions & 0 deletions dropdown.go
Expand Up @@ -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
Expand Down
6 changes: 0 additions & 6 deletions grid.go
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 29d673a

Please sign in to comment.