2024-01-01 16:11:54 -06:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2024-01-08 21:19:42 -06:00
|
|
|
"go.wit.com/log"
|
2024-01-05 13:30:00 -06:00
|
|
|
"go.wit.com/gui/widget"
|
2024-01-01 16:11:54 -06:00
|
|
|
)
|
|
|
|
|
2024-01-05 13:30:00 -06:00
|
|
|
func actionDump(b bool, a *widget.Action) {
|
2024-01-08 21:19:42 -06:00
|
|
|
log.Log(NOW, "actionDump() Widget.Type =", a.ActionType)
|
|
|
|
log.Log(NOW, "actionDump() Widget.S =", a.S)
|
|
|
|
log.Log(NOW, "actionDump() Widget.I =", a.I)
|
|
|
|
log.Log(NOW, "actionDump() WidgetId =", a.WidgetId)
|
|
|
|
log.Log(NOW, "actionDump() ParentId =", a.ParentId)
|
2024-01-01 16:11:54 -06:00
|
|
|
}
|
|
|
|
|
2024-01-05 13:30:00 -06:00
|
|
|
func add(a *widget.Action) {
|
|
|
|
if (a.WidgetType == widget.Root) {
|
2024-01-01 16:11:54 -06:00
|
|
|
me.rootNode = addNode(a)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
n := addNode(a)
|
|
|
|
|
|
|
|
p := n.parent
|
|
|
|
switch n.WidgetType {
|
2024-01-05 13:30:00 -06:00
|
|
|
case widget.Window:
|
2024-01-01 16:11:54 -06:00
|
|
|
newWindow(n)
|
|
|
|
return
|
2024-01-05 13:30:00 -06:00
|
|
|
case widget.Tab:
|
2024-01-01 16:11:54 -06:00
|
|
|
p.newTab(n)
|
|
|
|
return
|
2024-01-05 13:30:00 -06:00
|
|
|
case widget.Label:
|
2024-01-01 16:11:54 -06:00
|
|
|
p.newLabel(n)
|
|
|
|
return
|
2024-01-05 13:30:00 -06:00
|
|
|
case widget.Button:
|
2024-01-01 16:11:54 -06:00
|
|
|
p.newButton(n)
|
|
|
|
return
|
2024-01-05 13:30:00 -06:00
|
|
|
case widget.Grid:
|
2024-01-01 16:11:54 -06:00
|
|
|
p.newGrid(n)
|
|
|
|
return
|
2024-01-05 13:30:00 -06:00
|
|
|
case widget.Checkbox:
|
2024-01-01 16:11:54 -06:00
|
|
|
p.newCheckbox(n)
|
|
|
|
return
|
2024-01-05 13:30:00 -06:00
|
|
|
case widget.Spinner:
|
2024-01-01 16:11:54 -06:00
|
|
|
p.newSpinner(n)
|
|
|
|
return
|
2024-01-05 13:30:00 -06:00
|
|
|
case widget.Slider:
|
2024-01-01 16:11:54 -06:00
|
|
|
p.newSlider(n)
|
|
|
|
return
|
2024-01-05 13:30:00 -06:00
|
|
|
case widget.Dropdown:
|
2024-01-01 16:11:54 -06:00
|
|
|
p.newDropdown(n)
|
|
|
|
return
|
2024-01-05 13:30:00 -06:00
|
|
|
case widget.Combobox:
|
2024-01-01 16:11:54 -06:00
|
|
|
p.newCombobox(n)
|
|
|
|
return
|
2024-01-05 13:30:00 -06:00
|
|
|
case widget.Textbox:
|
2024-01-01 16:11:54 -06:00
|
|
|
p.newTextbox(n)
|
|
|
|
return
|
2024-01-05 13:30:00 -06:00
|
|
|
case widget.Group:
|
2024-01-01 16:11:54 -06:00
|
|
|
p.newGroup(n)
|
|
|
|
return
|
2024-01-05 13:30:00 -06:00
|
|
|
case widget.Box:
|
2024-01-01 16:11:54 -06:00
|
|
|
p.newBox(n)
|
|
|
|
return
|
2024-01-05 13:30:00 -06:00
|
|
|
case widget.Image:
|
2024-01-01 16:11:54 -06:00
|
|
|
p.newImage(n)
|
|
|
|
return
|
|
|
|
default:
|
2024-01-08 21:19:42 -06:00
|
|
|
log.Log(ERROR, "add() error TODO: ", n.WidgetType, n.Name)
|
2024-01-01 16:11:54 -06:00
|
|
|
}
|
|
|
|
}
|