summaryrefslogtreecommitdiff
path: root/toolkit/andlabs/tab.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2023-03-29 23:03:04 -0500
committerJeff Carr <[email protected]>2023-03-29 23:03:04 -0500
commit4e28cde838683188bfbd9222746409538828592d (patch)
tree3c84fffc14352329bc41e6b58910ff278c99f08c /toolkit/andlabs/tab.go
parentd4787a1ebdd08359746516dbb72f1feaf95be5b6 (diff)
add semi-working gocuiv0.7.4
commit 947169df5a22c9f9b53f825764747f648c70ff1e Author: Jeff Carr <[email protected]> Date: Wed Mar 29 22:44:08 2023 -0500 ready for version v0.7.4 start deprecating toolkit.Widget switch to variable name 'ParentId' use 'ActionType' and 'WidgetType' preliminary redraw() final definition of variables 'Name' and 'Text' more cleaning of the code remove lots of dumb code bind 'd' key press to dump out debugging info early color handling in gocui! Signed-off-by: Jeff Carr <[email protected]> commit 6013fde8332e8ecbffaf1a0977ba2e1da8ea8775 Author: Jeff Carr <[email protected]> Date: Sun Mar 26 17:19:20 2023 -0500 improvements towards a working dns control panel democui has the help menu try to add mouse support to gocui make a direct access method Margin() and Pad() tests add SPEW also push devel branch to github Signed-off-by: Jeff Carr <[email protected]> commit 6f91f5e080e06cdc0f34b13d23e5fd16ea37259a Author: Jeff Carr <[email protected]> Date: Fri Mar 24 20:14:18 2023 -0500 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]> Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'toolkit/andlabs/tab.go')
-rw-r--r--toolkit/andlabs/tab.go73
1 files changed, 33 insertions, 40 deletions
diff --git a/toolkit/andlabs/tab.go b/toolkit/andlabs/tab.go
index b0920ac..0753338 100644
--- a/toolkit/andlabs/tab.go
+++ b/toolkit/andlabs/tab.go
@@ -19,36 +19,43 @@ import (
once there is one. If you send a Window here, it will replace
any existing tabs rather than adding a new one
*/
-func (t *andlabsT) newTab(name string) *andlabsT {
+func (t *andlabsT) newTab(a *toolkit.Action) {
// var w *ui.Window
var newt *andlabsT
- log(debugToolkit, "gui.toolkit.AddTab()")
-
- if (t.uiWindow == nil) {
- log(debugToolkit, "gui.Toolkit.UiWindow == nil. I can't add a toolbar without window")
- return nil
- }
+ log(debugToolkit, "newTab() START", a.WidgetId, a.ParentId)
if (t.uiTab == nil) {
+ if (t.uiWindow == nil) {
+ log(debugToolkit, "newTab() uiWindow == nil. I can't add a toolbar without window", a.WidgetId, a.ParentId)
+ return
+ }
// this means you have to make a new tab
- log(debugToolkit, "gui.toolkit.NewTab() GOOD. This should be the first tab:", name)
- newt = rawTab(t.uiWindow, name)
+ log(debugToolkit, "newTab() GOOD. This should be the first tab:", a.WidgetId, a.ParentId)
+ newt = rawTab(t.uiWindow, a.Text)
t.uiTab = newt.uiTab
} else {
// this means you have to append a tab
- log(debugToolkit, "gui.toolkit.NewTab() GOOD. This should be an additional tab:", name)
- newt = t.appendTab(name)
+ log(debugToolkit, "newTab() GOOD. This should be an additional tab:", a.WidgetId, a.ParentId)
+ newt = t.appendTab(a.Text)
}
- newt.Name = name
+ // add the structure to the array
+ if (andlabs[a.WidgetId] == nil) {
+ log(logInfo, "newTab() MAPPED", a.WidgetId, a.ParentId)
+ andlabs[a.WidgetId] = newt
+ newt.Type = a.Widget.Type
+ } else {
+ log(debugError, "newTab() DO WHAT?", a.WidgetId, a.ParentId)
+ log(debugError, "THIS IS BAD")
+ }
+
+ newt.Name = a.Name
log(debugToolkit, "t:")
t.Dump(debugToolkit)
log(debugToolkit, "newt:")
newt.Dump(debugToolkit)
-
- return newt
}
// This sets _all_ the tabs to Margin = true
@@ -64,29 +71,21 @@ func tabSetMargined(tab *ui.Tab, b bool) {
func rawTab(w *ui.Window, name string) *andlabsT {
var newt andlabsT
- log(debugToolkit, "gui.toolkit.NewTab() ADD", name)
+ log(debugToolkit, "rawTab() START", name)
if (w == nil) {
- log(debugToolkit, "gui.toolkit.NewTab() node.UiWindow == nil. I can't add a tab without a window")
- log(debugToolkit, "gui.toolkit.NewTab() node.UiWindow == nil. I can't add a tab without a window")
- log(debugToolkit, "gui.toolkit.NewTab() node.UiWindow == nil. I can't add a tab without a window")
+ log(debugError, "UiWindow == nil. I can't add a tab without a window")
+ log(debugError, "UiWindow == nil. I can't add a tab without a window")
+ log(debugError, "UiWindow == nil. I can't add a tab without a window")
sleep(1)
return nil
}
- log(debugToolkit, "gui.toolkit.AddTab() START name =", name)
- tab := ui.NewTab()
- w.SetMargined(margin)
- hbox := ui.NewHorizontalBox() // this makes everything go along the horizon
- hbox.SetPadded(padded)
- tab.Append(name, hbox)
- tabSetMargined(tab, margin) // TODO: run this in the right place(?)
+ tab := ui.NewTab()
w.SetChild(tab)
-
- newt.uiWindow = w
newt.uiTab = tab
newt.uiControl = tab
- newt.uiBox = hbox
+ log(debugToolkit, "rawTab() END", name)
return &newt
}
@@ -120,20 +119,14 @@ func (t *andlabsT) appendTab(name string) *andlabsT {
}
func newTab(a *toolkit.Action) {
- parentW := a.Where
- w := a.Widget
- var newt *andlabsT
- log(debugToolkit, "gui.andlabs.NewTab()", w.Name)
+ // w := a.Widget
+ log(debugToolkit, "newTab()", a.ParentId)
- t := mapToolkits[parentW]
+ t := andlabs[a.ParentId]
if (t == nil) {
- log(debugToolkit, "go.andlabs.NewTab() toolkit struct == nil. name=", parentW.Name, w.Name)
+ log(debugToolkit, "newTab() parent toolkit == nil. new tab can not be made =", a.ParentId)
+ log(debugToolkit, "look for a window? check for an existing tab?")
return
}
- newt = t.newTab(w.Name)
- mapWidgetsToolkits(a, newt)
-}
-
-func doTab(a *toolkit.Action) {
- newTab(a)
+ t.newTab(a)
}