diff options
Diffstat (limited to 'andlabs/action.go')
| -rw-r--r-- | andlabs/action.go | 56 |
1 files changed, 30 insertions, 26 deletions
diff --git a/andlabs/action.go b/andlabs/action.go index 28c78d5..c089078 100644 --- a/andlabs/action.go +++ b/andlabs/action.go @@ -3,9 +3,9 @@ package main import ( "errors" + "go.wit.com/lib/widget" "go.wit.com/log" - "go.wit.com/gui/widget" - "go.wit.com/gui/toolkits/tree" + "go.wit.com/toolkits/tree" ) // this will check to make sure that the node @@ -55,8 +55,12 @@ func ready(n *tree.Node) bool { return true } func (n *node) ready() bool { - if n == nil { return false } - if n.tk == nil { return false } + if n == nil { + return false + } + if n.tk == nil { + return false + } return true } @@ -71,7 +75,7 @@ func show(n *tree.Node, b bool) { if tk.uiControl == nil { return } - if (b) { + if b { tk.uiControl.Show() } else { tk.uiControl.Hide() @@ -90,7 +94,7 @@ func enable(n *tree.Node, b bool) { if tk.uiControl == nil { return } - if (b) { + if b { tk.uiControl.Enable() } else { tk.uiControl.Disable() @@ -101,7 +105,7 @@ func (n *node) pad(b bool) { log.Warn("pad() on WidgetId =", n.WidgetId) t := n.tk - if (t == nil) { + if t == nil { log.Log(ERROR, "pad() toolkit struct == nil. for", n.WidgetId) return } @@ -139,7 +143,7 @@ func (n *node) move(newParent *node) { log.Log(INFO, "TODO: move() for widget =", n.WidgetId) stretchy = true - if (p.tk.uiBox != nil) { + if p.tk.uiBox != nil { p.tk.uiBox.Append(n.tk.uiControl, stretchy) } default: @@ -184,7 +188,7 @@ func (n *node) Delete() { case widget.Box: log.Log(NOW, "tWidget.boxC =", p.progname) log.Log(NOW, "is there a tParent parent? =", p.parent) - if (p.tk.boxC < 1) { + if p.tk.boxC < 1 { log.Log(NOW, "Can not delete from Box. already empty. tWidget.boxC =", p.tk.boxC) return } @@ -204,7 +208,7 @@ func (n *node) Delete() { func rawAction(a *widget.Action) { log.Log(INFO, "rawAction() START a.ActionType =", a.ActionType, "a.Value", a.Value) - if (a.ActionType == widget.ToolkitInit) { + if a.ActionType == widget.ToolkitInit { Init() return } @@ -228,23 +232,23 @@ func rawAction(a *widget.Action) { n := me.treeRoot.FindWidgetId(a.WidgetId) - if (a.ActionType == widget.Add) { + if a.ActionType == widget.Add { me.treeRoot.ListWidgets() // ui.QueueMain(func() { - add(a) + add(a) // }) // TODO: remove this artificial delay // sleep(.001) return } - if (a.ActionType == widget.Dump) { + if a.ActionType == widget.Dump { log.Log(NOW, "rawAction() Dump =", a.ActionType, a.WidgetType, n.State.ProgName) // me.rootNode.listChildren(true) return } - if (n == nil) { + if n == nil { log.Error(errors.New("andlabs rawAction() ERROR findWidgetId found nil"), a.ActionType, a.WidgetType) log.Log(NOW, "rawAction() ERROR findWidgetId found nil for id =", a.WidgetId) log.Log(NOW, "rawAction() ERROR findWidgetId found nil", a.ActionType, a.WidgetType) @@ -286,18 +290,18 @@ func rawAction(a *widget.Action) { addText(n, a) // n.addText(a) /* - case widget.Margin: - n.pad(true) - case widget.Unmargin: - n.pad(false) - case widget.Pad: - n.pad(true) - case widget.Unpad: - n.pad(false) - case widget.Delete: - n.Delete() - case widget.Move: - log.Log(NOW, "rawAction() attempt to move() =", a.ActionType, a.WidgetType) + case widget.Margin: + n.pad(true) + case widget.Unmargin: + n.pad(false) + case widget.Pad: + n.pad(true) + case widget.Unpad: + n.pad(false) + case widget.Delete: + n.Delete() + case widget.Move: + log.Log(NOW, "rawAction() attempt to move() =", a.ActionType, a.WidgetType) */ default: log.Log(ERROR, "rawAction() Unknown =", a.ActionType, a.WidgetType) |
