widgets

package
v0.0.0-...-40e63e7 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AlignLeft = iota
	AlignCenter
	AlignRight
)

Pieces may be aligned to left, center or right.

Variables

This section is empty.

Functions

func ColumnTitle

func ColumnTitle(key string) string

Types

type Application

type Application struct {
	Widgets widgets
	style.Styled
	// contains filtered or unexported fields
}

func NewApplication

func NewApplication(a api.API) (*Application, error)

func (*Application) Draw

func (app *Application) Draw()

func (*Application) Events

func (app *Application) Events() <-chan tcell.Event

func (*Application) Finish

func (app *Application) Finish()

func (*Application) HandleEvent

func (app *Application) HandleEvent(ev tcell.Event) bool

func (*Application) Init

func (app *Application) Init()

func (*Application) Poll

func (app *Application) Poll()

func (*Application) Refresh

func (app *Application) Refresh()

func (*Application) Resize

func (app *Application) Resize()

func (*Application) TableWidget

func (app *Application) TableWidget() api.TableWidget

type Multibar

type Multibar struct {
	views.WidgetWatchers
	style.Styled
	// contains filtered or unexported fields
}

Multibar receives keyboard events, displays status messages, and the position readout.

func NewMultibarWidget

func NewMultibarWidget(a api.API) *Multibar

func (*Multibar) Draw

func (w *Multibar) Draw()

Draw the statusbar part of the Multibar.

func (*Multibar) HandleEvent

func (w *Multibar) HandleEvent(ev tcell.Event) bool

func (*Multibar) Resize

func (w *Multibar) Resize()

func (*Multibar) SetView

func (w *Multibar) SetView(view views.View)

func (*Multibar) Size

func (w *Multibar) Size() (int, int)

type Table

type Table struct {
	style.Styled
	views.WidgetWatchers
	// contains filtered or unexported fields
}

Table is a tcell widget which draws a gridded table from a List instance.

func NewTable

func NewTable(a api.API) *Table

func (*Table) ColumnNames

func (w *Table) ColumnNames() []string

ColumnNames returns a list of the visible columns

func (*Table) Draw

func (w *Table) Draw()

func (*Table) GetVisibleBoundaries

func (w *Table) GetVisibleBoundaries() (ymin, ymax int)

func (*Table) HandleEvent

func (w *Table) HandleEvent(_ tcell.Event) bool

func (*Table) Height

func (w *Table) Height() int

Height returns the widget height.

func (*Table) List

func (w *Table) List() list.List

func (*Table) Name

func (w *Table) Name() string

func (*Table) PositionLongReadout

func (w *Table) PositionLongReadout() string

PositionLongReadout returns a formatted string containing the visible song range as well as the total number of songs. FIXME: move this into a positionreadout fragment

func (*Table) PositionReadout

func (w *Table) PositionReadout() string

PositionReadout returns a combination of PositionLongReadout() and PositionShortReadout(). FIXME: move this into a positionreadout fragment

func (*Table) PositionShortReadout

func (w *Table) PositionShortReadout() string

PositionShortReadout returns a percentage indicator on how far the songlist is scrolled. FIXME: move this into a positionreadout fragment

func (*Table) Resize

func (w *Table) Resize()

func (*Table) ScrollViewport

func (w *Table) ScrollViewport(delta int, movecursor bool)

ScrollViewport scrolls the viewport by delta rows, as far as possible. If movecursor is false, the cursor is kept pointing at the same song where possible. If true, the cursor is moved delta rows.

func (*Table) SetColumns

func (w *Table) SetColumns(tags []string)

SetColumns sets which columns that should be visible, and adjusts the sizes so they fit as close as possible to the median size of the content displayed.

func (*Table) SetList

func (w *Table) SetList(lst list.List)

func (*Table) SetView

func (w *Table) SetView(v views.View)

func (*Table) Size

func (w *Table) Size() (int, int)

func (*Table) Width

func (w *Table) Width() int

Width returns the widget width.

type Topbar

type Topbar struct {
	style.Styled
	views.WidgetWatchers
	// contains filtered or unexported fields
}

Topbar is a widget that can display a variety of information, such as the currently playing song. It is composed of several pieces to form a two-dimensional matrix.

func NewTopbar

func NewTopbar(a api.API) *Topbar

NewTopbar creates a new Topbar widget in the desired dimensions.

func (*Topbar) Draw

func (w *Topbar) Draw()

Draw draws all the pieces in the matrix, from top to bottom, right to left.

func (*Topbar) HandleEvent

func (w *Topbar) HandleEvent(ev tcell.Event) bool

func (*Topbar) Resize

func (w *Topbar) Resize()

func (*Topbar) SetMatrix

func (w *Topbar) SetMatrix(matrix *topbar.MatrixStatement)

Setup sets up the topbar using the provided configuration string.

func (*Topbar) SetView

func (w *Topbar) SetView(v views.View)

func (*Topbar) Size

func (w *Topbar) Size() (int, int)

Jump to

Keyboard shortcuts

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