forge/windowNew.go

95 lines
1.5 KiB
Go

package main
import (
"sync"
"go.wit.com/lib/gadgets"
"go.wit.com/log"
"go.wit.com/gui"
)
type patchesWindow struct {
once sync.Once
win *gadgets.BasicWindow
stack *gui.Node
// the top box of the repolist window
shelf *gui.Node
summary *patchSummary
}
func (r *patchesWindow) Hidden() bool {
return r.win.Hidden()
}
func (r *patchesWindow) Toggle() {
if r.Hidden() {
r.Show()
} else {
r.Hide()
}
}
func (r *patchesWindow) Show() {
r.win.Show()
}
func (r *patchesWindow) Hide() {
r.win.Hide()
}
func (r *patchesWindow) Disable() {
r.stack.Disable()
}
func (r *patchesWindow) Enable() {
r.stack.Enable()
}
// you can only have one of these
func (r *patchesWindow) initWindow() {
// sync.Once()
r.win = gadgets.RawBasicWindow("Forge Patchesets")
r.win.Make()
r.stack = r.win.Box().NewBox("bw vbox", false)
// me.reposwin.Draw()
r.win.Custom = func() {
log.Warn("Patchset Window close. setting hidden=true")
// sets the hidden flag to false so Toggle() works
r.win.Hide()
}
r.shelf = r.initGroup()
r.summary = submitPatchesBox(r.stack)
}
func (r *patchesWindow) initGroup() *gui.Node {
// reposbox.SetExpand(false)
group1 := r.stack.NewGroup("stuff")
vbox := group1.Box()
// hbox.Horizontal()
vbox.Vertical()
hbox := vbox.Box().Horizontal()
/*
*/
dirty := hbox.NewCheckbox("dirty")
dirty.Custom = func() {
log.Info("filter dirty =", dirty.Checked())
}
hbox.NewButton("update patch summary", func() {
r.summary.Update()
})
hbox.NewButton("test add", func() {
me.patchWin.initGroup()
})
return vbox
}