2023-01-10 02:22:08 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import "git.tebibyte.media/sashakoshka/tomo"
|
2023-01-16 05:11:06 +00:00
|
|
|
import "git.tebibyte.media/sashakoshka/tomo/layouts"
|
2023-01-10 02:22:08 +00:00
|
|
|
import "git.tebibyte.media/sashakoshka/tomo/elements/basic"
|
2023-01-12 17:51:42 +00:00
|
|
|
import "git.tebibyte.media/sashakoshka/tomo/elements/testing"
|
2023-01-10 02:22:08 +00:00
|
|
|
import _ "git.tebibyte.media/sashakoshka/tomo/backends/x"
|
|
|
|
|
|
|
|
func main () {
|
|
|
|
tomo.Run(run)
|
|
|
|
}
|
|
|
|
|
|
|
|
func run () {
|
|
|
|
window, _ := tomo.NewWindow(2, 2)
|
|
|
|
window.SetTitle("vertical stack")
|
|
|
|
|
2023-01-10 21:39:37 +00:00
|
|
|
container := basic.NewContainer(layouts.Vertical { true, true })
|
|
|
|
window.Adopt(container)
|
2023-01-10 02:22:08 +00:00
|
|
|
|
2023-01-11 02:01:30 +00:00
|
|
|
label := basic.NewLabel("it is a label hehe", false)
|
2023-01-10 22:34:40 +00:00
|
|
|
button := basic.NewButton("drawing pad")
|
|
|
|
okButton := basic.NewButton("OK")
|
2023-01-10 21:39:37 +00:00
|
|
|
button.OnClick (func () {
|
2023-01-10 23:07:51 +00:00
|
|
|
container.DisownAll()
|
2023-01-11 02:01:30 +00:00
|
|
|
container.Adopt(basic.NewLabel("Draw here:", false), false)
|
2023-01-12 17:51:42 +00:00
|
|
|
container.Adopt(testing.NewMouse(), true)
|
2023-01-10 22:34:40 +00:00
|
|
|
container.Adopt(okButton, false)
|
2023-01-12 03:30:14 +00:00
|
|
|
okButton.Select()
|
2023-01-10 21:39:37 +00:00
|
|
|
})
|
2023-01-10 22:34:40 +00:00
|
|
|
okButton.OnClick(tomo.Stop)
|
2023-01-10 21:39:37 +00:00
|
|
|
|
|
|
|
container.Adopt(label, true)
|
|
|
|
container.Adopt(button, false)
|
2023-01-10 22:34:40 +00:00
|
|
|
container.Adopt(okButton, false)
|
2023-01-12 03:30:14 +00:00
|
|
|
okButton.Select()
|
2023-01-10 02:22:08 +00:00
|
|
|
|
|
|
|
window.OnClose(tomo.Stop)
|
|
|
|
window.Show()
|
|
|
|
}
|