andlabs/add.go

59 lines
1.1 KiB
Go

package main
import (
"go.wit.com/log"
"go.wit.com/toolkits/tree"
"go.wit.com/widget"
)
func add(a *widget.Action) *tree.Node {
log.Log(ANDLABS, "add()", a.WidgetId, a.WidgetType, a.State.ProgName)
if a.WidgetType == widget.Root {
if me.treeRoot == nil {
me.treeRoot = me.myTree.AddNode(a)
}
return me.treeRoot
}
n := me.myTree.AddNode(a)
p := n.Parent
switch n.WidgetType {
case widget.Window:
newWindow(p, n)
case widget.Group:
newGroup(p, n)
case widget.Grid:
newGrid(n)
case widget.Box:
newBox(n)
case widget.Label:
newLabel(p, n)
case widget.Button:
newButton(p, n)
case widget.Checkbox:
newCheckbox(p, n)
setChecked(n, a.State.Checked)
case widget.Spinner:
newSpinner(p, n)
case widget.Slider:
newSlider(p, n)
case widget.Dropdown:
newDropdown(p, n)
setText(n, a)
case widget.Combobox:
newCombobox(p, n)
setText(n, a)
case widget.Textbox:
newTextbox(p, n)
setText(n, a)
/*
case widget.Image:
newImage(p, n)
*/
default:
log.Log(ERROR, "add() error TODO: ", n.WidgetType, n.State.ProgName)
}
return n
}