Example #1
0
func NewInformationScreen(toptitle, title, msg string, extraTitle bool) *State {
	s := NewState()
	s.Draw = func(state *State) {
		term.DrawBackground()
		DrawTitle(state.toptitle + " - " + title)
		if extraTitle {
			asciiart, err := term.Figlet(title)
			if err != nil {
				DrawInformation(msg, "\n"+title+"\n")
			} else {
				DrawInformation(msg, asciiart)
			}
		} else {
			DrawInformation(msg, "")
		}
	}
	s.Handle = DefaultKeyHandler
	s.toptitle = toptitle
	return s
}
Example #2
0
// TODO: Find a good way to store input questions/answers in the state struct
func GetInput(state *State) {
	term.DrawBackground()
	DrawTitle(state.toptitle + " - What will it be?")
	//answer := drawInputQuery("Hostname:")
}
Example #3
0
// TODO: Find a good way to store question-information in the state struct
func AskQuestion(state *State) {
	term.DrawBackground()
	DrawTitle(state.toptitle + " - A serious question")
	alternatives := []string{"Red", "Orange", "Yellow", "Green", "Cyan", "Blue", "Violet", "Pink", "Magic", "Not listed"}
	DrawQuestion("What is your favorite color?", alternatives, state.listpos, state.buttonpos)
}
Example #4
0
func DefaultDrawFunction(state *State) {
	term.DrawBackground()
	DrawTitle("DEFAULT DRAW FUNCTION")
}