summaryrefslogtreecommitdiff
path: root/toolkit/andlabs/action.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2023-03-24 20:14:18 -0500
committerJeff Carr <[email protected]>2023-03-24 20:14:18 -0500
commit6f91f5e080e06cdc0f34b13d23e5fd16ea37259a (patch)
tree7037a36829c644dccc7cb78ee6f87f87f88aed21 /toolkit/andlabs/action.go
parentd4787a1ebdd08359746516dbb72f1feaf95be5b6 (diff)
starting to try safe chan and goroutines
fix tab title's right before attempting to add chan goroutines removed "where" widget pointer box added to tab experiement with log as it's own repo Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'toolkit/andlabs/action.go')
-rw-r--r--toolkit/andlabs/action.go82
1 files changed, 37 insertions, 45 deletions
diff --git a/toolkit/andlabs/action.go b/toolkit/andlabs/action.go
index 3272414..68fc34a 100644
--- a/toolkit/andlabs/action.go
+++ b/toolkit/andlabs/action.go
@@ -4,40 +4,40 @@ import (
"git.wit.org/wit/gui/toolkit"
)
-func show(w *toolkit.Widget) {
- if (w == nil) {
+func show(a *toolkit.Action) {
+ if (a == nil) {
log(debugError, "nil is probably already hidden")
return
}
- log(debugError, "show()", w.Name)
+ log(debugError, "show()", a.WidgetId)
- t := mapToolkits[w]
+ t := andlabs[a.WidgetId]
if (t == nil) {
- log(debugToolkit, "show() toolkit struct == nil. for", w.Name)
+ log(debugError, "show() toolkit struct == nil. for", a.WidgetId)
return
}
- if (w.B) {
+ if (a.B) {
t.uiControl.Show()
} else {
t.uiControl.Hide()
}
}
-func enable(w *toolkit.Widget) {
- if (w == nil) {
+func enable(a *toolkit.Action) {
+ if (a == nil) {
log(debugError, "nil is probably already hidden")
return
}
- log(debugError, "enable()", w.Name)
+ log(debugError, "enable() name =", a.WidgetId)
- t := mapToolkits[w]
+ t := andlabs[a.WidgetId]
if (t == nil) {
- log(debugToolkit, "enable() toolkit struct == nil. for", w.Name)
+ log(debugToolkit, "enable() toolkit struct == nil. for id =", a.WidgetId)
return
}
- if (w.B) {
+ if (a.B) {
t.uiControl.Enable()
} else {
t.uiControl.Disable()
@@ -45,19 +45,19 @@ func enable(w *toolkit.Widget) {
}
func pad(a *toolkit.Action) {
- if (a.Widget == nil) {
+ if (a == nil) {
log(debugError, "pad() ERROR: nil is probably already hidden")
return
}
- log(debugError, "pad()", a.Widget.Name)
+ log(debugError, "pad()")
- t := mapToolkits[a.Widget]
+ t := andlabs[a.WidgetId]
if (t == nil) {
- log(debugToolkit, "pad() toolkit struct == nil. for", a.Widget.Name)
+ log(debugError, "pad() toolkit struct == nil. for", a.WidgetId)
return
}
- switch a.Widget.Type {
+ switch t.Type {
case toolkit.Group:
switch a.Type {
case toolkit.Margin:
@@ -124,29 +124,21 @@ func pad(a *toolkit.Action) {
}
func move(a *toolkit.Action) {
- if (a.Where == nil) {
- log(debugError, "move() ERROR: can not move to nil")
- return
- }
- if (a.Widget == nil) {
- log(debugError, "move() ERROR: can not move nil")
- return
- }
- log(debugNow, "move()", a.Widget.Name, "to", a.Where.Name)
+ log(debugNow, "move()", a.WidgetId, "to", a.WhereId)
- tWidget := mapToolkits[a.Widget]
+ tWidget := andlabs[a.WidgetId]
if (tWidget == nil) {
- log(debugError, "move() ERROR: toolkit struct == nil. for", a.Widget.Name)
+ log(debugError, "move() ERROR: toolkit struct == nil. for", a.WidgetId)
return
}
- tWhere := mapToolkits[a.Where]
+ tWhere := andlabs[a.WhereId]
if (tWhere == nil) {
- log(debugError, "move() ERROR: toolkit struct == nil. for", a.Where.Name)
+ log(debugError, "move() ERROR: toolkit struct == nil. for", a.WhereId)
return
}
- switch a.Where.Type {
+ switch tWhere.Type {
case toolkit.Group:
switch a.Type {
case toolkit.Margin:
@@ -169,8 +161,8 @@ func move(a *toolkit.Action) {
}
case toolkit.Box:
log(debugNow, "TODO: move() for a =", a.Type)
- log(debugNow, "TODO: move() where =", a.Where.Type)
- log(debugNow, "TODO: move() for widget =", a.Widget.Type)
+ log(debugNow, "TODO: move() where =", a.WhereId)
+ log(debugNow, "TODO: move() for widget =", a.WidgetId)
stretchy = true
tWhere.uiBox.Append(tWidget.uiControl, stretchy)
@@ -182,35 +174,35 @@ func move(a *toolkit.Action) {
// sleep(.8)
default:
log(debugError, "TODO: need to implement move() for a =", a.Type)
- log(debugError, "TODO: need to implement move() for where =", a.Where.Type)
- log(debugError, "TODO: need to implement move() for widget =", a.Widget.Type)
+ log(debugError, "TODO: need to implement move() for where =", a.WhereId)
+ log(debugError, "TODO: need to implement move() for widget =", a.WidgetId)
}
}
func uiDelete(a *toolkit.Action) {
- if (a.Where == nil) {
+ if (andlabs[a.WhereId] == nil) {
log(debugError, "uiDelete() ERROR: can not uiDelete to nil")
return
}
- if (a.Widget == nil) {
+ if (andlabs[a.WidgetId] == nil) {
log(debugError, "uiDelete() ERROR: can not uiDelete nil")
return
}
- log(debugNow, "uiDelete()", a.Widget.Name, "to", a.Where.Name)
+ log(debugNow, "uiDelete()", a.WidgetId, "to", a.WhereId)
- tWidget := mapToolkits[a.Widget]
+ tWidget := andlabs[a.WidgetId]
if (tWidget == nil) {
- log(debugError, "uiDelete() ERROR: toolkit struct == nil. for", a.Widget.Name)
+ log(debugError, "uiDelete() ERROR: toolkit struct == nil. for", a.WidgetId)
return
}
- tWhere := mapToolkits[a.Where]
+ tWhere := andlabs[a.WhereId]
if (tWhere == nil) {
- log(debugError, "uiDelete() ERROR: toolkit struct == nil. for", a.Where.Name)
+ log(debugError, "uiDelete() ERROR: toolkit struct == nil. for", a.WhereId)
return
}
- switch a.Where.Type {
+ switch tWhere.Type {
case toolkit.Group:
switch a.Type {
case toolkit.Margin:
@@ -247,7 +239,7 @@ func uiDelete(a *toolkit.Action) {
// tWhere.uiBox.Append(tWidget.uiControl, stretchy)
default:
log(debugError, "TODO: need to implement uiDelete() for a =", a.Type)
- log(debugError, "TODO: need to implement uiDelete() for where =", a.Where.Type)
- log(debugError, "TODO: need to implement uiDelete() for widget =", a.Widget.Type)
+ log(debugError, "TODO: need to implement uiDelete() for where =", a.WhereId)
+ log(debugError, "TODO: need to implement uiDelete() for widget =", a.WidgetId)
}
}