Files
ordoor/internal/ui/dialogues.go

42 lines
740 B
Go
Raw Permalink Normal View History

package ui
import (
"fmt"
)
func (d *Driver) Dialogues() []string {
out := make([]string, len(d.dialogues))
for i, dialogue := range d.dialogues {
out[i] = dialogue.Locator
}
return out
}
func (d *Driver) IsInDialogue() bool {
return d.activeDialogue != nil
}
func (d *Driver) ShowDialogue(locator string) error {
for _, dialogue := range d.dialogues {
if dialogue.Locator == locator {
2020-04-14 18:59:57 +01:00
// FIXME: we should unhover and mouseup the non-dialogue elements
2020-04-19 18:21:08 +01:00
dialogue.Active = true
d.activeDialogue = dialogue
return nil
}
}
return fmt.Errorf("Couldn't find dialogue %v", locator)
}
func (d *Driver) HideDialogue() {
2020-04-19 18:21:08 +01:00
if d.activeDialogue != nil {
d.activeDialogue.Active = false
}
d.activeDialogue = nil
}