diff options
| author | Jeff Carr <[email protected]> | 2021-10-25 05:00:12 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2021-10-25 05:00:12 -0500 |
| commit | 4e5c26419d6c411ba04c57cb7b8062e73f695cec (patch) | |
| tree | 514736ab4bafe64e95d3ab5d1e4eb299aed90f3a | |
| parent | 23e4e139f1df01bfdd8987c48309a1e50977b7a1 (diff) | |
DEBUG: add buttons to add demo & debug tabs.
TabMargin is now always set to true
Signed-off-by: Jeff Carr <[email protected]>
| -rw-r--r-- | structs.go | 49 | ||||
| -rw-r--r-- | window-debug.go | 48 |
2 files changed, 48 insertions, 49 deletions
@@ -188,55 +188,6 @@ func (s GuiBox) Append(child ui.Control, x bool) { s.UiBox.Append(child, x) } -/* -func (s *GuiBox) AddTab(title string, custom ui.Control) *ui.Tab { - if s.Window == nil { - return nil - } - if s.Window.UiTab == nil { - return nil - } - - tab := s.Window.UiTab - tab.Append(title, custom) - return tab -} -*/ - -/* -func (s GuiBox) AddBoxTab(title string) *GuiBox { - uiTab := s.AddTab(title, initBlankWindow()) - tabSetMargined(uiTab) - - var box *GuiBox - box = HardBox(s.Window, Xaxis, "jcarrAddBoxTab") - box.Window.UiTab = uiTab - return box -} -*/ - -func (n *Node) AddDemoTab(title string) { - newNode := n.AddTab(title, makeWindowTemplate()) - newNode.Dump() - tabSetMargined(newNode.uiTab) -} - -func (n *Node) AddDebugTab(title string) { - newNode := n.AddTab(title, makeWindowDebug()) - newNode.Dump() - tabSetMargined(newNode.uiTab) -} - -func tabSetMargined(tab *ui.Tab) { - log.Println("tabSetMargined() IGNORE THIS") - return - c := tab.NumPages() - for i := 0; i < c; i++ { - log.Println("tabSetMargined() i =", i) - // tab.SetMargined(i, true) - } -} - // Note: every mouse click is handled // as a 'Button' regardless of where // the user clicks it. You could probably diff --git a/window-debug.go b/window-debug.go index de4b31b..ef457aa 100644 --- a/window-debug.go +++ b/window-debug.go @@ -12,6 +12,8 @@ var names = make([]string, 100) var nodeNames = make([]string, 100) // TODO: remove this crap +// What does this actually do? +// It populates the nodeNames in a map. No, not a map, an array. What is the difference again? func addNodeName(c *ui.Combobox, s string) { c.Append(s) nodeNames[y] = s @@ -220,6 +222,28 @@ func makeWindowDebug() ui.Control { } }) + n1 = addButton(vbox, "Node.AddDebugTab") + n1.OnClicked(func(*ui.Button) { + y := nodeCombo.Selected() + log.Println("y =", y) + log.Println("nodeNames[y] =", nodeNames[y]) + node := Data.findId(nodeNames[y]) + if (node != nil) { + node.AddDebugTab("added this DebugTab") + } + }) + + n1 = addButton(vbox, "Node.DemoTab") + n1.OnClicked(func(*ui.Button) { + y := nodeCombo.Selected() + log.Println("y =", y) + log.Println("nodeNames[y] =", nodeNames[y]) + node := Data.findId(nodeNames[y]) + if (node != nil) { + node.AddDemoTab("added this DemoTab") + } + }) + /* ///////////////////////////////////////////////////// vbox = addGroup(hbox, "Numbers") @@ -331,3 +355,27 @@ func addButton(box *ui.Box, name string) *ui.Button { box.Append(button, false) return button } + +func (n *Node) AddDemoTab(title string) { + newNode := n.AddTab(title, makeWindowTemplate()) + newNode.Dump() + tabSetMargined(newNode.uiTab) +} + +func (n *Node) AddDebugTab(title string) { + newNode := n.AddTab(title, makeWindowDebug()) + newNode.Dump() + tabSetMargined(newNode.uiTab) +} + +// This sets _all_ the tabs to Margin = true +// +// TODO: do proper tab tracking (will be complicated). low priority +func tabSetMargined(tab *ui.Tab) { + log.Println("tabSetMargined() IGNORE THIS") + c := tab.NumPages() + for i := 0; i < c; i++ { + log.Println("tabSetMargined() i =", i) + tab.SetMargined(i, true) + } +} |
