wit-debian-gui/gui-button.go

58 lines
1.4 KiB
Go

package main
import "log"
// import "os"
import "go.wit.com/gui"
// import "github.com/skratchdot/open-golang/open"
// import "github.com/davecgh/go-spew/spew"
//
// This was the default handler for all mouse clicks (buttons, areas, etc))
//
// Most mouse clicks are now moved to custom functions
//
type myButtonInfo struct {
Custom func(*gui.Node)
ADD func(*gui.Node)
Name string
Action string
Node *gui.Node
}
// stores the fields we want to map into our private structure 'values'
func makeButtonValues(n *gui.Node, name string, action string, custom func(*gui.Node)) *myButtonInfo {
val := &myButtonInfo{}
val.Custom = custom
val.Name = name
// val.Action = action
return val
}
// stores the fields we want to map into our private structure 'values'
func newMmakeButtonValues(name string, custom func(*gui.Node)) *myButtonInfo {
val := &myButtonInfo{}
val.Custom = custom
val.Name = name
// val.Action = action
return val
}
func makeXtermButton(n *gui.Node, name string, action string, custom string) *gui.Node {
n.NewButton(name, func() {
log.Println("xterm cmd=", custom)
xterm(custom)
})
return nil
}
func makeColorButton(n *gui.Node, name string, action string, custom func(*gui.Node)) *gui.Node {
val := makeButtonValues(n, name, action, custom)
log.Println("val =", val)
// return gui.CreateColorButton(n, custom, name, val)
return nil
}