56 lines
1.4 KiB
Go
56 lines
1.4 KiB
Go
|
package main
|
||
|
|
||
|
import "log"
|
||
|
// import "os"
|
||
|
|
||
|
import "git.wit.org/wit/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.AddButton(name, func (*gui.Node) {
|
||
|
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
|
||
|
}
|