Documentation ¶
Index ¶
- Constants
- func PostEventInputChanged(w eventfulWidget)
- func PostEventInputFinished(w eventfulWidget)
- func PostEventListChanged(w eventfulWidget)
- func PostEventScroll(w eventfulWidget)
- type ColumnheadersWidget
- func (c *ColumnheadersWidget) Draw()
- func (w *ColumnheadersWidget) HandleEvent(ev tcell.Event) bool
- func (w *ColumnheadersWidget) Resize()
- func (c *ColumnheadersWidget) SetColumns(cols songlist.Columns)
- func (c *ColumnheadersWidget) SetView(v views.View)
- func (c *ColumnheadersWidget) Size() (int, int)
- type EventInputChanged
- type EventInputFinished
- type EventListChanged
- type EventScroll
- type MultibarWidget
- func (m *MultibarWidget) Cursor() int
- func (m *MultibarWidget) DrawStatusbar()
- func (m *MultibarWidget) HandleEvent(ev tcell.Event) bool
- func (m *MultibarWidget) History() *history
- func (m *MultibarWidget) Mode() int
- func (w *MultibarWidget) Resize()
- func (m *MultibarWidget) RuneLen() int
- func (m *MultibarWidget) RuneString() string
- func (m *MultibarWidget) SetMessage(msg message.Message)
- func (m *MultibarWidget) SetMode(mode int) error
- type SonglistWidget
- func (w *SonglistWidget) Draw()
- func (w *SonglistWidget) GetVisibleBoundaries() (ymin, ymax int)
- func (m *SonglistWidget) HandleEvent(ev tcell.Event) bool
- func (w *SonglistWidget) Height() int
- func (w *SonglistWidget) List() songlist.Songlist
- func (w *SonglistWidget) Name() string
- func (w *SonglistWidget) Panel() *songlist.Collection
- func (w *SonglistWidget) PositionLongReadout() string
- func (w *SonglistWidget) PositionReadout() string
- func (w *SonglistWidget) PositionShortReadout() string
- func (w *SonglistWidget) Resize()
- func (w *SonglistWidget) ScrollViewport(delta int, movecursor bool)
- func (w *SonglistWidget) SetColumns(tags []string)
- func (w *SonglistWidget) SetView(v views.View)
- func (w *SonglistWidget) Size() (int, int)
- func (w *SonglistWidget) Width() int
- type Topbar
- type UI
- func (ui *UI) CreateLayout()
- func (ui *UI) CurrentSonglistWidget() api.SonglistWidget
- func (ui *UI) Draw()
- func (ui *UI) HandleEvent(ev tcell.Event) bool
- func (ui *UI) PostFunc(f func())
- func (ui *UI) Quit()
- func (ui *UI) Refresh()
- func (ui *UI) Resize()
- func (ui *UI) SetView(v views.View)
- func (ui *UI) Size() (int, int)
- func (ui *UI) Start()
- func (ui *UI) UpdateCursor()
- func (ui *UI) Wait() error
Constants ¶
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
}
type EventInputFinished ¶
type EventInputFinished struct {
// contains filtered or unexported fields
}
type EventListChanged ¶
type EventListChanged struct {
// contains filtered or unexported fields
}
type EventScroll ¶
type EventScroll struct {
// contains filtered or unexported fields
}
type MultibarWidget ¶
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)
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 (*Topbar) SetMatrix ¶
func (w *Topbar) SetMatrix(matrix *topbar.MatrixStatement)
Setup sets up the topbar using the provided configuration string.
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 (*UI) CreateLayout ¶
func (ui *UI) CreateLayout()
func (*UI) CurrentSonglistWidget ¶
func (ui *UI) CurrentSonglistWidget() api.SonglistWidget
func (*UI) HandleEvent ¶
func (*UI) UpdateCursor ¶
func (ui *UI) UpdateCursor()