To do this, MENU and SUBMENU are split into two types (at last), and a Widget type is introduced. This should allow lots of code to be removed at some point.
31 lines
502 B
Go
31 lines
502 B
Go
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) ShowDialogue(locator string) error {
|
|
for _, dialogue := range d.dialogues {
|
|
if dialogue.Locator == locator {
|
|
d.activeDialogue = dialogue
|
|
|
|
return nil
|
|
}
|
|
}
|
|
return fmt.Errorf("Couldn't find dialogue %v", locator)
|
|
}
|
|
|
|
func (d *Driver) HideDialogue() {
|
|
d.activeDialogue = nil
|
|
}
|