mirror of
https://github.com/rivo/tview.git
synced 2025-04-26 13:49:06 +08:00
Added SetListStyles() to DropDown. Resolves #621
This commit is contained in:
parent
36f5c190ea
commit
29d673af0c
11
dropdown.go
11
dropdown.go
@ -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
|
||||
|
6
grid.go
6
grid.go
@ -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…
x
Reference in New Issue
Block a user