diff options
| author | Jeff Carr <[email protected]> | 2024-01-17 23:39:03 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2024-01-17 23:39:03 -0600 |
| commit | a0baba0821441d9cf38f0b33fe12fb96925c6236 (patch) | |
| tree | 2aece2a890c66c36b08524e117753817078ee58c /andlabs/tab.go | |
| parent | bee272651ad38453aef27f098513f7be652c39bf (diff) | |
new paths
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'andlabs/tab.go')
| -rw-r--r-- | andlabs/tab.go | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/andlabs/tab.go b/andlabs/tab.go index 2bccf5b..2307e6b 100644 --- a/andlabs/tab.go +++ b/andlabs/tab.go @@ -1,32 +1,32 @@ package main import ( + "go.wit.com/lib/widget" "go.wit.com/log" - "go.wit.com/gui/widget" "go.wit.com/dev/andlabs/ui" _ "go.wit.com/dev/andlabs/ui/winmanifest" ) /* - This adds a tab +This adds a tab - andlabs/ui is goofy in the sense that you have to determine - if the ui.Window already has a tab in it. If it does, then - you need to add this tab and not run SetChild() on the window - or instead it replaces the existing tab with the new one +andlabs/ui is goofy in the sense that you have to determine +if the ui.Window already has a tab in it. If it does, then +you need to add this tab and not run SetChild() on the window +or instead it replaces the existing tab with the new one - I work around this by always sending a Toolkit that is a tab - once there is one. If you send a Window here, it will replace - any existing tabs rather than adding a new one +I work around this by always sending a Toolkit that is a tab +once there is one. If you send a Window here, it will replace +any existing tabs rather than adding a new one */ func (p *node) newTab(n *node) { var newt *guiWidget - if (p == nil) { + if p == nil { log.Log(ERROR, "newTab() p == nil. how the fuck does this happen?", n.WidgetId, n.ParentId) } - if (p.WidgetType != widget.Window) { + if p.WidgetType != widget.Window { log.Log(ERROR, "newTab() uiWindow == nil. I can't add a toolbar without window", n.WidgetId, n.ParentId) return } @@ -34,15 +34,15 @@ func (p *node) newTab(n *node) { log.Log(TOOLKIT, "newTab() START", n.WidgetId, n.ParentId) - if (t.uiTab == nil) { + if t.uiTab == nil { // this means you have to make a new tab - log.Log(TOOLKIT, "newTab() GOOD. This should be the first tab:", n.WidgetId, n.ParentId) + log.Log(TOOLKIT, "newTab() GOOD. This should be the first tab:", n.WidgetId, n.ParentId) newt = rawTab(t.uiWindow, widget.GetString(n.value)) t.uiTab = newt.uiTab } else { // this means you have to append a tab - log.Log(TOOLKIT, "newTab() GOOD. This should be an additional tab:", n.WidgetId, n.ParentId) - if (n.WidgetType == widget.Tab) { + log.Log(TOOLKIT, "newTab() GOOD. This should be an additional tab:", n.WidgetId, n.ParentId) + if n.WidgetType == widget.Tab { // andlabs doesn't have multiple tab widgets so make a fake one? // this makes a guiWidget internal structure with the parent values newt = new(guiWidget) @@ -62,16 +62,16 @@ func (p *node) newTab(n *node) { func tabSetMargined(tab *ui.Tab, b bool) { c := tab.NumPages() for i := 0; i < c; i++ { - log.Log(TOOLKIT, "SetMargined", i, b) + log.Log(TOOLKIT, "SetMargined", i, b) tab.SetMargined(i, b) } } func rawTab(w *ui.Window, name string) *guiWidget { var newt guiWidget - log.Log(TOOLKIT, "rawTab() START", name) + log.Log(TOOLKIT, "rawTab() START", name) - if (w == nil) { + if w == nil { log.Log(ERROR, "UiWindow == nil. I can't add a tab without a window") log.Log(ERROR, "UiWindow == nil. I can't add a tab without a window") log.Log(ERROR, "UiWindow == nil. I can't add a tab without a window") @@ -91,17 +91,17 @@ func (t *guiWidget) appendTab(name string) *guiWidget { var newT guiWidget log.Log(TOOLKIT, "appendTab() ADD", name) - if (t.uiTab == nil) { + if t.uiTab == nil { log.Log(TOOLKIT, "UiWindow == nil. I can't add a widget without a place to put it") panic("should never have happened. wit/gui/toolkit has ui.Tab == nil") } log.Log(TOOLKIT, "appendTab() START name =", name) var hbox *ui.Box - if (defaultBehavior) { + if defaultBehavior { hbox = ui.NewHorizontalBox() } else { - if (bookshelf) { + if bookshelf { hbox = ui.NewHorizontalBox() } else { hbox = ui.NewVerticalBox() |
