1
0
mirror of https://github.com/taigrr/wtf synced 2025-01-18 04:03:14 -08:00

Add a focusable over-ride setting for widgets that are non-focusable by

default

For widgets that are non-focusable by default, you can now specify

    focusable: true

in their config to over-ride the default 'false' value.
This commit is contained in:
Chris Cummer
2019-08-31 10:00:00 -07:00
parent 248fddf3f4
commit d6208b4730
3 changed files with 7 additions and 3 deletions

View File

@@ -23,7 +23,9 @@ type Base struct {
enabledMutex *sync.Mutex
}
func NewBase(app *tview.Application, commonSettings *cfg.Common, focusable bool) Base {
func NewBase(app *tview.Application, commonSettings *cfg.Common, defaultFocusable bool) Base {
focusable := commonSettings.Focusable || defaultFocusable
base := Base{
commonSettings: commonSettings,
app: app,

View File

@@ -13,9 +13,9 @@ type TextWidget struct {
}
// NewTextWidget creates and returns an instance of TextWidget
func NewTextWidget(app *tview.Application, commonSettings *cfg.Common, focusable bool) TextWidget {
func NewTextWidget(app *tview.Application, commonSettings *cfg.Common, defaultFocusable bool) TextWidget {
widget := TextWidget{
Base: NewBase(app, commonSettings, focusable),
Base: NewBase(app, commonSettings, defaultFocusable),
}
widget.View = widget.createView(widget.bordered)