widgets

package
v0.0.0-...-e53a3c9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 4, 2019 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func KeyBindingName

func KeyBindingName(key tcell.Key) string

ShortCutName returns name for given key

func PackKeyBindingName

func PackKeyBindingName(key tcell.Key, maxLength int) string

PackKeyBindingName returns shorter for given key Maxlength controls maximum length for text. If 0, disable limiting 'F6' -> F6 'Ctrl+Space' -> 'C-sp'

func SecToString

func SecToString(sec int) string

Print seconds as formatted time: 50, 1:50, 0:05, 1.05, 1:05:05

func SecToStringApproximate

func SecToStringApproximate(sec int) string

SecToStringApproximate gives more verbal output for time duration 1:50 -> 2 min 10:50 -> 11 min 1:11:50 -> 1.1 h

Types

type Browser

type Browser struct {
	// contains filtered or unexported fields
}

Browser is a listR-like viewer user can navigate content with

func NewBrowser

func NewBrowser(controller controller.MediaController) *Browser

func (*Browser) AddModal

func (b *Browser) AddModal(modal Modal, height, width uint, lockSize bool)

AddModal adds modal to center of browser

func (*Browser) Blur

func (b *Browser) Blur()

func (*Browser) Draw

func (b *Browser) Draw(screen tcell.Screen)

func (*Browser) Focus

func (b *Browser) Focus(delegate func(p tview.Primitive))

func (*Browser) GetFocusable

func (b *Browser) GetFocusable() tview.Focusable

func (*Browser) GetRect

func (b *Browser) GetRect() (int, int, int, int)

func (*Browser) InputHandler

func (b *Browser) InputHandler() func(event *tcell.EventKey, setFocus func(p tview.Primitive))

func (*Browser) RemoveModal

func (b *Browser) RemoveModal(modal Modal)

RemoveModal removes modal

func (*Browser) SetRect

func (b *Browser) SetRect(x, y, width, height int)

type Help

type Help struct {
	// contains filtered or unexported fields
}

func NewHelp

func NewHelp(doneCb func()) *Help

func (*Help) Blur

func (h *Help) Blur()

func (*Help) Draw

func (h *Help) Draw(screen tcell.Screen)

func (*Help) Focus

func (h *Help) Focus(delegate func(p tview.Primitive))

func (*Help) GetFocusable

func (h *Help) GetFocusable() tview.Focusable

func (*Help) GetRect

func (h *Help) GetRect() (int, int, int, int)

func (*Help) InputHandler

func (h *Help) InputHandler() func(event *tcell.EventKey, setfocus func(p tview.Primitive))

func (*Help) SetDoneFunc

func (h *Help) SetDoneFunc(doneFunc func())

func (*Help) SetRect

func (h *Help) SetRect(x, y, width, height int)

func (*Help) SetVisible

func (h *Help) SetVisible(visible bool)

func (*Help) View

func (h *Help) View() tview.Primitive

type List

type List struct {
	// contains filtered or unexported fields
}

func NewList

func NewList(enterCb func(index int)) *List

func (*List) Blur

func (l *List) Blur()

func (*List) Clear

func (l *List) Clear()

func (*List) Draw

func (l *List) Draw(screen tcell.Screen)

func (*List) Focus

func (l *List) Focus(delegate func(p tview.Primitive))

func (*List) GetFocusable

func (l *List) GetFocusable() tview.Focusable

func (*List) GetRect

func (l *List) GetRect() (int, int, int, int)

func (*List) InputHandler

func (l *List) InputHandler() func(event *tcell.EventKey, setFocus func(p tview.Primitive))

func (*List) SelectedIndex

func (l *List) SelectedIndex() int

SelectedIndex returns currently selected index

func (*List) SetData

func (l *List) SetData(items []models.Item)

func (*List) SetRect

func (l *List) SetRect(x, y, width, height int)
type Modal interface {
	SetDoneFunc(doneFunc func())
	tview.Primitive
	View() tview.Primitive
	SetVisible(visible bool)
}

Modal creates a modal that overlaps other views and get's destroyed when it's ready

type NavBar struct {
	// contains filtered or unexported fields
}

func NewNavBar

func NewNavBar(callback func(key *tcell.Key)) *NavBar
func (n *NavBar) Blur()
func (n *NavBar) Draw(screen tcell.Screen)
func (n *NavBar) Focus(delegate func(p tview.Primitive))
func (n *NavBar) GetFocusable() tview.Focusable
func (n *NavBar) GetRect() (int, int, int, int)
func (n *NavBar) InputHandler() func(event *tcell.EventKey, setFocus func(p tview.Primitive))
func (n *NavBar) SetRect(x, y, width, height int)

type ProgressBar

type ProgressBar interface {
	SetWidth(w int)
	SetMaximum(m int)
	Draw(val int) string
}

func NewProgressBar

