Documentation ¶
Overview ¶
+build linux
Index ¶
- Variables
- func SetConsoleTitle(title string) error
- type AddRulePage
- type App
- type LoadPage
- type ModalHandler
- type Page
- type PageHandler
- type ResultsPage
- type RulesPage
- func (p *RulesPage) GetRules() []riddle.Rule
- func (p *RulesPage) HandleSetup(setup riddle.Setup)
- func (p *RulesPage) Reset()
- func (p *RulesPage) Save()
- func (p *RulesPage) SaveRule(rule *riddle.Rule)
- func (p *RulesPage) SetEditFunc(editFunc func(*riddle.Rule))
- func (p *RulesPage) SetRules(rules []riddle.Rule)
- func (p *RulesPage) SetSaveFunc(saveFunc func([]riddle.Rule))
- type SavePage
- type SetupPage
- type SolverDebugPage
- type Theme
Constants ¶
This section is empty.
Variables ¶
var DarkTheme = Theme{
TextColor: "white",
FieldTextColor: "white",
HighlightTextColor: "yellow",
FieldPlaceholderTextColor: "green",
BackgroundColor: "black",
FieldBackgroundColor: "blue",
DropdownBackgroundColor: "grey",
}
DarkTheme represents a dark theme
var LightTheme = Theme{
TextColor: "black",
FieldTextColor: "black",
HighlightTextColor: "red",
FieldPlaceholderTextColor: "white",
BackgroundColor: "white",
FieldBackgroundColor: "lightgrey",
DropdownBackgroundColor: "red",
}
LightTheme represents a light theme
var Themes = map[string]*Theme{ "dark": &DarkTheme, "light": &LightTheme, }
Themes contains the string-to-theme map
Functions ¶
func SetConsoleTitle ¶
SetConsoleTitle sets the console title
Types ¶
type AddRulePage ¶
type AddRulePage struct { Page // contains filtered or unexported fields }
AddRulePage is an input form to enter data for new rules
func NewRuleForm ¶
func NewRuleForm(modal ModalHandler) *AddRulePage
NewRuleForm returns a new RuleForm
func (*AddRulePage) EditRule ¶
func (p *AddRulePage) EditRule(rule *riddle.Rule)
EditRule sets up the form for editing an existing rule The given pointer will be supplied to the save function later, unless the user resets the form.
func (*AddRulePage) HandleSetup ¶
func (p *AddRulePage) HandleSetup(setup riddle.Setup)
HandleSetup configured the autocomplete and dropdown fields
func (*AddRulePage) Save ¶
func (p *AddRulePage) Save()
Save calls the save function on the currently edited or new rule
func (*AddRulePage) SetSaveFunc ¶
func (p *AddRulePage) SetSaveFunc(saveFunc func(*riddle.Rule))
SetSaveFunc sets a function that gets called on save
type App ¶
type App struct { *PageHandler SetupForm *SetupPage RuleForm *AddRulePage RuleList *RulesPage // contains filtered or unexported fields }
App handles the user interface
type LoadPage ¶
type LoadPage struct { Page // contains filtered or unexported fields }
LoadPage is a UI list element that contains loadable riddles
func NewLoadPage ¶
func NewLoadPage(modal ModalHandler) *LoadPage
NewLoadPage returns a new LoadPage
type ModalHandler ¶
ModalHandler is an interface that handles modal dialogs
type PageHandler ¶
type PageHandler struct { tview.Primitive Quit chan bool // contains filtered or unexported fields }
PageHandler handles the layout of the application, pages and modal dialogs
func (*PageHandler) AddPage ¶
func (ph *PageHandler) AddPage(page Page) *PageHandler
AddPage adds a publicly listed page to the frame
func (*PageHandler) InputCapture ¶
func (ph *PageHandler) InputCapture() func(event *tcell.EventKey) *tcell.EventKey
InputCapture returns a function that handles input capture for PageHandler
func (*PageHandler) ModalMessage ¶
func (ph *PageHandler) ModalMessage(msg string)
ModalMessage displays a modal window with a message and OK button
func (*PageHandler) ModalYesNo ¶
func (ph *PageHandler) ModalYesNo(msg string, yes func())
ModalYesNo displays a modal dialog with a message and yes/no options
func (*PageHandler) SwitchToPage ¶
func (ph *PageHandler) SwitchToPage(page int)
SwitchToPage switches to the page with the number 'page'
type ResultsPage ¶
type ResultsPage struct { Page // contains filtered or unexported fields }
ResultsPage is a UI tree element that lets the user browse the riddle results
func NewResultsTree ¶
func NewResultsTree(modal ModalHandler) *ResultsPage
NewResultsTree returns a new ResultsTree
func (*ResultsPage) HandleRules ¶
func (p *ResultsPage) HandleRules(rules []riddle.Rule)
HandleRules updates the inner stored rules
func (*ResultsPage) HandleSetup ¶
func (p *ResultsPage) HandleSetup(setup riddle.Setup)
HandleSetup updates the inner stored setup
func (*ResultsPage) Update ¶
func (p *ResultsPage) Update()
Update updates the results based on the latest setup and rules
type RulesPage ¶
type RulesPage struct { Page // contains filtered or unexported fields }
RulesPage is a UI element that contains the list of rules
func NewRuleList ¶
func NewRuleList(modal ModalHandler) *RulesPage
NewRuleList returns a new RuleList
func (*RulesPage) HandleSetup ¶
HandleSetup filters the list based on the new setup
func (*RulesPage) Save ¶
func (p *RulesPage) Save()
Save calls the save function/callback with the list of rules
func (*RulesPage) SetEditFunc ¶
SetEditFunc sets a function that gets called on the selected rule
func (*RulesPage) SetSaveFunc ¶
SetSaveFunc sets a function that gets the list of all rules upon an update
type SavePage ¶
type SavePage struct { Page // contains filtered or unexported fields }
SavePage is UI form element for saving the current riddle
func NewSavePage ¶
func NewSavePage(modal ModalHandler) *SavePage
NewSavePage returns a new SavePage
type SetupPage ¶
type SetupPage struct { Page // contains filtered or unexported fields }
SetupPage is a form where the user can input riddle item types and values
func NewSetupForm ¶
func NewSetupForm(modal ModalHandler) *SetupPage
NewSetupForm returns a new SetupForm
func (*SetupPage) AddItemType ¶
AddItemType adds a new item type field with the provided values or uses an existing empty one
func (*SetupPage) Save ¶
func (p *SetupPage) Save()
Save collects all the form data and passes it to the save function
func (*SetupPage) SetSaveFunc ¶
SetSaveFunc sets a function that gets called when data is saved
type SolverDebugPage ¶
type SolverDebugPage struct { Page // contains filtered or unexported fields }
SolverDebugPage shows solver internals
func NewSolverDebugTree ¶
func NewSolverDebugTree(modal ModalHandler) *SolverDebugPage
NewSolverDebugTree returns a new SolverDebugTree
func (*SolverDebugPage) HandleRules ¶
func (p *SolverDebugPage) HandleRules(rules []riddle.Rule)
HandleRules updates the inner stored rules
func (*SolverDebugPage) HandleSetup ¶
func (p *SolverDebugPage) HandleSetup(setup riddle.Setup)
HandleSetup updates the inner stored setup
func (*SolverDebugPage) Update ¶
func (p *SolverDebugPage) Update()
Update updates the results based on the latest setup and rules