summaryrefslogtreecommitdiff
path: root/structs.go
blob: 1ae9682f2a3eee8c0ef5a9a6a5a895c65563ba99 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
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"
)

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

	treeRoot          *Node
	// 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)
}

type Node struct {
	Parent   *Node
	children []*Node

	WidgetId   int // widget ID
	WidgetType widget.WidgetType
	ParentId   int // parent ID

	State widget.State

	Strings map[string]int

	// 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
}