Increase dialogue modality, display keyboard dialogue

This commit is contained in:
2020-04-14 12:12:37 +01:00
parent 786d261f98
commit 82d3849402
7 changed files with 136 additions and 50 deletions

View File

@@ -14,6 +14,8 @@ import (
//
// TODO: multi-select functionality? Is it needed?
type listBox struct {
locator string
upBtn *button
downBtn *button
@@ -52,6 +54,7 @@ func (d *Driver) buildListBox(group *menus.Group, up, down, thumb *menus.Record,
}
element := &listBox{
locator: group.Locator,
// TODO: upBtn needs to be frozen when offset == 0; downBtn when offset == max
upBtn: upElem,
downBtn: downElem,
@@ -75,6 +78,7 @@ func (d *Driver) buildListBox(group *menus.Group, up, down, thumb *menus.Record,
widget := &Widget{
Children: []*Widget{upWidget, downWidget},
ownPaintables: []paintable{element},
ownValueables: []valueable{element},
}
// FIXME: we should be able to freeze/unfreeze as a group.
@@ -86,6 +90,7 @@ func (d *Driver) buildListBox(group *menus.Group, up, down, thumb *menus.Record,
if err != nil {
return nil, nil, err
}
niWidget.ownClickables = append(niWidget.ownClickables, ni)
// TODO: pick the correct font
ni.label = &label{
@@ -102,6 +107,17 @@ func (d *Driver) buildListBox(group *menus.Group, up, down, thumb *menus.Record,
return element, widget, nil
}
func (l *listBox) id() string {
return l.locator
}
func (l *listBox) value() string {
return ""
}
func (l *listBox) setValue(s string) {
}
func (l *listBox) SetStrings(to []string) {
if len(to) < len(l.strings) {
l.offset = 0 // FIXME: unconditional? Trim to max?