andlabs/add.go

72 lines
1.2 KiB
Go

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