checklist

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2019 License: MPL-2.0 Imports: 0 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Checklist

type Checklist struct {
	Items []*ChecklistItem
	// contains filtered or unexported fields
}

Checklist is a module for creating generic checklist implementations See 'Todo' for an implementation example

func NewChecklist

func NewChecklist(checkedIcon, uncheckedIcon string) Checklist

func (*Checklist) Add

func (list *Checklist) Add(checked bool, text string)

Add creates a new item in the checklist

func (*Checklist) CheckedItems

func (list *Checklist) CheckedItems() []*ChecklistItem

CheckedItems returns a slice of all the checked items

func (*Checklist) Delete

func (list *Checklist) Delete()

Delete removes the selected item from the checklist

func (*Checklist) Demote

func (list *Checklist) Demote()

Demote moves the selected item DOWN in the checklist

func (*Checklist) IsSelectable

func (list *Checklist) IsSelectable() bool

IsSelectable returns true if the checklist has selectable items, false if it does not

func (*Checklist) IsUnselectable

func (list *Checklist) IsUnselectable() bool

IsUnselectable returns true if the checklist has no selectable items, false if it does

func (*Checklist) Len

func (list *Checklist) Len() int

func (*Checklist) Less

func (list *Checklist) Less(i, j int) bool

func (*Checklist) LongestLine

func (list *Checklist) LongestLine() int

LongestLine returns the length of the longest checklist item's text

func (*Checklist) Next

func (list *Checklist) Next()

Next selects the next item DOWN in the checklist

func (*Checklist) Prev

func (list *Checklist) Prev()

Prev selects the previous item UP in the checklist

func (*Checklist) Promote

func (list *Checklist) Promote()

Promote moves the selected item UP in the checklist

func (*Checklist) Selected

func (list *Checklist) Selected() int

func (*Checklist) SelectedItem

func (list *Checklist) SelectedItem() *ChecklistItem

SelectedItem returns the currently-selected checklist item or nil if no item is selected

func (*Checklist) SetSelectedByItem

func (list *Checklist) SetSelectedByItem(selectableItem *ChecklistItem)

func (*Checklist) Swap

func (list *Checklist) Swap(i, j int)

func (*Checklist) Toggle

func (list *Checklist) Toggle()

Toggle switches the checked state of the currently-selected item

func (*Checklist) UncheckedItems

func (list *Checklist) UncheckedItems() []*ChecklistItem

UncheckedItems returns a slice of all the unchecked items

func (*Checklist) Unselect

func (list *Checklist) Unselect()

Unselect removes the current select such that no item is selected

func (*Checklist) Update

func (list *Checklist) Update(text string)

Update sets the text of the currently-selected item to the provided text

type ChecklistItem

type ChecklistItem struct {
	Checked       bool
	CheckedIcon   string
	Text          string
	UncheckedIcon string
}

ChecklistItem is a module for creating generic checklist implementations See 'Todo' for an implementation example

func NewChecklistItem

func NewChecklistItem(checked bool, text string, checkedIcon, uncheckedIcon string) *ChecklistItem

func (*ChecklistItem) CheckMark

func (item *ChecklistItem) CheckMark() string

CheckMark returns the string used to indicate a ChecklistItem is checked or unchecked

func (*ChecklistItem) Toggle

func (item *ChecklistItem) Toggle()

Toggle changes the checked state of the ChecklistItem If checked, it is unchecked. If unchecked, it is checked

Jump to

Keyboard shortcuts

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