logsettings/settings.go

52 lines
803 B
Go
Raw Normal View History

2024-01-15 15:17:51 -06:00
package logsettings
import (
"go.wit.com/gui"
"go.wit.com/log"
2024-01-15 15:17:51 -06:00
)
// This initializes the main object
// You can only have one of these
func New(p *gui.Node) *LogSettings {
if myLogGui != nil {
return myLogGui
}
2024-01-15 15:17:51 -06:00
myLogGui = new(LogSettings)
myLogGui.parent = p
myLogGui.groups = make(map[string]*flagGroup)
myLogGui.ready = true
myLogGui.hidden = true
return myLogGui
}
// Returns true if the status is valid
func (d *LogSettings) Ready() bool {
if d == nil {
return false
}
if !d.parent.Ready() {
return false
}
if d.win == nil {
2024-01-15 15:17:51 -06:00
d.draw()
}
return d.ready
}
func (d *LogSettings) Update() bool {
if !d.Ready() {
return false
}
2024-01-15 15:17:51 -06:00
return true
}
func (d *LogSettings) ShowFlags() {
log.ShowFlags()
return
}
func (d *LogSettings) SetAll(b bool) {
log.SetAll(b)
return
}