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

@@ -10,7 +10,7 @@ func (d *Driver) realId(id string) string {
}
func (d *Driver) Value(id string, into *string) error {
for _, valueable := range d.valueables() {
for _, valueable := range d.allValueables() {
if valueable.id() == d.realId(id) {
*into = valueable.value()
return nil
@@ -21,7 +21,7 @@ func (d *Driver) Value(id string, into *string) error {
}
func (d *Driver) SetValue(id, value string) error {
for _, valueable := range d.valueables() {
for _, valueable := range d.allValueables() {
if valueable.id() == d.realId(id) {
valueable.setValue(value)
return nil
@@ -51,7 +51,7 @@ func (d *Driver) SetValueBool(id string, value bool) error {
}
func (d *Driver) SetFreeze(id string, value bool) error {
for _, freezable := range d.freezables() {
for _, freezable := range d.allFreezables() {
if freezable.id() == d.realId(id) {
freezable.setFreezeState(value)
return nil
@@ -62,30 +62,19 @@ func (d *Driver) SetFreeze(id string, value bool) error {
}
func (d *Driver) OnClick(id string, f func()) error {
for _, clickable := range d.clickables() {
for _, clickable := range d.allClickables() {
if clickable.id() == d.realId(id) {
clickable.onClick(f)
return nil
}
}
// We need to be able to wire up items inside dialogues too
for _, dialogue := range d.dialogues {
for _, clickable := range dialogue.clickables() {
if clickable.id() == d.realId(id) {
clickable.onClick(f)
return nil
}
}
}
return fmt.Errorf("Couldn't find clickable widget %v:%v", d.menu.Name, id)
}
// FIXME: HURK. Surely I'm missing something? steps is value:offset
func (d *Driver) ConfigureSlider(id string, steps map[int]int) error {
for _, clickable := range d.clickables() {
for _, clickable := range d.activeClickables() {
if slider, ok := clickable.(*slider); ok && slider.id() == d.realId(id) {
slider.steps = steps