2023-03-24 15:38:21 -06:00
|
|
|
package main
|
|
|
|
|
|
|
|
import "fmt"
|
2023-04-10 00:58:52 -06:00
|
|
|
import "image"
|
2023-03-24 15:38:21 -06:00
|
|
|
import "git.tebibyte.media/sashakoshka/tomo"
|
2023-03-30 21:19:04 -06:00
|
|
|
import "git.tebibyte.media/sashakoshka/tomo/layouts"
|
2023-03-24 15:38:21 -06:00
|
|
|
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-04-10 00:58:52 -06:00
|
|
|
window, _ := tomo.NewWindow(tomo.Bounds(200, 200, 256, 256))
|
2023-03-24 15:38:21 -06:00
|
|
|
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)
|
2023-03-24 15:38:21 -06:00
|
|
|
window.Adopt(container)
|
|
|
|
|
|
|
|
window.OnClose(tomo.Stop)
|
|
|
|
window.Show()
|
|
|
|
|
2023-04-10 00:58:52 -06:00
|
|
|
createPanel(window, 0, tomo.Bounds(-64, 20, 0, 0))
|
|
|
|
createPanel(window, 1, tomo.Bounds(200, 20, 0, 0))
|
|
|
|
createPanel(window, 2, tomo.Bounds(-64, 180, 0, 0))
|
|
|
|
createPanel(window, 3, tomo.Bounds(200, 180, 0, 0))
|
2023-03-24 15:38:21 -06:00
|
|
|
}
|
|
|
|
|
2023-04-10 00:58:52 -06:00
|
|
|
func createPanel (parent tomo.MainWindow, id int, bounds image.Rectangle) {
|
|
|
|
window, _ := parent.NewPanel(bounds)
|
2023-03-24 15:38:21 -06:00
|
|
|
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)
|
2023-03-24 15:38:21 -06:00
|
|
|
window.Adopt(container)
|
|
|
|
window.Show()
|
|
|
|
}
|