Element methods are now more consistent and have less bool flags

Still need to update most examples...
This commit is contained in:
2023-04-18 13:14:10 -04:00
parent a2b1ac0c73
commit 14080b1f88
17 changed files with 209 additions and 653 deletions

View File

@@ -25,9 +25,9 @@ func run () {
window, _ := tomo.NewWindow(tomo.Bounds(0, 0, 256, 0))
window.SetTitle("Clipboard")
container := elements.NewVBox(true, true)
container := elements.NewVBox(elements.SpaceBoth)
textInput := elements.NewTextBox("", "")
controlRow := elements.NewHBox(false, true)
controlRow := elements.NewHBox(elements.SpaceMargin)
copyButton := elements.NewButton("Copy")
copyButton.SetIcon(tomo.IconCopy)
pasteButton := elements.NewButton("Paste")
@@ -107,11 +107,11 @@ func run () {
window.Paste(imageClipboardCallback, validImageTypes...)
})
container.Adopt(textInput, true)
controlRow.Adopt(copyButton, true)
controlRow.Adopt(pasteButton, true)
controlRow.Adopt(pasteImageButton, true)
container.Adopt(controlRow, false)
container.AdoptExpand(textInput)
controlRow.AdoptExpand(copyButton)
controlRow.AdoptExpand(pasteButton)
controlRow.AdoptExpand(pasteImageButton)
container.Adopt(controlRow)
window.Adopt(container)
window.OnClose(tomo.Stop)
@@ -121,13 +121,13 @@ func run () {
func imageWindow (parent tomo.Window, image image.Image) {
window, _ := parent.NewModal(tomo.Bounds(0, 0, 0, 0))
window.SetTitle("Clipboard Image")
container := containers.NewVBox(true, true)
container := elements.NewVBox(elements.SpaceBoth)
closeButton := elements.NewButton("Ok")
closeButton.SetIcon(tomo.IconYes)
closeButton.OnClick(window.Close)
container.Adopt(elements.NewImage(image), true)
container.Adopt(closeButton, false)
container.AdoptExpand(elements.NewImage(image))
container.Adopt(closeButton)
window.Adopt(container)
window.Show()
}