logsettings/settings.go

64 lines
1013 B
Go

package logsettings
import (
"go.wit.com/gui"
"go.wit.com/log"
)
func LogWindow() *LogSettings {
if myLogGui != nil {
myLogGui.Toggle()
return myLogGui
}
myLogGui = NewWindow()
myLogGui.draw()
myLogGui.win.Toggle()
myLogGui.win.Toggle()
return myLogGui
}
// This initializes the main object
// You can only have one of these
func NewWindow() *LogSettings {
if myLogGui != nil {
return myLogGui
}
myLogGui = new(LogSettings)
myLogGui.parent = gui.TreeRoot()
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 {
d.draw()
}
return d.ready
}
func (d *LogSettings) Update() bool {
if !d.Ready() {
return false
}
return true
}
func (d *LogSettings) ShowFlags() {
log.ShowFlags()
return
}
func (d *LogSettings) SetAll(b bool) {
log.SetAll(b)
return
}