wit-debian-gui/gui-button.go

58 lines
1.4 KiB
Go
Raw Permalink Normal View History

2021-11-02 23:44:28 -05:00
package main
import "log"
2021-11-02 23:44:28 -05:00
// import "os"
import "go.wit.com/gui"
2021-11-02 23:44:28 -05:00
// 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
2021-11-02 23:44:28 -05:00
}
// 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
2021-11-02 23:44:28 -05:00
// 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
2021-11-02 23:44:28 -05:00
// val.Action = action
return val
}
func makeXtermButton(n *gui.Node, name string, action string, custom string) *gui.Node {
n.NewButton(name, func() {
2021-11-02 23:44:28 -05:00
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
}