2023-03-16 13:58:26 -06:00
package main
import "git.tebibyte.media/sashakoshka/tomo"
import "git.tebibyte.media/sashakoshka/tomo/textdraw"
2023-03-30 21:19:04 -06:00
import "git.tebibyte.media/sashakoshka/tomo/elements"
2023-03-16 13:58:26 -06:00
import _ "git.tebibyte.media/sashakoshka/tomo/backends/all"
import "git.tebibyte.media/sashakoshka/tomo/elements/containers"
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-03-16 13:58:26 -06:00
window . SetTitle ( "Text alignment" )
container := containers . NewDocumentContainer ( )
scrollContainer := containers . NewScrollContainer ( false , true )
scrollContainer . Adopt ( container )
window . Adopt ( scrollContainer )
2023-03-30 21:19:04 -06:00
left := elements . NewLabel ( text , true )
center := elements . NewLabel ( text , true )
right := elements . NewLabel ( text , true )
justify := elements . NewLabel ( text , true )
2023-03-16 13:58:26 -06:00
left . SetAlign ( textdraw . AlignLeft )
center . SetAlign ( textdraw . AlignCenter )
right . SetAlign ( textdraw . AlignRight )
justify . SetAlign ( textdraw . AlignJustify )
2023-04-10 00:58:52 -06:00
container . Adopt ( left , true )
container . Adopt ( center , true )
container . Adopt ( right , true )
container . Adopt ( justify , true )
2023-03-16 13:58:26 -06:00
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."