tree/structs.go

57 lines
1.3 KiB
Go

package tree
/*
There are some helper functions that are probably going to be
the same everywhere. Mostly due to handling the binary tree structure
and the channel communication
*/
import (
"go.wit.com/widget"
)
// this is the root node of the binary tree
// There is only one of these per application
var treeRoot *Node
type TreeInfo struct {
PluginName string
// this is the channel we send user events like
// mouse clicks or keyboard events back to the program
callback chan widget.Action
// this is the channel we get requests to make widgets
pluginChan chan widget.Action
// NodeI interface{}
// ActionFromChannel func(widget.Action)
NodeAction func(*Node, widget.ActionType)
Add func(*Node)
AddText func(*Node, string)
SetText func(*Node, string)
SetTitle func(*Node, string)
SetLabel func(*Node, string)
SetChecked func(*Node, bool)
ToolkitClose func()
}
type Node struct {
Parent *Node
children []*Node
WidgetId int // widget ID
WidgetType widget.WidgetType
ParentId int // parent ID
State widget.State
ddStrings []string
// the internal plugin toolkit structure
// in the gtk plugin, it has gtk things like margin & border settings
// in the text console one, it has text console things like colors for menus & buttons
TK any
}