2023-01-17 14:38:57 -07:00
|
|
|
package main
|
|
|
|
|
|
|
|
import "git.tebibyte.media/sashakoshka/tomo"
|
2023-04-15 17:14:44 -06:00
|
|
|
import "git.tebibyte.media/sashakoshka/tomo/popups"
|
2023-03-30 21:19:04 -06:00
|
|
|
import "git.tebibyte.media/sashakoshka/tomo/elements"
|
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 () {
|
2023-04-10 00:58:52 -06:00
|
|
|
window, _ := tomo.NewWindow(tomo.Bounds(0, 0, 0, 0))
|
2023-01-17 14:38:57 -07:00
|
|
|
window.SetTitle("Checkboxes")
|
|
|
|
|
2023-04-18 11:14:10 -06:00
|
|
|
introText := elements.NewLabelWrapped (
|
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 " +
|
2023-04-18 11:14:10 -06:00
|
|
|
"me to communicate.")
|
2023-03-16 23:00:11 -06:00
|
|
|
introText.EmCollapse(0, 5)
|
2023-04-18 11:14:10 -06:00
|
|
|
|
2023-03-30 21:19:04 -06:00
|
|
|
disabledCheckbox := elements.NewCheckbox("We are but their helpless prey", false)
|
2023-01-17 14:38:57 -07:00
|
|
|
disabledCheckbox.SetEnabled(false)
|
2023-04-18 11:14:10 -06:00
|
|
|
|
2023-03-30 21:19:04 -06:00
|
|
|
vsync := elements.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() {
|
2023-04-15 17:14:44 -06:00
|
|
|
popups.NewDialog (
|
|
|
|
popups.DialogKindInfo,
|
|
|
|
window,
|
|
|
|
"Ha!",
|
|
|
|
"That doesn't do anything.")
|
2023-01-17 14:46:07 -07:00
|
|
|
}
|
|
|
|
})
|
2023-04-18 11:14:10 -06:00
|
|
|
|
2023-03-30 21:19:04 -06:00
|
|
|
button := elements.NewButton("What")
|
2023-01-17 14:38:57 -07:00
|
|
|
button.OnClick(tomo.Stop)
|
2023-04-18 11:14:10 -06:00
|
|
|
|
|
|
|
box := elements.NewVBox(elements.SpaceBoth)
|
|
|
|
box.AdoptExpand(introText)
|
|
|
|
box.Adopt (
|
|
|
|
elements.NewLine(),
|
|
|
|
elements.NewCheckbox("Oh god", false),
|
|
|
|
elements.NewCheckbox("Can you hear them", true),
|
|
|
|
elements.NewCheckbox("They are in the walls", false),
|
|
|
|
elements.NewCheckbox("They are coming for us", false),
|
|
|
|
disabledCheckbox,
|
|
|
|
vsync, button)
|
|
|
|
window.Adopt(box)
|
2023-01-17 14:38:57 -07:00
|
|
|
|
2023-04-18 11:14:10 -06:00
|
|
|
button.Focus()
|
2023-01-17 14:38:57 -07:00
|
|
|
window.OnClose(tomo.Stop)
|
|
|
|
window.Show()
|
|
|
|
}
|