summaryrefslogtreecommitdiff
path: root/toolkit/gocui/common.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2023-04-05 13:06:42 -0500
committerJeff Carr <[email protected]>2023-04-05 13:06:42 -0500
commit29efacf6f60d92231381699bc27d44d515a4063c (patch)
tree4116b76bb7c2dc300cb93f92ec2ea66d57eeccf0 /toolkit/gocui/common.go
parent693a6f4398604e9932d714d24adc5c12472e750b (diff)
gocui: rework spacing logic
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'toolkit/gocui/common.go')
-rw-r--r--toolkit/gocui/common.go22
1 files changed, 9 insertions, 13 deletions
diff --git a/toolkit/gocui/common.go b/toolkit/gocui/common.go
index cfb177b..663994d 100644
--- a/toolkit/gocui/common.go
+++ b/toolkit/gocui/common.go
@@ -29,24 +29,22 @@ func setupWidget(a *toolkit.Action) *cuiWidget {
// set the name used by gocui to the id
w.cuiName = strconv.Itoa(w.id)
- w.parent = findWidget(a.ParentId, me.rootNode)
- log(logInfo, "setupWidget() w.id =", w.id, "w.parent", w.parent, "ParentId =", a.ParentId)
- if (w.id == 0) {
+ if w.widgetType == toolkit.Root {
+ log(logInfo, "setupWidget() FOUND ROOT w.id =", w.id, "w.parent", w.parent, "ParentId =", a.ParentId)
+ w.id = 0
me.rootNode = w
- // this is the rootNode
return w
}
+
+ w.parent = findWidget(a.ParentId, me.rootNode)
+ log(logInfo, "setupWidget() w.id =", w.id, "w.parent", w.parent, "ParentId =", a.ParentId)
if (w.parent == nil) {
log(logError, "setupWidget() ERROR: PARENT = NIL w.id =", w.id, "w.parent", w.parent, "ParentId =", a.ParentId)
// just use the rootNode (hopefully it's not nil)
w.parent = me.rootNode
// return w
}
- if (w.parent == nil) {
- log(logError, "setupWidget() ERROR: PARENT = NIL w.id =", w.id, "w.parent", w.parent, "ParentId =", a.ParentId)
- me.rootNode = w
- return w
- }
+
// add this widget as a child for the parent
w.parent.Append(w)
@@ -58,11 +56,9 @@ func setupWidget(a *toolkit.Action) *cuiWidget {
}
}
if (a.WidgetType == toolkit.Grid) {
- w.logicalW = make(map[int]int) // how tall each row in the grid is
- w.logicalH = make(map[int]int) // how wide each column in the grid is
+ w.widths = make(map[int]int) // how tall each row in the grid is
+ w.heights = make(map[int]int) // how wide each column in the grid is
}
-
- // w.showWidgetPlacement(logNow)
return w
}