2023-03-05 03:56:44 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import "git.tebibyte.media/sashakoshka/tomo"
|
2023-03-31 03:19:04 +00:00
|
|
|
import "git.tebibyte.media/sashakoshka/tomo/elements"
|
2023-03-16 05:14:39 +00:00
|
|
|
import _ "git.tebibyte.media/sashakoshka/tomo/backends/all"
|
2023-03-05 03:56:44 +00:00
|
|
|
|
|
|
|
func main () {
|
|
|
|
tomo.Run(run)
|
|
|
|
}
|
|
|
|
|
|
|
|
func run () {
|
2023-04-10 06:58:52 +00:00
|
|
|
window, _ := tomo.NewWindow(tomo.Bounds(0, 0, 360, 0))
|
2023-03-05 03:56:44 +00:00
|
|
|
window.SetTitle("Icons")
|
|
|
|
|
2023-04-18 20:18:30 +00:00
|
|
|
container := elements.NewVBox(elements.SpaceBoth)
|
2023-03-05 03:56:44 +00:00
|
|
|
window.Adopt(container)
|
|
|
|
|
2023-04-18 20:18:30 +00:00
|
|
|
container.Adopt (
|
|
|
|
elements.NewLabel("Just some of the wonderful icons we have:"),
|
|
|
|
elements.NewLine())
|
|
|
|
container.AdoptExpand (
|
|
|
|
icons(tomo.IconHome, tomo.IconHistory),
|
|
|
|
icons(tomo.IconFile, tomo.IconNetwork),
|
|
|
|
icons(tomo.IconOpen, tomo.IconRemoveFavorite),
|
|
|
|
icons(tomo.IconCursor, tomo.IconDistort))
|
2023-03-05 05:31:41 +00:00
|
|
|
|
2023-04-16 02:23:08 +00:00
|
|
|
closeButton := elements.NewButton("Yes verynice")
|
2023-04-02 21:55:24 +00:00
|
|
|
closeButton.SetIcon(tomo.IconYes)
|
2023-03-05 05:31:41 +00:00
|
|
|
closeButton.OnClick(tomo.Stop)
|
2023-04-18 20:18:30 +00:00
|
|
|
container.Adopt(closeButton)
|
2023-03-05 03:56:44 +00:00
|
|
|
|
|
|
|
window.OnClose(tomo.Stop)
|
|
|
|
window.Show()
|
|
|
|
}
|
|
|
|
|
2023-04-18 20:18:30 +00:00
|
|
|
func icons (min, max tomo.Icon) (container *elements.Box) {
|
|
|
|
container = elements.NewHBox(elements.SpaceMargin)
|
2023-03-05 03:56:44 +00:00
|
|
|
for index := min; index <= max; index ++ {
|
2023-04-18 20:18:30 +00:00
|
|
|
container.AdoptExpand(elements.NewIcon(index, tomo.IconSizeSmall))
|
2023-03-05 03:56:44 +00:00
|
|
|
}
|
|
|
|
return
|
|
|
|
}
|