Added a Select() method to List

This commit is contained in:
2023-02-10 22:26:34 -05:00
parent 5e448edb21
commit dce0321e9b
2 changed files with 30 additions and 12 deletions

View File

@@ -330,6 +330,14 @@ func (element *List) Replace (index int, entry ListEntry) {
}
}
// Select selects a specific item in the list. If the index is out of bounds,
// no items will be selecected.
func (element *List) Select (index int) {
if element.selectEntry(index) {
element.redo()
}
}
func (element *List) selectUnderMouse (x, y int) (updated bool) {
inset := element.theme.Inset(theme.PatternSunken)
bounds := inset.Apply(element.Bounds())