74 lines
1.6 KiB
Go
74 lines
1.6 KiB
Go
package repostatus
|
|
|
|
import (
|
|
"go.wit.com/lib/gadgets"
|
|
"go.wit.com/lib/protobuf/gitpb"
|
|
|
|
"go.wit.com/gui"
|
|
)
|
|
|
|
type repoWindow struct {
|
|
repo *gitpb.Repo // the repo protobuf
|
|
win *gadgets.BasicWindow // the patches window
|
|
stack *gui.Node // the top box set as vertical
|
|
//shelf *gui.Node // the first box in the stack, set as horizontal
|
|
//grid *gui.Node // the list of available patches
|
|
//setgrid *gui.Node // the list of each patchset
|
|
}
|
|
|
|
// todo: autogenerate these or make them standared 'gui' package functions
|
|
// make this an go interface somehow
|
|
|
|
// is the window hidden right now?
|
|
func (w *repoWindow) Hidden() bool {
|
|
return w.win.Hidden()
|
|
}
|
|
|
|
// switches between the window being visable or hidden on the desktop
|
|
func (w *repoWindow) Toggle() {
|
|
if w.Hidden() {
|
|
w.Show()
|
|
} else {
|
|
w.Hide()
|
|
}
|
|
}
|
|
|
|
// hides the window completely
|
|
func (w *repoWindow) Show() {
|
|
w.win.Show()
|
|
}
|
|
|
|
func (w *repoWindow) Hide() {
|
|
w.win.Hide()
|
|
}
|
|
|
|
// should be the first box/widget in the window
|
|
// greys out the window to the user
|
|
func (w *repoWindow) Disable() {
|
|
w.stack.Disable()
|
|
}
|
|
|
|
func (w *repoWindow) Enable() {
|
|
w.stack.Enable()
|
|
}
|
|
|
|
// you can only have one of these
|
|
func MakeRepoWindow(repo *gitpb.Repo) *repoWindow {
|
|
pw := new(repoWindow)
|
|
|
|
// sync.Once()
|
|
pw.win = gadgets.RawBasicWindow("Patcheset for " + repo.GetGoPath())
|
|
pw.win.Make()
|
|
|
|
pw.stack = pw.win.Box().NewBox("bw vbox", false)
|
|
// me.reposwin.Draw()
|
|
pw.win.Custom = func() {
|
|
// sets the hidden flag to false so Toggle() works
|
|
pw.win.Hide()
|
|
}
|
|
|
|
// grid := pw.stack.NewGrid("", 0, 0)
|
|
|
|
return pw
|
|
}
|