barista.run: barista.run/group/switching Index | Files

package switching

import "barista.run/group/switching"

Package switching provides a group that displays modules one at a time, and a controller to switch to the next/previous/specific module.

Index

Package Files

switching.go

func DefaultButtons Uses

func DefaultButtons(c Controller) (start, end bar.Output)

DefaultButtons provides the default switching buttons: - '<' at the start, if there are modules before the current one, - '>' at the end, if there are modules after the current one.

type ButtonFunc Uses

type ButtonFunc func(Controller) (start, end bar.Output)

ButtonFunc produces outputs for buttons in a switching group.

type Controller Uses

type Controller interface {
    // Current returns the index of the currently active module.
    Current() int
    // Previous switches to the previous module.
    Previous()
    // Next switches to the next module.
    Next()
    // Show sets the currently active module.
    Show(int)
    // Count returns the number of modules in this group
    Count() int
    // ButtonFunc controls the output for the buttons on either end.
    ButtonFunc(ButtonFunc)
}

Controller provides an interface to control a switching group.

func Group Uses

func Group(m ...bar.Module) (bar.Module, Controller)

Group returns a new switching group, and a linked controller.

Package switching imports 8 packages (graph). Updated 2018-11-03. Refresh now. Tools for package owners.