collapsing

package
v0.0.0-...-c936f35 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: Apache-2.0 Imports: 8 Imported by: 5

Documentation

Overview

Package collapsing provides a group that supports expanding/collapsing, and a controller to allow programmatic expansion/collapse.

When collapsed (default state), only a button to expand is visible. When expanded, all module outputs are shown, and buttons to collapse.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultButtons

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

DefaultButtons returns the default button outputs: - When expanded, a '>' and '<' on either side. - When collapsed, a single '+'.

Types

type ButtonFunc

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

ButtonFunc produces outputs for buttons in a collapsing group.

type Controller

type Controller interface {
	// Expanded returns true if the group is expanded (showing output).
	Expanded() bool
	// Collapse collapses the group and hides all modules.
	Collapse()
	// Expand expands the group and shows all modules.
	Expand()
	// Toggle toggles the visibility of all modules.
	Toggle()
	// ButtonFunc controls the output for the button(s).
	ButtonFunc(ButtonFunc)
}

Controller provides an interface to control a collapsing group.

func Group

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

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

Jump to

Keyboard shortcuts

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