Documentation
¶
Index ¶
- Constants
- type Option
- func CollapsedIcon(icon string) Option
- func EnableLogging(_ bool) Optiondeprecated
- func ExpandedIcon(icon string) Option
- func Icons(expanded, collapsed, leaf string) Option
- func Indentation(spaces int) Option
- func IndentationPerLevel(spaces int) Option
- func Label(_ string) Option
- func LabelColor(color cell.Color) Option
- func LeafIcon(icon string) Option
- func LogWriter(w io.Writer) Option
- func Nodes(nodes ...*TreeNode) Option
- func Truncate(truncate bool) Option
- func WaitingIcons(icons []string) Option
- type TreeNode
- func (tn *TreeNode) GetExpandedState() bool
- func (tn *TreeNode) GetShowSpinner() bool
- func (tn *TreeNode) GetSpinnerIndex() int
- func (tn *TreeNode) IncrementSpinner(totalIcons int)
- func (tn *TreeNode) IsRoot() bool
- func (tn *TreeNode) SetExpandedState(value bool)
- func (tn *TreeNode) SetShowSpinner(value bool)
- type TreeView
- func (tv *TreeView) Draw(cvs *canvas.Canvas, meta *widgetapi.Meta) error
- func (tv *TreeView) Keyboard(k *terminalapi.Keyboard, meta *widgetapi.EventMeta) error
- func (tv *TreeView) Mouse(m *terminalapi.Mouse, meta *widgetapi.EventMeta) error
- func (tv *TreeView) Next()
- func (tv *TreeView) Options() widgetapi.Options
- func (tv *TreeView) Previous()
- func (tv *TreeView) Select() (string, error)
- func (tv *TreeView) StopSpinnerTicker()
Constants ¶
const (
ScrollStep = 5
)
Number of nodes to scroll per mouse wheel event.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
Option configures a TreeView.
func CollapsedIcon ¶
CollapsedIcon sets the icon for collapsed nodes.
func EnableLogging
deprecated
func ExpandedIcon ¶
ExpandedIcon sets the icon for expanded nodes.
func Indentation ¶
Indentation sets the number of spaces for each indentation level.
func IndentationPerLevel ¶
IndentationPerLevel sets the indentation per level. Alias to Indentation for compatibility with demo code.
func Label ¶
Label sets the widget's label. Note: If the widget's label is managed by the container, this can be a no-op.
func LabelColor ¶
LabelColor sets the color of the node labels.
func LogWriter ¶
LogWriter directs debug log output to w. Pass io.Discard (or omit the option) to silence all output. New() never opens files on your behalf.
func WaitingIcons ¶
WaitingIcons sets the icons for the spinner.
type TreeNode ¶
type TreeNode struct {
// ID is the unique identifier for the node.
ID string
// Label is the display text of the node.
Label string
// Level is the depth level of the node in the tree.
Level int
// Parent is the parent node of this node.
Parent *TreeNode
// Children are the child nodes of this node.
Children []*TreeNode
// Value holds any data associated with the node.
Value interface{}
// ShowSpinner indicates whether to display a spinner for this node.
ShowSpinner bool
// OnClick is the function to execute when the node is clicked.
OnClick func() error
// ExpandedState indicates whether the node is expanded to show its children.
ExpandedState bool
// SpinnerIndex is the current index for the spinner icons.
SpinnerIndex int
// contains filtered or unexported fields
}
TreeNode represents a node in the treeview.
func (*TreeNode) GetExpandedState ¶
GetExpandedState safely retrieves the ExpandedState flag.
func (*TreeNode) GetShowSpinner ¶
GetShowSpinner safely retrieves the ShowSpinner flag.
func (*TreeNode) GetSpinnerIndex ¶
GetSpinnerIndex safely retrieves the current SpinnerIndex.
func (*TreeNode) IncrementSpinner ¶
IncrementSpinner safely increments the SpinnerIndex.
func (*TreeNode) SetExpandedState ¶
SetExpandedState safely sets the ExpandedState flag.
func (*TreeNode) SetShowSpinner ¶
SetShowSpinner safely sets the ShowSpinner flag.
type TreeView ¶
type TreeView struct {
// contains filtered or unexported fields
}
TreeView represents the treeview widget.
func (*TreeView) Mouse ¶
Mouse handles mouse events with debouncing for ButtonLeft clicks. It processes mouse press events and mouse wheel events.
func (*TreeView) Options ¶
Options returns the widget options to satisfy the widgetapi.Widget interface.
func (*TreeView) StopSpinnerTicker ¶
func (tv *TreeView) StopSpinnerTicker()
StopSpinnerTicker is a no-op kept for backward compatibility. The spinner is now driven by Draw() rather than a background goroutine.