package main

import (
	"go.wit.com/log"
	"go.wit.com/gui/widget"
)

func add(a *widget.Action) {
	if (a.WidgetType == widget.Root) {
		me.rootNode = addNode(a)
		return
	}
	n := addNode(a)

	p := n.parent
	switch n.WidgetType {
	case widget.Window:
		newWindow(n)
		return
	case widget.Tab:
		p.newTab(n)
		return
	case widget.Label:
		p.newLabel(n)
		return
	case widget.Button:
		p.newButton(n)
		return
	case widget.Grid:
		p.newGrid(n)
		return
	case widget.Checkbox:
		p.newCheckbox(n)
		return
	case widget.Spinner:
		p.newSpinner(n)
		return
	case widget.Slider:
		p.newSlider(n)
		return
	case widget.Dropdown:
		p.newDropdown(n)
		return
	case widget.Combobox:
		p.newCombobox(n)
		return
	case widget.Textbox:
		p.newTextbox(n)
		return
	case widget.Group:
		p.newGroup(n)
		return
	case widget.Box:
		p.newBox(n)
		return
	case widget.Image:
		p.newImage(n)
		return
	default:
		log.Log(ERROR, "add() error TODO: ", n.WidgetType, n.progname)
	}
}
