Skip to content
Snippets Groups Projects
headerView.go 1.25 KiB
Newer Older
  • Learn to ignore specific revisions
  • Malte Bauch's avatar
    Malte Bauch committed
    import "github.com/rivo/tview"
    
    Malte Bauch's avatar
    Malte Bauch committed
    var goSDNAscii = `     ____  ____  _   _               _          __          _             _            _
      __ _  ___/ ___||  _ \| \ | |           __| | __ _   / / __   ___| |_          | |__      __| | __ _
     / _  |/ _ \___ \| | | |  \| |  _____   / _  |/ _  | / /  _ \ / _ \ __|  _____  |  _ \    / _  |/ _  |
    | (_| | (_) |__) | |_| | |\  | |_____| | (_| | (_| |/ /| | | |  __/ |_  |_____| | | | |  | (_| | (_| |
     \__, |\___/____/|____/|_| \_|          \__,_|\__,_/_/ |_| |_|\___|\__|         |_| |_|___\__,_|\__,_|
     |___/                                                                               |_____|          `
    
    //HeaderView is an application view to display the header of the application
    
    type HeaderView struct {
    
    Malte Bauch's avatar
    Malte Bauch committed
    	headerFlex *tview.Flex
    
    	titleView  *tview.TextView
    }
    
    
    //NewHeaderView creates a new HeaderView
    
    func NewHeaderView() *HeaderView {
    	//TODO: change to uses FlexBox if there is more to display in the header
    
    Malte Bauch's avatar
    Malte Bauch committed
    	hv := &HeaderView{
    
    		titleView: tview.NewTextView(),
    	}
    
    Malte Bauch's avatar
    Malte Bauch committed
    	hv.titleView.
    
    		SetText(goSDNAscii).
    		SetTextAlign(tview.AlignCenter).
    		SetBorder(true)
    
    
    Malte Bauch's avatar
    Malte Bauch committed
    	return hv
    
    //GetContent returns the tview.Primitive belonging to the HeaderView
    
    Malte Bauch's avatar
    Malte Bauch committed
    func (hv *HeaderView) GetContent() tview.Primitive {
    	return hv.titleView