summaryrefslogtreecommitdiff
path: root/toolkit/andlabs/tab.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2023-03-23 12:35:12 -0500
committerJeff Carr <[email protected]>2023-03-23 12:35:12 -0500
commitd4787a1ebdd08359746516dbb72f1feaf95be5b6 (patch)
treecb81756d61096ccf74af7c8cc9a15e4e00fe1da7 /toolkit/andlabs/tab.go
parent6a848bf40474365cc1c0b4da9e2f7e3e10b4d627 (diff)
Squashed commit of the following:v0.7.3
boxes now exist and are tracked in the binary tree create for group and grid works gocui plugin no longer works. TODO: fix in next release converted everything from plugin to Action() can remove send() tab and window are now action() flags moved to action() ready for new release pad() margion() border() all work move worked! go.wit.com attept 578th try adds an early grid widget. won't work until chan andlabs/ui grid (X,Y) works right actually can put things in places in a grid Queue() means shit doesn't look right on grids lots of fucking around. why am I wasting time on image? wow. the crazy doAppend() thing is gone implement Action Show() and Hide() Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'toolkit/andlabs/tab.go')
-rw-r--r--toolkit/andlabs/tab.go65
1 files changed, 11 insertions, 54 deletions
diff --git a/toolkit/andlabs/tab.go b/toolkit/andlabs/tab.go
index 9dcd3fa..b0920ac 100644
--- a/toolkit/andlabs/tab.go
+++ b/toolkit/andlabs/tab.go
@@ -54,11 +54,11 @@ func (t *andlabsT) newTab(name string) *andlabsT {
// This sets _all_ the tabs to Margin = true
//
// TODO: do proper tab tracking (will be complicated). low priority
-func tabSetMargined(tab *ui.Tab) {
+func tabSetMargined(tab *ui.Tab, b bool) {
c := tab.NumPages()
for i := 0; i < c; i++ {
- log(debugToolkit, "SetMargined", i, margin)
- tab.SetMargined(i, margin)
+ log(debugToolkit, "SetMargined", i, b)
+ tab.SetMargined(i, b)
}
}
@@ -80,11 +80,12 @@ func rawTab(w *ui.Window, name string) *andlabsT {
hbox := ui.NewHorizontalBox() // this makes everything go along the horizon
hbox.SetPadded(padded)
tab.Append(name, hbox)
- tabSetMargined(tab) // TODO: run this in the right place(?)
+ tabSetMargined(tab, margin) // TODO: run this in the right place(?)
w.SetChild(tab)
newt.uiWindow = w
newt.uiTab = tab
+ newt.uiControl = tab
newt.uiBox = hbox
return &newt
}
@@ -118,7 +119,9 @@ func (t *andlabsT) appendTab(name string) *andlabsT {
return &newT
}
-func newTab(parentW *toolkit.Widget, w *toolkit.Widget) {
+func newTab(a *toolkit.Action) {
+ parentW := a.Where
+ w := a.Widget
var newt *andlabsT
log(debugToolkit, "gui.andlabs.NewTab()", w.Name)
@@ -128,55 +131,9 @@ func newTab(parentW *toolkit.Widget, w *toolkit.Widget) {
return
}
newt = t.newTab(w.Name)
- mapWidgetsToolkits(w, newt)
+ mapWidgetsToolkits(a, newt)
}
-func doTab(p *toolkit.Widget, c *toolkit.Widget) {
- if broken(c) {
- return
- }
- if (c.Action == "New") {
- newTab(p, c)
- return
- }
- ct := mapToolkits[c]
- if (ct == nil) {
- log(debugError, "Trying to do something on a widget that doesn't work or doesn't exist or something", c)
- return
- }
- if ct.broken() {
- log(debugError, "Tab() ct.broken", ct)
- return
- }
- if (ct.uiTab == nil) {
-
- log(debugError, "Tab() uiTab == nil", ct)
- return
- }
- log(debugChange, "Going to attempt:", c.Action)
- switch c.Action {
- case "Enable":
- ct.uiTab.Enable()
- case "Disable":
- ct.uiTab.Disable()
- case "Show":
- ct.uiTab.Show()
- case "Hide":
- ct.uiTab.Hide()
- case "Get":
- c.I = ct.uiTab.NumPages()
- case "Add":
- log(true, "how do I add a tab here in doTab()?")
- dump(p, c, true)
- case "SetMargin":
- i := ct.uiTab.NumPages()
- log(true, "tab.NumPages() =", i)
- for i > 0 {
- i -= 1
- log(true, "uiTab.SetMargined(true) for i =", i)
- ct.uiTab.SetMargined(i, c.B)
- }
- default:
- log(debugError, "Can't do", c.Action, "to a Tab")
- }
+func doTab(a *toolkit.Action) {
+ newTab(a)
}