Terminal-based user interface toolkit
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

16 lines
537 B

package main
import "gitlab.com/tslocum/cview"
// Center returns a new primitive which shows the provided primitive in its
// center, given the provided primitive's size.
func Center(width, height int, p cview.Primitive) cview.Primitive {
return cview.NewFlex().
AddItem(cview.NewBox(), 0, 1, false).
AddItem(cview.NewFlex().
SetDirection(cview.FlexRow).
AddItem(cview.NewBox(), 0, 1, false).
AddItem(p, height, 1, true).
AddItem(cview.NewBox(), 0, 1, false), width, 1, true).
AddItem(cview.NewBox(), 0, 1, false)
}