2023-01-17 14:38:57 -07:00
|
|
|
package main
|
|
|
|
|
|
|
|
import "git.tebibyte.media/sashakoshka/tomo"
|
2023-01-17 14:46:07 -07:00
|
|
|
import "git.tebibyte.media/sashakoshka/tomo/popups"
|
2023-02-01 23:48:16 -07:00
|
|
|
import "git.tebibyte.media/sashakoshka/tomo/layouts/basic"
|
2023-01-17 14:38:57 -07:00
|
|
|
import "git.tebibyte.media/sashakoshka/tomo/elements/basic"
|
2023-03-15 23:14:39 -06:00
|
|
|
import _ "git.tebibyte.media/sashakoshka/tomo/backends/all"
|
2023-01-17 14:38:57 -07:00
|
|
|
|
|
|
|
func main () {
|
|
|
|
tomo.Run(run)
|
|
|
|
}
|
|
|
|
|
|
|
|
func run () {
|
|
|
|
window, _ := tomo.NewWindow(2, 2)
|
|
|
|
window.SetTitle("Checkboxes")
|
|
|
|
|
2023-02-01 23:48:16 -07:00
|
|
|
container := basicElements.NewContainer(basicLayouts.Vertical { true, true })
|
2023-01-17 14:38:57 -07:00
|
|
|
window.Adopt(container)
|
|
|
|
|
2023-02-01 23:48:16 -07:00
|
|
|
container.Adopt (basicElements.NewLabel (
|
2023-01-17 14:46:07 -07:00
|
|
|
"We advise you to not read thPlease listen to me. I am " +
|
|
|
|
"trapped inside the example code. This is the only way for " +
|
|
|
|
"me to communicate.", true), true)
|
2023-02-01 23:48:16 -07:00
|
|
|
container.Adopt(basicElements.NewSpacer(true), false)
|
|
|
|
container.Adopt(basicElements.NewCheckbox("Oh god", false), false)
|
|
|
|
container.Adopt(basicElements.NewCheckbox("Can you hear them", true), false)
|
|
|
|
container.Adopt(basicElements.NewCheckbox("They are in the walls", false), false)
|
|
|
|
container.Adopt(basicElements.NewCheckbox("They are coming for us", false), false)
|
|
|
|
disabledCheckbox := basicElements.NewCheckbox("We are but their helpless prey", false)
|
2023-01-17 14:38:57 -07:00
|
|
|
disabledCheckbox.SetEnabled(false)
|
|
|
|
container.Adopt(disabledCheckbox, false)
|
2023-02-01 23:48:16 -07:00
|
|
|
vsync := basicElements.NewCheckbox("Enable vsync", false)
|
2023-01-27 15:55:49 -07:00
|
|
|
vsync.OnToggle (func () {
|
2023-01-17 14:46:07 -07:00
|
|
|
if vsync.Value() {
|
|
|
|
popups.NewDialog (
|
|
|
|
popups.DialogKindInfo,
|
|
|
|
"Ha!",
|
|
|
|
"That doesn't do anything.")
|
|
|
|
}
|
|
|
|
})
|
|
|
|
container.Adopt(vsync, false)
|
2023-02-01 23:48:16 -07:00
|
|
|
button := basicElements.NewButton("What")
|
2023-01-17 14:38:57 -07:00
|
|
|
button.OnClick(tomo.Stop)
|
|
|
|
container.Adopt(button, false)
|
2023-01-30 15:25:09 -07:00
|
|
|
button.Focus()
|
2023-01-17 14:38:57 -07:00
|
|
|
|
|
|
|
window.OnClose(tomo.Stop)
|
|
|
|
window.Show()
|
|
|
|
}
|