Documentation ¶
Index ¶
- Constants
- type Application
- func (app *Application) Draw()
- func (app *Application) HandleEvent(ev tcell.Event) bool
- func (app *Application) Init()
- func (app *Application) Quit()
- func (app *Application) Resize()
- func (app *Application) Run() (err error)
- func (app *Application) SetView(view views.View)
- func (app *Application) SongChange(song song.Song)
- func (app *Application) Start()
- func (app *Application) Unwatch(handler tcell.EventHandler)
- func (app *Application) Watch(handler tcell.EventHandler)
- type LyricsWidget
- func (w *LyricsWidget) HandleEvent(ev tcell.Event) bool
- func (w *LyricsWidget) Scroll(d ScrollDirection)
- func (w *LyricsWidget) SetContent(text string)
- func (w *LyricsWidget) SetLines(lines []string)
- func (w *LyricsWidget) SetLyrics(lyrics lyrics.Lyrics, i int)
- func (w *LyricsWidget) SetPaused(v bool)
- func (w *LyricsWidget) SetScroll(v bool)
- type ScrollDirection
Constants ¶
const ( ScrollUp = ScrollDirection(tcell.KeyUp) ScrollDown = ScrollDirection(tcell.KeyDown) ScrollRight = ScrollDirection(tcell.KeyRight) ScrollLeft = ScrollDirection(tcell.KeyLeft) )
Constants of type ScrollDirection.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Application ¶
type Application struct { tcell.Screen *views.Application WW *views.WidgetWatchers // contains filtered or unexported fields }
Application struct. It embeds and overrides views.Application. It also implemets views.Widget so that it can be used as the root Widget. Call (*Application).Run to run.
func NewApplication ¶
func NewApplication(cfg *config.Config) (app *Application)
NewApplication allocates new Application from cfg.
func (*Application) HandleEvent ¶
func (app *Application) HandleEvent(ev tcell.Event) bool
HandleEvent implements the root Widget.
func (*Application) Init ¶
func (app *Application) Init()
Init initiatialises Application. Can be called multiple times.
func (*Application) Quit ¶
func (app *Application) Quit()
Quit performs shotdown steps, overrides views.Application.Quit.
func (*Application) Run ¶
func (app *Application) Run() (err error)
Run runs the application, overrides views.Application.Run.
func (*Application) SetView ¶
func (app *Application) SetView(view views.View)
SetView implements the root Widget.
func (*Application) SongChange ¶
func (app *Application) SongChange(song song.Song)
func (*Application) Start ¶
func (app *Application) Start()
Start overrides views.Application.Start.
func (*Application) Unwatch ¶
func (app *Application) Unwatch(handler tcell.EventHandler)
Unwatch implements the root Widget.
func (*Application) Watch ¶
func (app *Application) Watch(handler tcell.EventHandler)
Watch implements the root Widget.
type LyricsWidget ¶
LyricsWidget is a Widget implementation.
func NewLyricsWidget ¶
func NewLyricsWidget(app *Application) (ret *LyricsWidget)
NewLyricsWidget allocates new LyricsWidget.
func (*LyricsWidget) HandleEvent ¶
func (w *LyricsWidget) HandleEvent(ev tcell.Event) bool
func (*LyricsWidget) Scroll ¶
func (w *LyricsWidget) Scroll(d ScrollDirection)
Scroll in the direction represented by d.
func (*LyricsWidget) SetContent ¶
func (w *LyricsWidget) SetContent(text string)
func (*LyricsWidget) SetLines ¶
func (w *LyricsWidget) SetLines(lines []string)
func (*LyricsWidget) SetLyrics ¶
func (w *LyricsWidget) SetLyrics(lyrics lyrics.Lyrics, i int)
SetLyrics sets a particular line i of lyrics to be displayed. Each call sets an AfterFunc for the next line that needs to be displayed, so this method only needs to be called when the lyrics change. If i is -1 it cancels the AfterFunc and queries the current time from the client.
func (*LyricsWidget) SetPaused ¶
func (w *LyricsWidget) SetPaused(v bool)
func (*LyricsWidget) SetScroll ¶
func (w *LyricsWidget) SetScroll(v bool)
type ScrollDirection ¶
type ScrollDirection tcell.Key
ScrollDirection represents scroll direction for Scroll methods.