mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
Make every widget a keyboard widget
Signed-off-by: Chris Cummer <chriscummer@me.com>
This commit is contained in:
@@ -3,7 +3,7 @@ package todo_plus
|
||||
import "github.com/gdamore/tcell"
|
||||
|
||||
func (widget *Widget) initializeKeyboardControls() {
|
||||
widget.InitializeCommonControls(widget.Refresh)
|
||||
widget.InitializeRefreshKeyboardControl(widget.Refresh)
|
||||
|
||||
widget.SetKeyboardChar("d", widget.Delete, "Delete item")
|
||||
widget.SetKeyboardChar("j", widget.Prev, "Select previous item")
|
||||
|
||||
@@ -10,7 +10,6 @@ import (
|
||||
|
||||
// A Widget represents a Todoist widget
|
||||
type Widget struct {
|
||||
view.KeyboardWidget
|
||||
view.MultiSourceWidget
|
||||
view.ScrollableWidget
|
||||
|
||||
@@ -22,9 +21,8 @@ type Widget struct {
|
||||
// NewWidget creates a new instance of a widget
|
||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
KeyboardWidget: view.NewKeyboardWidget(app, pages, settings.common),
|
||||
MultiSourceWidget: view.NewMultiSourceWidget(settings.common, "project", "projects"),
|
||||
ScrollableWidget: view.NewScrollableWidget(app, settings.common),
|
||||
ScrollableWidget: view.NewScrollableWidget(app, pages, settings.common),
|
||||
|
||||
settings: settings,
|
||||
}
|
||||
@@ -35,7 +33,6 @@ func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *
|
||||
|
||||
widget.SetRenderFunction(widget.display)
|
||||
widget.initializeKeyboardControls()
|
||||
widget.View.SetInputCapture(widget.InputCapture)
|
||||
widget.SetDisplayFunction(widget.display)
|
||||
|
||||
widget.KeyboardWidget.SetView(widget.View)
|
||||
@@ -83,10 +80,6 @@ func (widget *Widget) Refresh() {
|
||||
widget.display()
|
||||
}
|
||||
|
||||
func (widget *Widget) HelpText() string {
|
||||
return widget.KeyboardWidget.HelpText()
|
||||
}
|
||||
|
||||
func (widget *Widget) NextSource() {
|
||||
widget.MultiSourceWidget.NextSource()
|
||||
widget.Selected = widget.CurrentProject().Index
|
||||
|
||||
Reference in New Issue
Block a user