func NewProgressBar(width int, maxValue int) ProgressBar

NewProgressBar creates new progress bar with given character width

type Queue

type Queue struct {
	// contains filtered or unexported fields
}

Queue show list of songs played or songs to be played

func NewQueue

func NewQueue(mode QueueMode) *Queue

func (*Queue) Blur

func (q *Queue) Blur()

func (*Queue) Draw

func (q *Queue) Draw(screen tcell.Screen)

func (*Queue) Focus

func (q *Queue) Focus(delegate func(p tview.Primitive))

func (*Queue) GetFocusable

func (q *Queue) GetFocusable() tview.Focusable

func (*Queue) GetRect

func (q *Queue) GetRect() (int, int, int, int)

func (*Queue) InputHandler

func (q *Queue) InputHandler() func(event *tcell.EventKey, setFocus func(p tview.Primitive))

func (*Queue) SetDoneFunc

func (q *Queue) SetDoneFunc(doneFunc func())

func (*Queue) SetRect

func (q *Queue) SetRect(x, y, width, height int)

func (*Queue) SetVisible

func (q *Queue) SetVisible(visible bool)

func (*Queue) View

func (q *Queue) View() tview.Primitive

type QueueMode

type QueueMode int
const (
	QueueModeQueue QueueMode = iota
	QueueModeHistory
)
type Search struct {
	// contains filtered or unexported fields
}

func NewSearch

func NewSearch(searchCb func(string, bool)) *Search

func (*Search) Blur

func (s *Search) Blur()

func (*Search) Draw

func (s *Search) Draw(screen tcell.Screen)

func (*Search) Focus

func (s *Search) Focus(delegate func(p tview.Primitive))

func (*Search) GetFocusable

func (s *Search) GetFocusable() tview.Focusable

func (*Search) GetRect

func (s *Search) GetRect() (int, int, int, int)

func (*Search) InputHandler

func (s *Search) InputHandler() func(event *tcell.EventKey, setFocus func(p tview.Primitive))

func (*Search) SetDoneFunc

func (s *Search) SetDoneFunc(doneFunc func())

func (*Search) SetRect

func (s *Search) SetRect(x, y, width, height int)

func (*Search) SetVisible

func (s *Search) SetVisible(visible bool)

func (*Search) View

func (s *Search) View() tview.Primitive

type Status

type Status struct {
	// contains filtered or unexported fields
}

func (*Status) Blur

func (s *Status) Blur()

func (*Status) Draw

func (s *Status) Draw(screen tcell.Screen)

func (*Status) DrawButtons

func (s *Status) DrawButtons()

func (*Status) Focus

func (s *Status) Focus(delegate func(p tview.Primitive))

func (*Status) GetFocusable

func (s *Status) GetFocusable() tview.Focusable

func (*Status) GetRect

func (s *Status) GetRect() (int, int, int, int)

func (*Status) InputHandler

func (s *Status) InputHandler() func(event *tcell.EventKey, setFocus func(p tview.Primitive))

func (*Status) SetRect

func (s *Status) SetRect(x, y, width, height int)

func (*Status) UpdateState

func (s *Status) UpdateState(state player.PlayingState, song *models.SongInfo)

func (*Status) WriteStatus

func (s *Status) WriteStatus(screen tcell.Screen, x, y int)

type ViewModal

type ViewModal struct {
	// contains filtered or unexported fields
}

func NewViewModal

func NewViewModal() *ViewModal

func (*ViewModal) Blur

func (v *ViewModal) Blur()

func (*ViewModal) Draw

func (v *ViewModal) Draw(screen tcell.Screen)

func (*ViewModal) Focus

func (v *ViewModal) Focus(delegate func(p tview.Primitive))

func (*ViewModal) GetFocusable

func (v *ViewModal) GetFocusable() tview.Focusable

func (*ViewModal) GetRect

func (v *ViewModal) GetRect() (int, int, int, int)

func (*ViewModal) InputHandler

func (v *ViewModal) InputHandler() func(event *tcell.EventKey, setFocus func(p tview.Primitive))

func (*ViewModal) SetDoneFunc

func (v *ViewModal) SetDoneFunc(doneFunc func())

func (*ViewModal) SetRect

func (v *ViewModal) SetRect(x, y, width, height int)

func (*ViewModal) SetViewFunc

func (v *ViewModal) SetViewFunc(viewFunc func(view controller.View))

func (*ViewModal) SetVisible

func (v *ViewModal) SetVisible(visible bool)

func (*ViewModal) View

func (v *ViewModal) View() tview.Primitive

type Window

type Window struct {
	// contains filtered or unexported fields
}

func NewWindow

func NewWindow(mc controller.MediaController) Window

func (*Window) InitBrowser

func (w *Window) InitBrowser(items []models.Item)

func (*Window) Run

func (w *Window) Run() error

func (*Window) Stop

func (w *Window) Stop()

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL