widgets

package
v0.0.0-...-628d497 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2023 License: MIT Imports: 21 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 PostEventInputChanged

func PostEventInputChanged(w eventfulWidget)

func PostEventInputFinished

func PostEventInputFinished(w eventfulWidget)

func PostEventListChanged

func PostEventListChanged(w eventfulWidget)

func PostEventScroll

func PostEventScroll(w eventfulWidget)

Types

type ColumnheadersWidget

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

func NewColumnheadersWidget

func NewColumnheadersWidget() (c *ColumnheadersWidget)

func (*ColumnheadersWidget) Draw

func (c *ColumnheadersWidget) Draw()

func (*ColumnheadersWidget) HandleEvent

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

func (*ColumnheadersWidget) Resize

func (w *ColumnheadersWidget) Resize()

func (*ColumnheadersWidget) SetColumns

func (c *ColumnheadersWidget) SetColumns(cols songlist.Columns)

func (*ColumnheadersWidget) SetView

func (c *ColumnheadersWidget) SetView(v views.View)

func (*ColumnheadersWidget) Size

func (c *ColumnheadersWidget) Size() (int, int)

type EventInputChanged

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

func (*EventInputChanged) SetWidget

func (wev *EventInputChanged) SetWidget(widget views.Widget)

func (*EventInputChanged) Widget

func (wev *EventInputChanged) Widget() views.Widget

type EventInputFinished

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

func (*EventInputFinished) SetWidget

func (wev *EventInputFinished) SetWidget(widget views.Widget)

func (*EventInputFinished) Widget

func (wev *EventInputFinished) Widget() views.Widget

type EventListChanged

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

func (*EventListChanged) SetWidget

func (wev *EventListChanged) SetWidget(widget views.Widget)

func (*EventListChanged) Widget

func (wev *EventListChanged) Widget() views.Widget

type EventScroll

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

func (*EventScroll) SetWidget

func (wev *EventScroll) SetWidget(widget views.Widget)

func (*EventScroll) Widget

func (wev *EventScroll) Widget() views.Widget

type MultibarWidget

type MultibarWidget struct {
	views.TextBar
	style.Styled
	// contains filtered or unexported fields
}

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

func NewMultibarWidget

func NewMultibarWidget(a api.API, events chan *tcell.EventKey) *MultibarWidget

func (*MultibarWidget) Cursor

func (m *MultibarWidget) Cursor() int

Cursor returns the physical cursor position. The `cursor` member points to the actual character index, which may be a wide character. Thus, we must calculate the actual physical width of the content up to the point where the cursor is.

func (*MultibarWidget) DrawStatusbar

func (m *MultibarWidget) DrawStatusbar()

Draw the statusbar part of the Multibar.

func (*MultibarWidget) HandleEvent

func (m *MultibarWidget) HandleEvent(ev tcell.Event) bool

func (*MultibarWidget) History

func (m *MultibarWidget) History() *history

History returns the input history of the current input mode.

func (*MultibarWidget) Mode

func (m *MultibarWidget) Mode() int

func (*MultibarWidget) Resize

func (w *MultibarWidget) Resize()

func (*MultibarWidget) RuneLen

func (m *MultibarWidget) RuneLen() int

func (*MultibarWidget) RuneString

func (m *MultibarWidget) RuneString() string

func (*MultibarWidget) SetMessage

func (m *MultibarWidget) SetMessage(msg message.Message)

func (*MultibarWidget) SetMode

func (m *MultibarWidget) SetMode(mode int) error

type SonglistWidget

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

SonglistWidget is a tcell widget which draws a Songlist on the screen. It maintains a list of songlists which can be cycled through.

func NewSonglistWidget

func NewSonglistWidget(a api.API) (w *SonglistWidget)

func (*SonglistWidget) Draw

func (w *SonglistWidget) Draw()

func (*SonglistWidget) GetVisibleBoundaries

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

func (*SonglistWidget) HandleEvent

func (m *SonglistWidget) HandleEvent(ev tcell.Event) bool

func (*SonglistWidget) Height

func (w *SonglistWidget) Height() int

Height returns the widget height.

func (*SonglistWidget) List

func (w *SonglistWidget) List() songlist.Songlist

func (*SonglistWidget) Name

func (w *SonglistWidget) Name() string

func (*SonglistWidget) Panel

func (w *SonglistWidget) Panel() *songlist.Collection

func (*SonglistWidget) PositionLongReadout

func (w *SonglistWidget) 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 (*SonglistWidget) PositionReadout

func (w *SonglistWidget) PositionReadout() string

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

func (*SonglistWidget) PositionShortReadout

func (w *SonglistWidget) PositionShortReadout() string

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

func (*SonglistWidget) Resize

func (w *SonglistWidget) Resize()

func (*SonglistWidget) ScrollViewport

func (w *SonglistWidget) 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 (*SonglistWidget) SetColumns

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

SetColumns sets which columns that should be visible

func (*SonglistWidget) SetView

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

func (*SonglistWidget) Size

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

func (*SonglistWidget) Width

func (w *SonglistWidget) 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() *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)

type UI

type UI struct {
	// UI elements
	Screen tcell.Screen
	App    *views.Application
	Layout *views.BoxLayout

	Topbar        *Topbar
	Columnheaders *ColumnheadersWidget
	Multibar      *MultibarWidget
	Songlist      *SonglistWidget

	// Input events
	EventInputCommand chan string
	EventKeyInput     chan *tcell.EventKey

	style.Styled
	views.WidgetWatchers
	// contains filtered or unexported fields
}

func NewUI

func NewUI(a api.API) (*UI, error)

func (*UI) CreateLayout

func (ui *UI) CreateLayout()

func (*UI) CurrentSonglistWidget

func (ui *UI) CurrentSonglistWidget() api.SonglistWidget

func (*UI) Draw

func (ui *UI) Draw()

func (*UI) HandleEvent

func (ui *UI) HandleEvent(ev tcell.Event) bool

func (*UI) PostFunc

func (ui *UI) PostFunc(f func())

func (*UI) Quit

func (ui *UI) Quit()

func (*UI) Refresh

func (ui *UI) Refresh()

func (*UI) Resize

func (ui *UI) Resize()

func (*UI) SetView

func (ui *UI) SetView(v views.View)

func (*UI) Size

func (ui *UI) Size() (int, int)

func (*UI) Start

func (ui *UI) Start()

func (*UI) UpdateCursor

func (ui *UI) UpdateCursor()

func (*UI) Wait

func (ui *UI) Wait() error

Jump to

Keyboard shortcuts

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