2023-01-10 02:22:08 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import "git.tebibyte.media/sashakoshka/tomo"
|
2023-03-31 03:19:04 +00:00
|
|
|
import "git.tebibyte.media/sashakoshka/tomo/layouts"
|
|
|
|
import "git.tebibyte.media/sashakoshka/tomo/elements"
|
2023-01-12 17:51:42 +00:00
|
|
|
import "git.tebibyte.media/sashakoshka/tomo/elements/testing"
|
2023-03-16 18:22:56 +00:00
|
|
|
import "git.tebibyte.media/sashakoshka/tomo/elements/containers"
|
2023-03-16 05:14:39 +00:00
|
|
|
import _ "git.tebibyte.media/sashakoshka/tomo/backends/all"
|
2023-01-10 02:22:08 +00:00
|
|
|
|
|
|
|
func main () {
|
|
|
|
tomo.Run(run)
|
|
|
|
}
|
|
|
|
|
|
|
|
func run () {
|
2023-03-17 05:38:57 +00:00
|
|
|
window, _ := tomo.NewWindow(128, 128)
|
2023-01-10 02:22:08 +00:00
|
|
|
window.SetTitle("vertical stack")
|
|
|
|
|
2023-03-31 03:19:04 +00:00
|
|
|
container := containers.NewContainer(layouts.Vertical { true, true })
|
2023-01-10 21:39:37 +00:00
|
|
|
window.Adopt(container)
|
2023-01-10 02:22:08 +00:00
|
|
|
|
2023-03-31 03:19:04 +00:00
|
|
|
label := elements.NewLabel("it is a label hehe", true)
|
|
|
|
button := elements.NewButton("drawing pad")
|
|
|
|
okButton := elements.NewButton("OK")
|
2023-01-10 21:39:37 +00:00
|
|
|
button.OnClick (func () {
|
2023-01-10 23:07:51 +00:00
|
|
|
container.DisownAll()
|
2023-03-31 03:19:04 +00:00
|
|
|
container.Adopt(elements.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-30 22:25:09 +00:00
|
|
|
okButton.Focus()
|
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-30 22:25:09 +00:00
|
|
|
okButton.Focus()
|
2023-01-10 02:22:08 +00:00
|
|
|
|
|
|
|
window.OnClose(tomo.Stop)
|
|
|
|
window.Show()
|
|
|
|
}
|