andlabs compiles with 'go.wit.com/gui/widget'

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-01-05 13:30:00 -06:00
parent b9868cc873
commit 327e14f051
9 changed files with 130 additions and 130 deletions

View File

@ -3,7 +3,7 @@ package main
import ( import (
"strconv" "strconv"
"github.com/andlabs/ui" "github.com/andlabs/ui"
"go.wit.com/gui/toolkits" "go.wit.com/gui/widget"
) )
func (n *node) show(b bool) { func (n *node) show(b bool) {
@ -37,7 +37,7 @@ func (n *node) enable(b bool) {
} }
} }
func (n *node) pad(at toolkit.ActionType) { func (n *node) pad(at widget.ActionType) {
log(logInfo, "pad() on WidgetId =", n.WidgetId) log(logInfo, "pad() on WidgetId =", n.WidgetId)
t := n.tk t := n.tk
@ -47,62 +47,62 @@ func (n *node) pad(at toolkit.ActionType) {
} }
switch n.WidgetType { switch n.WidgetType {
case toolkit.Group: case widget.Group:
switch at { switch at {
case toolkit.Margin: case widget.Margin:
t.uiGroup.SetMargined(true) t.uiGroup.SetMargined(true)
case toolkit.Unmargin: case widget.Unmargin:
t.uiGroup.SetMargined(false) t.uiGroup.SetMargined(false)
case toolkit.Pad: case widget.Pad:
t.uiGroup.SetMargined(true) t.uiGroup.SetMargined(true)
case toolkit.Unpad: case widget.Unpad:
t.uiGroup.SetMargined(false) t.uiGroup.SetMargined(false)
} }
case toolkit.Tab: case widget.Tab:
switch at { switch at {
case toolkit.Margin: case widget.Margin:
tabSetMargined(t.uiTab, true) tabSetMargined(t.uiTab, true)
case toolkit.Unmargin: case widget.Unmargin:
tabSetMargined(t.uiTab, false) tabSetMargined(t.uiTab, false)
case toolkit.Pad: case widget.Pad:
tabSetMargined(t.uiTab, true) tabSetMargined(t.uiTab, true)
case toolkit.Unpad: case widget.Unpad:
tabSetMargined(t.uiTab, false) tabSetMargined(t.uiTab, false)
} }
case toolkit.Window: case widget.Window:
switch at { switch at {
case toolkit.Margin: case widget.Margin:
t.uiWindow.SetMargined(true) t.uiWindow.SetMargined(true)
case toolkit.Unmargin: case widget.Unmargin:
t.uiWindow.SetMargined(false) t.uiWindow.SetMargined(false)
case toolkit.Pad: case widget.Pad:
t.uiWindow.SetBorderless(false) t.uiWindow.SetBorderless(false)
case toolkit.Unpad: case widget.Unpad:
t.uiWindow.SetBorderless(true) t.uiWindow.SetBorderless(true)
} }
case toolkit.Grid: case widget.Grid:
switch at { switch at {
case toolkit.Margin: case widget.Margin:
t.uiGrid.SetPadded(true) t.uiGrid.SetPadded(true)
case toolkit.Unmargin: case widget.Unmargin:
t.uiGrid.SetPadded(false) t.uiGrid.SetPadded(false)
case toolkit.Pad: case widget.Pad:
t.uiGrid.SetPadded(true) t.uiGrid.SetPadded(true)
case toolkit.Unpad: case widget.Unpad:
t.uiGrid.SetPadded(false) t.uiGrid.SetPadded(false)
} }
case toolkit.Box: case widget.Box:
switch at { switch at {
case toolkit.Margin: case widget.Margin:
t.uiBox.SetPadded(true) t.uiBox.SetPadded(true)
case toolkit.Unmargin: case widget.Unmargin:
t.uiBox.SetPadded(false) t.uiBox.SetPadded(false)
case toolkit.Pad: case widget.Pad:
t.uiBox.SetPadded(true) t.uiBox.SetPadded(true)
case toolkit.Unpad: case widget.Unpad:
t.uiBox.SetPadded(false) t.uiBox.SetPadded(false)
} }
case toolkit.Textbox: case widget.Textbox:
log(debugError, "TODO: implement ActionType =", at) log(debugError, "TODO: implement ActionType =", at)
default: default:
log(debugError, "TODO: implement pad() for", at) log(debugError, "TODO: implement pad() for", at)
@ -113,14 +113,14 @@ func (n *node) move(newParent *node) {
p := n.parent p := n.parent
switch p.WidgetType { switch p.WidgetType {
case toolkit.Group: case widget.Group:
case toolkit.Tab: case widget.Tab:
// tabSetMargined(tParent.uiTab, true) // tabSetMargined(tParent.uiTab, true)
case toolkit.Window: case widget.Window:
// t.uiWindow.SetBorderless(false) // t.uiWindow.SetBorderless(false)
case toolkit.Grid: case widget.Grid:
// t.uiGrid.SetPadded(true) // t.uiGrid.SetPadded(true)
case toolkit.Box: case widget.Box:
log(logInfo, "TODO: move() where =", p.ParentId) log(logInfo, "TODO: move() where =", p.ParentId)
log(logInfo, "TODO: move() for widget =", n.WidgetId) log(logInfo, "TODO: move() for widget =", n.WidgetId)
@ -146,15 +146,15 @@ func (n *node) Delete() {
log(debugNow, "uiDelete()", n.WidgetId, "to", p.WidgetId) log(debugNow, "uiDelete()", n.WidgetId, "to", p.WidgetId)
switch p.WidgetType { switch p.WidgetType {
case toolkit.Group: case widget.Group:
// tParent.uiGroup.SetMargined(true) // tParent.uiGroup.SetMargined(true)
case toolkit.Tab: case widget.Tab:
// tabSetMargined(tParent.uiTab, true) // tabSetMargined(tParent.uiTab, true)
case toolkit.Window: case widget.Window:
// t.uiWindow.SetBorderless(false) // t.uiWindow.SetBorderless(false)
case toolkit.Grid: case widget.Grid:
// t.uiGrid.SetPadded(true) // t.uiGrid.SetPadded(true)
case toolkit.Box: case widget.Box:
log(debugNow, "tWidget.boxC =", p.Name) log(debugNow, "tWidget.boxC =", p.Name)
log(debugNow, "is there a tParent parent? =", p.parent) log(debugNow, "is there a tParent parent? =", p.parent)
if (p.tk.boxC < 1) { if (p.tk.boxC < 1) {
@ -174,11 +174,11 @@ func (n *node) Delete() {
} }
} }
func rawAction(a *toolkit.Action) { func rawAction(a *widget.Action) {
log(logInfo, "rawAction() START a.ActionType =", a.ActionType) log(logInfo, "rawAction() START a.ActionType =", a.ActionType)
log(logInfo, "rawAction() START a.S =", a.S) log(logInfo, "rawAction() START a.S =", a.S)
if (a.ActionType == toolkit.InitToolkit) { if (a.ActionType == widget.InitToolkit) {
// TODO: make sure to only do this once // TODO: make sure to only do this once
// go uiMain.Do(func() { // go uiMain.Do(func() {
// ui.Main(demoUI) // ui.Main(demoUI)
@ -190,14 +190,14 @@ func rawAction(a *toolkit.Action) {
log(logInfo, "rawAction() START a.WidgetId =", a.WidgetId, "a.ParentId =", a.ParentId) log(logInfo, "rawAction() START a.WidgetId =", a.WidgetId, "a.ParentId =", a.ParentId)
switch a.WidgetType { switch a.WidgetType {
case toolkit.Flag: case widget.Flag:
flag(a) flag(a)
return return
} }
n := me.rootNode.findWidgetId(a.WidgetId) n := me.rootNode.findWidgetId(a.WidgetId)
if (a.ActionType == toolkit.Add) { if (a.ActionType == widget.Add) {
ui.QueueMain(func() { ui.QueueMain(func() {
add(a) add(a)
}) })
@ -206,7 +206,7 @@ func rawAction(a *toolkit.Action) {
return return
} }
if (a.ActionType == toolkit.Dump) { if (a.ActionType == widget.Dump) {
log(debugNow, "rawAction() Dump =", a.ActionType, a.WidgetType, n.Name) log(debugNow, "rawAction() Dump =", a.ActionType, a.WidgetType, n.Name)
me.rootNode.listChildren(true) me.rootNode.listChildren(true)
return return
@ -223,38 +223,38 @@ func rawAction(a *toolkit.Action) {
} }
switch a.ActionType { switch a.ActionType {
case toolkit.Show: case widget.Show:
n.show(true) n.show(true)
case toolkit.Hide: case widget.Hide:
n.show(false) n.show(false)
case toolkit.Enable: case widget.Enable:
n.enable(true) n.enable(true)
case toolkit.Disable: case widget.Disable:
n.enable(false) n.enable(false)
case toolkit.Get: case widget.Get:
n.setText(a) n.setText(a)
case toolkit.GetText: case widget.GetText:
switch a.WidgetType { switch a.WidgetType {
case toolkit.Textbox: case widget.Textbox:
a.S = n.S a.S = n.S
} }
case toolkit.Set: case widget.Set:
n.setText(a) n.setText(a)
case toolkit.SetText: case widget.SetText:
n.setText(a) n.setText(a)
case toolkit.AddText: case widget.AddText:
n.setText(a) n.setText(a)
case toolkit.Margin: case widget.Margin:
n.pad(toolkit.Unmargin) n.pad(widget.Unmargin)
case toolkit.Unmargin: case widget.Unmargin:
n.pad(toolkit.Margin) n.pad(widget.Margin)
case toolkit.Pad: case widget.Pad:
n.pad(toolkit.Pad) n.pad(widget.Pad)
case toolkit.Unpad: case widget.Unpad:
n.pad(toolkit.Unpad) n.pad(widget.Unpad)
case toolkit.Delete: case widget.Delete:
n.Delete() n.Delete()
case toolkit.Move: case widget.Move:
log(debugNow, "rawAction() attempt to move() =", a.ActionType, a.WidgetType) log(debugNow, "rawAction() attempt to move() =", a.ActionType, a.WidgetType)
newParent := me.rootNode.findWidgetId(a.ParentId) newParent := me.rootNode.findWidgetId(a.ParentId)
n.move(newParent) n.move(newParent)

View File

@ -4,10 +4,10 @@ import (
"github.com/andlabs/ui" "github.com/andlabs/ui"
_ "github.com/andlabs/ui/winmanifest" _ "github.com/andlabs/ui/winmanifest"
"go.wit.com/gui/toolkits" "go.wit.com/gui/widget"
) )
func actionDump(b bool, a *toolkit.Action) { func actionDump(b bool, a *widget.Action) {
log(b, "actionDump() Widget.Type =", a.ActionType) log(b, "actionDump() Widget.Type =", a.ActionType)
log(b, "actionDump() Widget.S =", a.S) log(b, "actionDump() Widget.S =", a.S)
log(b, "actionDump() Widget.I =", a.I) log(b, "actionDump() Widget.I =", a.I)
@ -15,8 +15,8 @@ func actionDump(b bool, a *toolkit.Action) {
log(b, "actionDump() ParentId =", a.ParentId) log(b, "actionDump() ParentId =", a.ParentId)
} }
func add(a *toolkit.Action) { func add(a *widget.Action) {
if (a.WidgetType == toolkit.Root) { if (a.WidgetType == widget.Root) {
me.rootNode = addNode(a) me.rootNode = addNode(a)
return return
} }
@ -24,46 +24,46 @@ func add(a *toolkit.Action) {
p := n.parent p := n.parent
switch n.WidgetType { switch n.WidgetType {
case toolkit.Window: case widget.Window:
newWindow(n) newWindow(n)
return return
case toolkit.Tab: case widget.Tab:
p.newTab(n) p.newTab(n)
return return
case toolkit.Label: case widget.Label:
p.newLabel(n) p.newLabel(n)
return return
case toolkit.Button: case widget.Button:
p.newButton(n) p.newButton(n)
return return
case toolkit.Grid: case widget.Grid:
p.newGrid(n) p.newGrid(n)
return return
case toolkit.Checkbox: case widget.Checkbox:
p.newCheckbox(n) p.newCheckbox(n)
return return
case toolkit.Spinner: case widget.Spinner:
p.newSpinner(n) p.newSpinner(n)
return return
case toolkit.Slider: case widget.Slider:
p.newSlider(n) p.newSlider(n)
return return
case toolkit.Dropdown: case widget.Dropdown:
p.newDropdown(n) p.newDropdown(n)
return return
case toolkit.Combobox: case widget.Combobox:
p.newCombobox(n) p.newCombobox(n)
return return
case toolkit.Textbox: case widget.Textbox:
p.newTextbox(n) p.newTextbox(n)
return return
case toolkit.Group: case widget.Group:
p.newGroup(n) p.newGroup(n)
return return
case toolkit.Box: case widget.Box:
p.newBox(n) p.newBox(n)
return return
case toolkit.Image: case widget.Image:
p.newImage(n) p.newImage(n)
return return
default: default:
@ -106,7 +106,7 @@ func (p *node) place(n *node) bool {
log(logInfo, "place() switch", p.WidgetType) log(logInfo, "place() switch", p.WidgetType)
switch p.WidgetType { switch p.WidgetType {
case toolkit.Grid: case widget.Grid:
log(logInfo, "place() Grid try at Parent X,Y =", n.X, n.Y) log(logInfo, "place() Grid try at Parent X,Y =", n.X, n.Y)
n.tk.gridX = n.AtW - 1 n.tk.gridX = n.AtW - 1
n.tk.gridY = n.AtH - 1 n.tk.gridY = n.AtH - 1
@ -116,7 +116,7 @@ func (p *node) place(n *node) bool {
n.tk.gridX, n.tk.gridY, 1, 1, n.tk.gridX, n.tk.gridY, 1, 1,
false, ui.AlignFill, false, ui.AlignFill) false, ui.AlignFill, false, ui.AlignFill)
return true return true
case toolkit.Group: case widget.Group:
if (p.tk.uiBox == nil) { if (p.tk.uiBox == nil) {
p.tk.uiGroup.SetChild(n.tk.uiControl) p.tk.uiGroup.SetChild(n.tk.uiControl)
log(logInfo, "place() hack Group to use this as the box?", n.Name, n.WidgetType) log(logInfo, "place() hack Group to use this as the box?", n.Name, n.WidgetType)
@ -125,7 +125,7 @@ func (p *node) place(n *node) bool {
p.tk.uiBox.Append(n.tk.uiControl, stretchy) p.tk.uiBox.Append(n.tk.uiControl, stretchy)
} }
return true return true
case toolkit.Tab: case widget.Tab:
if (p.tk.uiTab == nil) { if (p.tk.uiTab == nil) {
log(logError, "p.tk.uiTab == nil for n.WidgetId =", n.WidgetId, "p.tk =", p.tk) log(logError, "p.tk.uiTab == nil for n.WidgetId =", n.WidgetId, "p.tk =", p.tk)
panic("p.tk.uiTab == nil") panic("p.tk.uiTab == nil")
@ -141,13 +141,13 @@ func (p *node) place(n *node) bool {
p.tk.uiTab.Append(n.Text, n.tk.uiControl) p.tk.uiTab.Append(n.Text, n.tk.uiControl)
p.tk.boxC += 1 p.tk.boxC += 1
return true return true
case toolkit.Box: case widget.Box:
log(logInfo, "place() uiBox =", p.tk.uiBox) log(logInfo, "place() uiBox =", p.tk.uiBox)
log(logInfo, "place() uiControl =", n.tk.uiControl) log(logInfo, "place() uiControl =", n.tk.uiControl)
p.tk.uiBox.Append(n.tk.uiControl, stretchy) p.tk.uiBox.Append(n.tk.uiControl, stretchy)
p.tk.boxC += 1 p.tk.boxC += 1
return true return true
case toolkit.Window: case widget.Window:
p.tk.uiWindow.SetChild(n.tk.uiControl) p.tk.uiWindow.SetChild(n.tk.uiControl)
return true return true
default: default:

View File

@ -2,7 +2,7 @@ package main
import ( import (
"strconv" "strconv"
"go.wit.com/gui/toolkits" "go.wit.com/gui/widget"
) )
var defaultBehavior bool = true var defaultBehavior bool = true
@ -92,7 +92,7 @@ func GetDebugToolkit () bool {
} }
*/ */
func flag(a *toolkit.Action) { func flag(a *widget.Action) {
// should set the checkbox to this value // should set the checkbox to this value
switch a.S { switch a.S {
case "Quiet": case "Quiet":

View File

@ -2,7 +2,7 @@ package main
// if you include more than just this import // if you include more than just this import
// then your plugin might be doing something un-ideal (just a guess from 2023/02/27) // then your plugin might be doing something un-ideal (just a guess from 2023/02/27)
import "go.wit.com/gui/toolkits" import "go.wit.com/gui/widget"
// delete the child widget from the parent // delete the child widget from the parent
// p = parent, c = child // p = parent, c = child
@ -21,7 +21,7 @@ func (n *node) destroy() {
} }
switch n.WidgetType { switch n.WidgetType {
case toolkit.Button: case widget.Button:
log(true, "Should delete Button here:", n.Name) log(true, "Should delete Button here:", n.Name)
log(true, "Parent:") log(true, "Parent:")
pt.Dump(true) pt.Dump(true)
@ -39,7 +39,7 @@ func (n *node) destroy() {
ct.uiButton.Destroy() ct.uiButton.Destroy()
} }
case toolkit.Window: case widget.Window:
log(true, "Should delete Window here:", n.Name) log(true, "Should delete Window here:", n.Name)
default: default:
log(true, "Fuckit, let's destroy a button") log(true, "Fuckit, let's destroy a button")

View File

@ -4,7 +4,7 @@ import (
"github.com/andlabs/ui" "github.com/andlabs/ui"
_ "github.com/andlabs/ui/winmanifest" _ "github.com/andlabs/ui/winmanifest"
"go.wit.com/gui/toolkits" "go.wit.com/gui/widget"
) )
func (p *node) newDropdown(n *node) { func (p *node) newDropdown(n *node) {
@ -65,7 +65,7 @@ func (n *node) AddDropdownName(s string) {
t.addDropdownName(s) t.addDropdownName(s)
} }
func (n *node) SetDropdownName(a *toolkit.Action, s string) { func (n *node) SetDropdownName(a *widget.Action, s string) {
log(logInfo, "SetDropdown()", n.WidgetId, ",", s) log(logInfo, "SetDropdown()", n.WidgetId, ",", s)
t := n.tk t := n.tk

View File

@ -2,7 +2,7 @@ package main
import ( import (
"sync" "sync"
"go.wit.com/gui/toolkits" "go.wit.com/gui/widget"
"github.com/andlabs/ui" "github.com/andlabs/ui"
// the _ means we only need this for the init() // the _ means we only need this for the init()
@ -49,7 +49,7 @@ func init() {
}) })
// andlabs = make(map[int]*andlabsT) // andlabs = make(map[int]*andlabsT)
pluginChan = make(chan toolkit.Action, 1) pluginChan = make(chan widget.Action, 1)
log(logNow, "Init() start channel reciever") log(logNow, "Init() start channel reciever")
go catchActionChannel() go catchActionChannel()

View File

@ -1,10 +1,10 @@
package main package main
import ( import (
"go.wit.com/gui/toolkits" "go.wit.com/gui/widget"
) )
func (n *node) setText(a *toolkit.Action) { func (n *node) setText(a *widget.Action) {
log(debugChange, "setText() START with a.S =", a.S) log(debugChange, "setText() START with a.S =", a.S)
t := n.tk t := n.tk
if (t == nil) { if (t == nil) {
@ -15,33 +15,33 @@ func (n *node) setText(a *toolkit.Action) {
log(debugChange, "setText() Attempt on", n.WidgetType, "with", a.S) log(debugChange, "setText() Attempt on", n.WidgetType, "with", a.S)
switch n.WidgetType { switch n.WidgetType {
case toolkit.Window: case widget.Window:
t.uiWindow.SetTitle(a.S) t.uiWindow.SetTitle(a.S)
case toolkit.Tab: case widget.Tab:
case toolkit.Group: case widget.Group:
t.uiGroup.SetTitle(a.S) t.uiGroup.SetTitle(a.S)
case toolkit.Checkbox: case widget.Checkbox:
switch a.ActionType { switch a.ActionType {
case toolkit.SetText: case widget.SetText:
t.uiCheckbox.SetText(a.S) t.uiCheckbox.SetText(a.S)
case toolkit.Get: case widget.Get:
n.B = t.uiCheckbox.Checked() n.B = t.uiCheckbox.Checked()
case toolkit.Set: case widget.Set:
// TODO: commented out while working on chan // TODO: commented out while working on chan
t.uiCheckbox.SetChecked(a.B) t.uiCheckbox.SetChecked(a.B)
default: default:
log(debugError, "setText() unknown", a.ActionType, "on checkbox", n.Name) log(debugError, "setText() unknown", a.ActionType, "on checkbox", n.Name)
} }
case toolkit.Textbox: case widget.Textbox:
switch a.ActionType { switch a.ActionType {
case toolkit.Set: case widget.Set:
if (t.uiEntry != nil) { if (t.uiEntry != nil) {
t.uiEntry.SetText(a.S) t.uiEntry.SetText(a.S)
} }
if (t.uiMultilineEntry != nil) { if (t.uiMultilineEntry != nil) {
t.uiMultilineEntry.SetText(a.S) t.uiMultilineEntry.SetText(a.S)
} }
case toolkit.SetText: case widget.SetText:
if (t.uiEntry != nil) { if (t.uiEntry != nil) {
t.uiEntry.SetText(a.S) t.uiEntry.SetText(a.S)
} }
@ -51,33 +51,33 @@ func (n *node) setText(a *toolkit.Action) {
default: default:
log(debugError, "setText() unknown", a.ActionType, "on checkbox", n.Name) log(debugError, "setText() unknown", a.ActionType, "on checkbox", n.Name)
} }
case toolkit.Label: case widget.Label:
t.uiLabel.SetText(a.S) t.uiLabel.SetText(a.S)
case toolkit.Button: case widget.Button:
t.uiButton.SetText(a.S) t.uiButton.SetText(a.S)
case toolkit.Slider: case widget.Slider:
switch a.ActionType { switch a.ActionType {
case toolkit.Get: case widget.Get:
n.I = t.uiSlider.Value() n.I = t.uiSlider.Value()
case toolkit.Set: case widget.Set:
t.uiSlider.SetValue(a.I) t.uiSlider.SetValue(a.I)
default: default:
log(debugError, "setText() unknown", a.ActionType, "on checkbox", n.Name) log(debugError, "setText() unknown", a.ActionType, "on checkbox", n.Name)
} }
case toolkit.Spinner: case widget.Spinner:
switch a.ActionType { switch a.ActionType {
case toolkit.Get: case widget.Get:
n.I = t.uiSpinbox.Value() n.I = t.uiSpinbox.Value()
case toolkit.Set: case widget.Set:
t.uiSpinbox.SetValue(a.I) t.uiSpinbox.SetValue(a.I)
default: default:
log(debugError, "setText() unknown", a.ActionType, "on checkbox", n.Name) log(debugError, "setText() unknown", a.ActionType, "on checkbox", n.Name)
} }
case toolkit.Dropdown: case widget.Dropdown:
switch a.ActionType { switch a.ActionType {
case toolkit.AddText: case widget.AddText:
n.AddDropdownName(a.S) n.AddDropdownName(a.S)
case toolkit.Set: case widget.Set:
var orig int var orig int
var i int = -1 var i int = -1
var s string var s string
@ -101,21 +101,21 @@ func (n *node) setText(a *toolkit.Action) {
if (orig == -1) { if (orig == -1) {
t.uiCombobox.SetSelected(i) t.uiCombobox.SetSelected(i)
} }
case toolkit.Get: case widget.Get:
// t.S = t.s // t.S = t.s
case toolkit.GetText: case widget.GetText:
// t.S = t.s // t.S = t.s
default: default:
log(debugError, "setText() unknown", a.ActionType, "on checkbox", n.Name) log(debugError, "setText() unknown", a.ActionType, "on checkbox", n.Name)
} }
case toolkit.Combobox: case widget.Combobox:
switch a.ActionType { switch a.ActionType {
case toolkit.AddText: case widget.AddText:
t.AddComboboxName(a.S) t.AddComboboxName(a.S)
case toolkit.Set: case widget.Set:
t.uiEditableCombobox.SetText(a.S) t.uiEditableCombobox.SetText(a.S)
n.S = a.S n.S = a.S
case toolkit.SetText: case widget.SetText:
t.uiEditableCombobox.SetText(a.S) t.uiEditableCombobox.SetText(a.S)
n.S = a.S n.S = a.S
default: default:

View File

@ -1,7 +1,7 @@
package main package main
import ( import (
"go.wit.com/gui/toolkits" "go.wit.com/gui/widget"
"github.com/andlabs/ui" "github.com/andlabs/ui"
_ "github.com/andlabs/ui/winmanifest" _ "github.com/andlabs/ui/winmanifest"
@ -25,7 +25,7 @@ func (p *node) newTab(n *node) {
if (p == nil) { if (p == nil) {
log(debugError, "newTab() p == nil. how the fuck does this happen?", n.WidgetId, n.ParentId) log(debugError, "newTab() p == nil. how the fuck does this happen?", n.WidgetId, n.ParentId)
} }
if (p.WidgetType != toolkit.Window) { if (p.WidgetType != widget.Window) {
log(debugError, "newTab() uiWindow == nil. I can't add a toolbar without window", n.WidgetId, n.ParentId) log(debugError, "newTab() uiWindow == nil. I can't add a toolbar without window", n.WidgetId, n.ParentId)
return return
} }
@ -41,7 +41,7 @@ func (p *node) newTab(n *node) {
} else { } else {
// this means you have to append a tab // this means you have to append a tab
log(debugToolkit, "newTab() GOOD. This should be an additional tab:", n.WidgetId, n.ParentId) log(debugToolkit, "newTab() GOOD. This should be an additional tab:", n.WidgetId, n.ParentId)
if (n.WidgetType == toolkit.Tab) { if (n.WidgetType == widget.Tab) {
// andlabs doesn't have multiple tab widgets so make a fake one? // andlabs doesn't have multiple tab widgets so make a fake one?
// this makes a guiWidget internal structure with the parent values // this makes a guiWidget internal structure with the parent values
newt = new(guiWidget) newt = new(guiWidget)

View File

@ -1,7 +1,7 @@
package main package main
import ( import (
"go.wit.com/gui/toolkits" "go.wit.com/gui/widget"
) )
// this is specific to the nocui toolkit // this is specific to the nocui toolkit
@ -10,14 +10,14 @@ func initWidget(n *node) *guiWidget {
w = new(guiWidget) w = new(guiWidget)
// Set(w, "default") // Set(w, "default")
if n.WidgetType == toolkit.Root { if n.WidgetType == widget.Root {
log(logInfo, "setupWidget() FOUND ROOT w.id =", n.WidgetId) log(logInfo, "setupWidget() FOUND ROOT w.id =", n.WidgetId)
n.WidgetId = 0 n.WidgetId = 0
me.rootNode = n me.rootNode = n
return w return w
} }
if (n.WidgetType == toolkit.Box) { if (n.WidgetType == widget.Box) {
if (n.B) { if (n.B) {
n.horizontal = true n.horizontal = true
} else { } else {