This repository has been archived on 2023-08-08. You can view files and clone it, but cannot push or open issues or pull requests.
tomo-old/examples/panels/main.go

40 lines
1.0 KiB
Go
Raw Normal View History

package main
import "fmt"
import "git.tebibyte.media/sashakoshka/tomo"
2023-03-30 21:19:04 -06:00
import "git.tebibyte.media/sashakoshka/tomo/layouts"
import "git.tebibyte.media/sashakoshka/tomo/elements"
import _ "git.tebibyte.media/sashakoshka/tomo/backends/all"
import "git.tebibyte.media/sashakoshka/tomo/elements/containers"
func main () {
tomo.Run(run)
}
func run () {
2023-03-27 18:44:39 -06:00
window, _ := tomo.NewWindow(256, 256)
window.SetTitle("Main")
2023-03-30 21:19:04 -06:00
container := containers.NewContainer(layouts.Vertical { true, true })
container.Adopt(elements.NewLabel("Main window", false), true)
window.Adopt(container)
window.OnClose(tomo.Stop)
window.Show()
createPanel(window, 0)
2023-03-27 18:44:39 -06:00
createPanel(window, 1)
createPanel(window, 2)
createPanel(window, 3)
}
2023-03-30 21:19:04 -06:00
func createPanel (parent tomo.MainWindow, id int) {
window, _ := parent.NewPanel(2, 2)
title := fmt.Sprint("Panel #", id)
window.SetTitle(title)
2023-03-30 21:19:04 -06:00
container := containers.NewContainer(layouts.Vertical { true, true })
container.Adopt(elements.NewLabel(title, false), true)
window.Adopt(container)
window.Show()
}