mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
There is already default handling of title. Remove instances where people are unknowingly overriding it For instances where we want to set special things, make sure to use CommonSettings.Title, so people can still override
38 lines
689 B
Go
38 lines
689 B
Go
package unknown
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/rivo/tview"
|
|
"github.com/wtfutil/wtf/wtf"
|
|
)
|
|
|
|
type Widget struct {
|
|
wtf.TextWidget
|
|
|
|
app *tview.Application
|
|
settings *Settings
|
|
}
|
|
|
|
func NewWidget(app *tview.Application, name string, settings *Settings) *Widget {
|
|
widget := Widget{
|
|
TextWidget: wtf.NewTextWidget(app, settings.common, false),
|
|
|
|
app: app,
|
|
settings: settings,
|
|
}
|
|
|
|
return &widget
|
|
}
|
|
|
|
/* -------------------- Exported Functions -------------------- */
|
|
|
|
func (widget *Widget) Refresh() {
|
|
widget.app.QueueUpdateDraw(func() {
|
|
widget.View.Clear()
|
|
|
|
content := fmt.Sprintf("Widget %s does not exist", widget.CommonSettings.Title)
|
|
widget.View.SetText(content)
|
|
})
|
|
}
|