Skip to content
Snippets Groups Projects
resultAndInputView.go 679 B
Newer Older
  • Learn to ignore specific revisions
  • package views
    
    import (
    	"github.com/gdamore/tcell"
    	"github.com/rivo/tview"
    )
    
    type ResultAndInputView struct {
    	resultAndInputView *tview.TextView
    }
    
    func NewResultAndInputView() *ResultAndInputView {
    
    Malte Bauch's avatar
    Malte Bauch committed
    	rv := &ResultAndInputView{
    
    Malte Bauch's avatar
    Malte Bauch committed
    		resultAndInputView: tview.NewTextView(),
    	}
    
    Malte Bauch's avatar
    Malte Bauch committed
    	rv.resultAndInputView.
    
    		SetDynamicColors(true).
    		SetRegions(true).
    		SetScrollable(true).
    		SetTitle("Result").
    		SetBorder(true).
    		SetBorderColor(tcell.ColorSteelBlue)
    
    
    Malte Bauch's avatar
    Malte Bauch committed
    	return rv
    
    Malte Bauch's avatar
    Malte Bauch committed
    func (rv *ResultAndInputView) GetContent() tview.Primitive {
    	return rv.resultAndInputView
    
    Malte Bauch's avatar
    Malte Bauch committed
    func (rv *ResultAndInputView) SetContent(s string) {
    	rv.resultAndInputView.Clear()
    	rv.resultAndInputView.SetText(s)