Remove redundant examples
This commit is contained in:
parent
37df313544
commit
cd6d8f3ff6
@ -1,33 +0,0 @@
|
||||
package main
|
||||
|
||||
import "git.tebibyte.media/sashakoshka/tomo"
|
||||
import "git.tebibyte.media/sashakoshka/tomo/textdraw"
|
||||
import "git.tebibyte.media/sashakoshka/tomo/elements"
|
||||
import _ "git.tebibyte.media/sashakoshka/tomo/backends/all"
|
||||
|
||||
func main () {
|
||||
tomo.Run(run)
|
||||
}
|
||||
|
||||
func run () {
|
||||
window, _ := tomo.NewWindow(tomo.Bounds(0, 0, 256, 256))
|
||||
window.SetTitle("Text alignment")
|
||||
|
||||
left := elements.NewLabelWrapped(text)
|
||||
center := elements.NewLabelWrapped(text)
|
||||
right := elements.NewLabelWrapped(text)
|
||||
justify := elements.NewLabelWrapped(text)
|
||||
|
||||
left.SetAlign(textdraw.AlignLeft)
|
||||
center.SetAlign(textdraw.AlignCenter)
|
||||
right.SetAlign(textdraw.AlignRight)
|
||||
justify.SetAlign(textdraw.AlignJustify)
|
||||
|
||||
window.Adopt (elements.NewScroll (elements.ScrollVertical,
|
||||
elements.NewDocument(left, center, right, justify)))
|
||||
|
||||
window.OnClose(tomo.Stop)
|
||||
window.Show()
|
||||
}
|
||||
|
||||
const text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Fermentum et sollicitudin ac orci phasellus egestas tellus rutrum. Aliquam vestibulum morbi blandit cursus risus at ultrices mi."
|
@ -1,31 +0,0 @@
|
||||
package main
|
||||
|
||||
import "git.tebibyte.media/sashakoshka/tomo"
|
||||
import "git.tebibyte.media/sashakoshka/tomo/elements"
|
||||
import _ "git.tebibyte.media/sashakoshka/tomo/backends/all"
|
||||
import "git.tebibyte.media/sashakoshka/ezprof/ez"
|
||||
|
||||
func main () {
|
||||
tomo.Run(run)
|
||||
}
|
||||
|
||||
func run () {
|
||||
window, _ := tomo.NewWindow(tomo.Bounds(0, 0, 0, 0))
|
||||
window.SetTitle("example button")
|
||||
button := elements.NewButton("hello tomo!")
|
||||
button.OnClick (func () {
|
||||
// when we set the button's text to something longer, the window
|
||||
// will automatically resize to accomodate it.
|
||||
button.SetText("you clicked me.\nwow, there are two lines!")
|
||||
button.OnClick (func () {
|
||||
button.SetText (
|
||||
"stop clicking me you idiot!\n" +
|
||||
"you've already seen it all!")
|
||||
button.OnClick(tomo.Stop)
|
||||
})
|
||||
})
|
||||
window.Adopt(button)
|
||||
window.OnClose(tomo.Stop)
|
||||
window.Show()
|
||||
ez.Prof()
|
||||
}
|
@ -1,54 +0,0 @@
|
||||
package main
|
||||
|
||||
import "git.tebibyte.media/sashakoshka/tomo"
|
||||
import "git.tebibyte.media/sashakoshka/tomo/popups"
|
||||
import "git.tebibyte.media/sashakoshka/tomo/elements"
|
||||
import _ "git.tebibyte.media/sashakoshka/tomo/backends/all"
|
||||
|
||||
func main () {
|
||||
tomo.Run(run)
|
||||
}
|
||||
|
||||
func run () {
|
||||
window, _ := tomo.NewWindow(tomo.Bounds(0, 0, 0, 0))
|
||||
window.SetTitle("Checkboxes")
|
||||
|
||||
introText := elements.NewLabelWrapped (
|
||||
"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.")
|
||||
introText.EmCollapse(0, 5)
|
||||
|
||||
disabledCheckbox := elements.NewCheckbox("We are but their helpless prey", false)
|
||||
disabledCheckbox.SetEnabled(false)
|
||||
|
||||
vsync := elements.NewCheckbox("Enable vsync", false)
|
||||
vsync.OnToggle (func () {
|
||||
if vsync.Value() {
|
||||
popups.NewDialog (
|
||||
popups.DialogKindInfo,
|
||||
window,
|
||||
"Ha!",
|
||||
"That doesn't do anything.")
|
||||
}
|
||||
})
|
||||
|
||||
button := elements.NewButton("What")
|
||||
button.OnClick(tomo.Stop)
|
||||
|
||||
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)
|
||||
|
||||
button.Focus()
|
||||
window.OnClose(tomo.Stop)
|
||||
window.Show()
|
||||
}
|
@ -1,24 +0,0 @@
|
||||
package main
|
||||
|
||||
import "git.tebibyte.media/sashakoshka/tomo"
|
||||
import "git.tebibyte.media/sashakoshka/tomo/elements"
|
||||
import _ "git.tebibyte.media/sashakoshka/tomo/backends/all"
|
||||
|
||||
func main () {
|
||||
tomo.Run(run)
|
||||
}
|
||||
|
||||
func run () {
|
||||
window, _ := tomo.NewWindow(tomo.Bounds(0, 0, 360, 0))
|
||||
window.SetTitle("horizontal stack")
|
||||
|
||||
container := elements.NewHBox(elements.SpaceBoth)
|
||||
window.Adopt(container)
|
||||
|
||||
container.AdoptExpand(elements.NewLabelWrapped("this is sample text"))
|
||||
container.AdoptExpand(elements.NewLabelWrapped("this is sample text"))
|
||||
container.AdoptExpand(elements.NewLabelWrapped("this is sample text"))
|
||||
|
||||
window.OnClose(tomo.Stop)
|
||||
window.Show()
|
||||
}
|
@ -1,73 +0,0 @@
|
||||
package main
|
||||
|
||||
import "image"
|
||||
import "git.tebibyte.media/sashakoshka/tomo"
|
||||
import "git.tebibyte.media/sashakoshka/tomo/elements"
|
||||
import _ "git.tebibyte.media/sashakoshka/tomo/backends/all"
|
||||
|
||||
func main () {
|
||||
tomo.Run(run)
|
||||
}
|
||||
|
||||
func run () {
|
||||
window, _ := tomo.NewWindow(tomo.Bounds(0, 0, 360, 240))
|
||||
window.SetTitle("Scroll")
|
||||
container := elements.NewVBox(elements.SpaceBoth)
|
||||
window.Adopt(container)
|
||||
|
||||
textBox := elements.NewTextBox("", copypasta)
|
||||
|
||||
disconnectedContainer := elements.NewHBox(elements.SpaceMargin)
|
||||
list := elements.NewList (
|
||||
elements.NewCell(elements.NewCheckbox("Item 0", true)),
|
||||
elements.NewCell(elements.NewCheckbox("Item 1", false)),
|
||||
elements.NewCell(elements.NewCheckbox("Item 2", false)),
|
||||
elements.NewCell(elements.NewCheckbox("Item 3", true)),
|
||||
elements.NewCell(elements.NewCheckbox("Item 4", false)),
|
||||
elements.NewCell(elements.NewCheckbox("Item 5", false)),
|
||||
elements.NewCell(elements.NewCheckbox("Item 6", false)),
|
||||
elements.NewCell(elements.NewCheckbox("Item 7", true)),
|
||||
elements.NewCell(elements.NewCheckbox("Item 8", true)),
|
||||
elements.NewCell(elements.NewCheckbox("Item 9", false)),
|
||||
elements.NewCell(elements.NewCheckbox("Item 10", false)),
|
||||
elements.NewCell(elements.NewCheckbox("Item 11", true)),
|
||||
elements.NewCell(elements.NewCheckbox("Item 12", false)),
|
||||
elements.NewCell(elements.NewCheckbox("Item 13", true)),
|
||||
elements.NewCell(elements.NewCheckbox("Item 14", false)),
|
||||
elements.NewCell(elements.NewCheckbox("Item 15", false)),
|
||||
elements.NewCell(elements.NewCheckbox("Item 16", true)),
|
||||
elements.NewCell(elements.NewCheckbox("Item 17", true)),
|
||||
elements.NewCell(elements.NewCheckbox("Item 18", false)),
|
||||
elements.NewCell(elements.NewCheckbox("Item 19", false)),
|
||||
elements.NewCell(elements.NewCheckbox("Item 20", true)),
|
||||
elements.NewCell(elements.NewCheckbox("Item 21", false)),
|
||||
elements.NewCell(elements.NewScroll (
|
||||
elements.ScrollHorizontal,
|
||||
elements.NewTextBox("", "I bet you weren't expecting this!"))))
|
||||
list.Collapse(0, 32)
|
||||
scrollBar := elements.NewVScrollBar()
|
||||
list.OnScrollBoundsChange (func () {
|
||||
scrollBar.SetBounds (
|
||||
list.ScrollContentBounds(),
|
||||
list.ScrollViewportBounds())
|
||||
})
|
||||
scrollBar.OnScroll (func (viewport image.Point) {
|
||||
list.ScrollTo(viewport)
|
||||
})
|
||||
|
||||
container.Adopt(elements.NewLabel("A ScrollContainer:"))
|
||||
container.Adopt(elements.NewScroll(elements.ScrollHorizontal, textBox))
|
||||
disconnectedContainer.Adopt(list)
|
||||
disconnectedContainer.AdoptExpand(elements.NewLabelWrapped (
|
||||
"Notice how the scroll bar to the right can be used to " +
|
||||
"control the list, despite not even touching it. It is " +
|
||||
"indeed a thing you can do. It is also terrible UI design so " +
|
||||
"don't do it."))
|
||||
disconnectedContainer.Adopt(scrollBar)
|
||||
container.AdoptExpand(disconnectedContainer)
|
||||
|
||||
window.OnClose(tomo.Stop)
|
||||
window.Show()
|
||||
}
|
||||
|
||||
const copypasta = `"I use Linux as my operating system," I state proudly to the unkempt, bearded man. He swivels around in his desk chair with a devilish gleam in his eyes, ready to mansplain with extreme precision. "Actually", he says with a grin, "Linux is just the kernel. You use GNU+Linux!' I don't miss a beat and reply with a smirk, "I use Alpine, a distro that doesn't include the GNU Coreutils, or any other GNU code. It's Linux, but it's not GNU+Linux." The smile quickly drops from the man's face. His body begins convulsing and he foams at the mouth and drops to the floor with a sickly thud. As he writhes around he screams "I-IT WAS COMPILED WITH GCC! THAT MEANS IT'S STILL GNU!" Coolly, I reply "If windows were compiled with GCC, would that make it GNU?" I interrupt his response with "-and work is being made on the kernel to make it more compiler-agnostic. Even if you were correct, you won't be for long." With a sickly wheeze, the last of the man's life is ejected from his body. He lies on the floor, cold and limp. I've womansplained him to death.`
|
@ -1,25 +0,0 @@
|
||||
package main
|
||||
|
||||
import "git.tebibyte.media/sashakoshka/tomo"
|
||||
import "git.tebibyte.media/sashakoshka/tomo/elements"
|
||||
import _ "git.tebibyte.media/sashakoshka/tomo/backends/all"
|
||||
|
||||
func main () {
|
||||
tomo.Run(run)
|
||||
}
|
||||
|
||||
func run () {
|
||||
window, _ := tomo.NewWindow(tomo.Bounds(0, 0, 0, 0))
|
||||
window.SetTitle("Switches")
|
||||
|
||||
container := elements.NewVBox(elements.SpaceBoth)
|
||||
window.Adopt(container)
|
||||
|
||||
container.Adopt(elements.NewSwitch("hahahah", false))
|
||||
container.Adopt(elements.NewSwitch("hehehehheheh", false))
|
||||
container.Adopt(elements.NewSwitch("you can flick da swicth", false))
|
||||
container.Adopt(elements.NewToggleButton("like a switch, but not", false))
|
||||
|
||||
window.OnClose(tomo.Stop)
|
||||
window.Show()
|
||||
}
|
@ -1,53 +0,0 @@
|
||||
package main
|
||||
|
||||
import "fmt"
|
||||
import "git.tebibyte.media/sashakoshka/tomo"
|
||||
import "git.tebibyte.media/sashakoshka/tomo/layouts"
|
||||
import "git.tebibyte.media/sashakoshka/tomo/elements"
|
||||
import "git.tebibyte.media/sashakoshka/tomo/textdraw"
|
||||
import "git.tebibyte.media/sashakoshka/tomo/elements/containers"
|
||||
import _ "git.tebibyte.media/sashakoshka/tomo/backends/all"
|
||||
|
||||
func main () {
|
||||
tomo.Run(run)
|
||||
}
|
||||
|
||||
func run () {
|
||||
window, _ := tomo.NewWindow(tomo.Bounds(0, 0, 0, 0))
|
||||
window.SetTitle("Table")
|
||||
|
||||
container := containers.NewContainer(layouts.Vertical { true, true })
|
||||
table := containers.NewTableContainer(7, 7, true, true)
|
||||
scroller := containers.NewScrollContainer(true, true)
|
||||
|
||||
index := 0
|
||||
for row := 0; row < 7; row ++ {
|
||||
for column := 0; column < 7; column ++ {
|
||||
if index % 2 == 0 {
|
||||
label := elements.NewLabel (
|
||||
fmt.Sprintf("%d, %d", row, column),
|
||||
false)
|
||||
label.SetAlign(textdraw.AlignCenter)
|
||||
table.Set(row, column, label)
|
||||
}
|
||||
index ++
|
||||
}}
|
||||
table.Set(2, 1, elements.NewButton("Oh hi mars!"))
|
||||
|
||||
statusLabel := elements.NewLabel("Selected: none", false)
|
||||
table.Collapse(128, 128)
|
||||
table.OnSelect (func () {
|
||||
column, row := table.Selected()
|
||||
statusLabel.SetText (
|
||||
fmt.Sprintf("Selected: %d, %d",
|
||||
column, row))
|
||||
})
|
||||
|
||||
scroller.Adopt(table)
|
||||
container.Adopt(scroller, true)
|
||||
container.Adopt(statusLabel, false)
|
||||
window.Adopt(container)
|
||||
|
||||
window.OnClose(tomo.Stop)
|
||||
window.Show()
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
package main
|
||||
|
||||
import "git.tebibyte.media/sashakoshka/tomo"
|
||||
import "git.tebibyte.media/sashakoshka/tomo/nasin"
|
||||
import "git.tebibyte.media/sashakoshka/tomo/elements/testing"
|
||||
|
||||
func main () {
|
||||
nasin.Run(Application { })
|
||||
}
|
||||
|
||||
type Application struct { }
|
||||
|
||||
func (Application) Init () error {
|
||||
window, err := nasin.NewWindow(tomo.Bounds(0, 0, 0, 0))
|
||||
if err != nil { return err }
|
||||
window.SetTitle("Mouse Test")
|
||||
window.Adopt(testing.NewMouse())
|
||||
window.OnClose(nasin.Stop)
|
||||
window.Show()
|
||||
return nil
|
||||
}
|
@ -1,42 +0,0 @@
|
||||
package main
|
||||
|
||||
import "git.tebibyte.media/sashakoshka/tomo"
|
||||
import "git.tebibyte.media/sashakoshka/tomo/nasin"
|
||||
import "git.tebibyte.media/sashakoshka/tomo/elements"
|
||||
import "git.tebibyte.media/sashakoshka/tomo/elements/testing"
|
||||
|
||||
func main () {
|
||||
nasin.Run(Application { })
|
||||
}
|
||||
|
||||
type Application struct { }
|
||||
|
||||
func (Application) Init () error {
|
||||
window, err := nasin.NewWindow(tomo.Bounds(0, 0, 128, 128))
|
||||
if err != nil { return err }
|
||||
window.SetTitle("vertical stack")
|
||||
|
||||
container := elements.NewVBox(elements.SpaceBoth)
|
||||
|
||||
label := elements.NewLabelWrapped("it is a label hehe")
|
||||
button := elements.NewButton("drawing pad")
|
||||
okButton := elements.NewButton("OK")
|
||||
button.OnClick (func () {
|
||||
container.DisownAll()
|
||||
container.Adopt(elements.NewLabel("Draw here (not really):"))
|
||||
container.AdoptExpand(testing.NewMouse())
|
||||
container.Adopt(okButton)
|
||||
okButton.Focus()
|
||||
})
|
||||
okButton.OnClick(nasin.Stop)
|
||||
|
||||
container.AdoptExpand(label)
|
||||
container.Adopt(button, okButton)
|
||||
window.Adopt(container)
|
||||
|
||||
okButton.Focus()
|
||||
window.OnClose(nasin.Stop)
|
||||
window.Show()
|
||||
|
||||
return nil
|
||||
}
|
Reference in New Issue
Block a user