Re-organized module structure

This commit is contained in:
2023-03-30 23:19:04 -04:00
parent 719b7b99ac
commit 53bfc8df68
62 changed files with 458 additions and 532 deletions

View File

@@ -2,9 +2,8 @@ package main
import "git.tebibyte.media/sashakoshka/tomo"
import "git.tebibyte.media/sashakoshka/tomo/popups"
import "git.tebibyte.media/sashakoshka/tomo/layouts"
import "git.tebibyte.media/sashakoshka/tomo/elements"
import "git.tebibyte.media/sashakoshka/tomo/layouts/basic"
import "git.tebibyte.media/sashakoshka/tomo/elements/basic"
import "git.tebibyte.media/sashakoshka/tomo/elements/testing"
import "git.tebibyte.media/sashakoshka/tomo/elements/containers"
import _ "git.tebibyte.media/sashakoshka/tomo/backends/all"
@@ -17,11 +16,11 @@ func run () {
window, _ := tomo.NewWindow(300, 2)
window.SetTitle("List Sidebar")
container := containers.NewContainer(basicLayouts.Horizontal { true, true })
container := containers.NewContainer(layouts.Horizontal { true, true })
window.Adopt(container)
var currentPage elements.Element
turnPage := func (newPage elements.Element) {
var currentPage tomo.Element
turnPage := func (newPage tomo.Element) {
container.Warp (func () {
if currentPage != nil {
container.Disown(currentPage)
@@ -31,29 +30,29 @@ func run () {
})
}
intro := basicElements.NewLabel (
intro := elements.NewLabel (
"The List element can be easily used as a sidebar. " +
"Click on entries to flip pages!", true)
button := basicElements.NewButton("I do nothing!")
button := elements.NewButton("I do nothing!")
button.OnClick (func () {
popups.NewDialog(popups.DialogKindInfo, "", "Sike!")
popups.NewDialog(popups.DialogKindInfo, window, "", "Sike!")
})
mouse := testing.NewMouse()
input := basicElements.NewTextBox("Write some text", "")
form := containers.NewContainer(basicLayouts.Vertical { true, false})
form.Adopt(basicElements.NewLabel("I have:", false), false)
form.Adopt(basicElements.NewSpacer(true), false)
form.Adopt(basicElements.NewCheckbox("Skin", true), false)
form.Adopt(basicElements.NewCheckbox("Blood", false), false)
form.Adopt(basicElements.NewCheckbox("Bone", false), false)
input := elements.NewTextBox("Write some text", "")
form := containers.NewContainer(layouts.Vertical { true, false})
form.Adopt(elements.NewLabel("I have:", false), false)
form.Adopt(elements.NewSpacer(true), false)
form.Adopt(elements.NewCheckbox("Skin", true), false)
form.Adopt(elements.NewCheckbox("Blood", false), false)
form.Adopt(elements.NewCheckbox("Bone", false), false)
art := testing.NewArtist()
list := basicElements.NewList (
basicElements.NewListEntry("button", func () { turnPage(button) }),
basicElements.NewListEntry("mouse", func () { turnPage(mouse) }),
basicElements.NewListEntry("input", func () { turnPage(input) }),
basicElements.NewListEntry("form", func () { turnPage(form) }),
basicElements.NewListEntry("art", func () { turnPage(art) }))
list := elements.NewList (
elements.NewListEntry("button", func () { turnPage(button) }),
elements.NewListEntry("mouse", func () { turnPage(mouse) }),
elements.NewListEntry("input", func () { turnPage(input) }),
elements.NewListEntry("form", func () { turnPage(form) }),
elements.NewListEntry("art", func () { turnPage(art) }))
list.OnNoEntrySelected(func () { turnPage (intro) })
list.Collapse(96, 0)