Skip to content
Snippets Groups Projects
headerView.go 1.4 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