github.com/wtfutil/wtf@v0.43.0/modules/unknown/widget.go (about)

     1  package unknown
     2  
     3  import (
     4  	"fmt"
     5  
     6  	"github.com/rivo/tview"
     7  	"github.com/wtfutil/wtf/view"
     8  )
     9  
    10  type Widget struct {
    11  	view.TextWidget
    12  
    13  	settings *Settings
    14  }
    15  
    16  func NewWidget(tviewApp *tview.Application, redrawChan chan bool, settings *Settings) *Widget {
    17  	widget := Widget{
    18  		TextWidget: view.NewTextWidget(tviewApp, redrawChan, nil, settings.Common),
    19  
    20  		settings: settings,
    21  	}
    22  
    23  	return &widget
    24  }
    25  
    26  /* -------------------- Exported Functions -------------------- */
    27  
    28  func (widget *Widget) Refresh() {
    29  	content := fmt.Sprintf("Widget %s and/or type %s does not exist", widget.Name(), widget.CommonSettings().Module.Type)
    30  	widget.Redraw(func() (string, string, bool) { return widget.CommonSettings().Title, content, true })
    31  }