コード例 #1
0
ファイル: screens.go プロジェクト: xyproto/wizard
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
}
コード例 #2
0
ファイル: screens.go プロジェクト: xyproto/wizard
// 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:")
}
コード例 #3
0
ファイル: screens.go プロジェクト: xyproto/wizard
// 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)
}
コード例 #4
0
ファイル: screens.go プロジェクト: xyproto/wizard
func DefaultDrawFunction(state *State) {
	term.DrawBackground()
	DrawTitle("DEFAULT DRAW FUNCTION")
}