diff options
| author | Jeff Carr <[email protected]> | 2022-10-17 22:39:03 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2022-10-17 22:39:03 -0500 |
| commit | 15baefd9a7d145ddffced80d0fb6c14f258bdcc9 (patch) | |
| tree | 633838faafa5c545635e77d441455bc8eb47958f /toolkit/andlabs/group.go | |
| parent | 7e32b1fb9a44624ce2d4a8bc5c6acd5fafc820f3 (diff) | |
GROUP: implement 'group' in toolkit/
move gui.group into toolkit
remove duplicate code
update demo
Diffstat (limited to 'toolkit/andlabs/group.go')
| -rw-r--r-- | toolkit/andlabs/group.go | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/toolkit/andlabs/group.go b/toolkit/andlabs/group.go new file mode 100644 index 0000000..1c3f63e --- /dev/null +++ b/toolkit/andlabs/group.go @@ -0,0 +1,59 @@ +package toolkit + +import "log" + +import "github.com/andlabs/ui" +import _ "github.com/andlabs/ui/winmanifest" + +// make new Group here +func NewGroup(b *ui.Box, title string) *Toolkit { + var t Toolkit + + if (b == nil) { + log.Println("gui.ToolboxNode.NewSpinbox() node.UiBox == nil. I can't add a range UI element without a place to put it") + return &t + } + + log.Println("gui.Toolbox.NewGroup() create", title) + g := ui.NewGroup(title) + g.SetMargined(true) + t.uiGroup = g + t.uiBox = b + t.uiBox.Append(g, false) + + return &t +} + +// create a new box +func (t *Toolkit) GetBox() *ui.Box { + return t.uiBox +} + +// create a new box +func (t *Toolkit) NewBox() *Toolkit { + log.Println("gui.Toolbox.NewBox() START create default") + if (t.uiGroup != nil) { + log.Println("gui.Toolbox.NewBox() is a Group") + var newTK Toolkit + + vbox := ui.NewVerticalBox() + vbox.SetPadded(true) + t.uiGroup.SetChild(vbox) + newTK.uiBox = vbox + + return &newTK + } + log.Println("gui.Toolbox.NewBox() FAILED") + return nil +} + +/* +func (n *Node) NewGroup(title string) *Node { + group := ui.NewGroup(title) + group.SetMargined(true) + hbox.Append(group, true) + + vbox := ui.NewVerticalBox() + vbox.SetPadded(true) + group.SetChild(vbox) +*/ |
