github.com/wtfutil/wtf@v0.43.0/modules/digitalclock/widget.go (about) 1 package digitalclock 2 3 import ( 4 "github.com/rivo/tview" 5 "github.com/wtfutil/wtf/view" 6 ) 7 8 // Widget is a text widget struct to hold info about the current widget 9 type Widget struct { 10 view.TextWidget 11 12 settings *Settings 13 } 14 15 // NewWidget creates a new widget using settings 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 // Refresh updates the onscreen contents of the widget 29 func (widget *Widget) Refresh() { 30 widget.display() 31 }