2023-01-09 19:22:08 -07:00
|
|
|
package main
|
|
|
|
|
|
|
|
import "git.tebibyte.media/sashakoshka/tomo"
|
2023-02-01 23:48:16 -07:00
|
|
|
import "git.tebibyte.media/sashakoshka/tomo/layouts/basic"
|
2023-01-09 19:22:08 -07:00
|
|
|
import "git.tebibyte.media/sashakoshka/tomo/elements/basic"
|
2023-01-12 10:51:42 -07:00
|
|
|
import "git.tebibyte.media/sashakoshka/tomo/elements/testing"
|
2023-03-16 12:22:56 -06:00
|
|
|
import "git.tebibyte.media/sashakoshka/tomo/elements/containers"
|
2023-03-15 23:14:39 -06:00
|
|
|
import _ "git.tebibyte.media/sashakoshka/tomo/backends/all"
|
2023-01-09 19:22:08 -07:00
|
|
|
|
|
|
|
func main () {
|
|
|
|
tomo.Run(run)
|
|
|
|
}
|
|
|
|
|
|
|
|
func run () {
|
2023-03-16 23:38:57 -06:00
|
|
|
window, _ := tomo.NewWindow(128, 128)
|
2023-01-09 19:22:08 -07:00
|
|
|
window.SetTitle("vertical stack")
|
|
|
|
|
2023-03-16 12:22:56 -06:00
|
|
|
container := containers.NewContainer(basicLayouts.Vertical { true, true })
|
2023-01-10 14:39:37 -07:00
|
|
|
window.Adopt(container)
|
2023-01-09 19:22:08 -07:00
|
|
|
|
2023-02-01 23:48:16 -07:00
|
|
|
label := basicElements.NewLabel("it is a label hehe", true)
|
|
|
|
button := basicElements.NewButton("drawing pad")
|
|
|
|
okButton := basicElements.NewButton("OK")
|
2023-01-10 14:39:37 -07:00
|
|
|
button.OnClick (func () {
|
2023-01-10 16:07:51 -07:00
|
|
|
container.DisownAll()
|
2023-02-01 23:48:16 -07:00
|
|
|
container.Adopt(basicElements.NewLabel("Draw here:", false), false)
|
2023-01-12 10:51:42 -07:00
|
|
|
container.Adopt(testing.NewMouse(), true)
|
2023-01-10 15:34:40 -07:00
|
|
|
container.Adopt(okButton, false)
|
2023-01-30 15:25:09 -07:00
|
|
|
okButton.Focus()
|
2023-01-10 14:39:37 -07:00
|
|
|
})
|
2023-01-10 15:34:40 -07:00
|
|
|
okButton.OnClick(tomo.Stop)
|
2023-01-10 14:39:37 -07:00
|
|
|
|
|
|
|
container.Adopt(label, true)
|
|
|
|
container.Adopt(button, false)
|
2023-01-10 15:34:40 -07:00
|
|
|
container.Adopt(okButton, false)
|
2023-01-30 15:25:09 -07:00
|
|
|
okButton.Focus()
|
2023-01-09 19:22:08 -07:00
|
|
|
|
|
|
|
window.OnClose(tomo.Stop)
|
|
|
|
window.Show()
|
|
|
|
}
|