tree

package
v0.0.0-...-a1cdf6c Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2024 License: MIT Imports: 5 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ActiveTreeSet

func ActiveTreeSet(tr *Tree)

func SetRootTree

func SetRootTree(tr *Tree)

Types

type Leaf

type Leaf interface {
	View() *View

	Resize(int, int, utils.Rect)
	Draw()
	Redraw()
	Kill(*Leaf, bool) *Leaf
	// ForceDraw()
	// Stat(Stat)
	ViewActive(bool)

	Event(*tcell.Event) *tcell.Event

	Resume()
	Init()
	WillClose() //
}
var ActiveLeaf *Leaf

func GetLeavesByViewName

func GetLeavesByViewName(name string) []*Leaf

type OpMode

type OpMode struct {
	Screen *screen.Screen
}

func NewOpMode

func NewOpMode() *OpMode

func (OpMode) Draw

func (v OpMode) Draw()

func (OpMode) SelectName

func (v OpMode) SelectName(ch rune) *Tree

type Tree

type Tree struct {
	utils.Rect
	// contains filtered or unexported fields
}

func ActiveTreeGet

func ActiveTreeGet() *Tree

func GetRootTree

func GetRootTree() *Tree

func NewRootTree

func NewRootTree(view *View) *Tree

Create a new Tree and assign view

func (*Tree) Draw

func (tr *Tree) Draw()

func (*Tree) Event

func (tr *Tree) Event(ev *tcell.Event)

func (*Tree) GetLeaf

func (tr *Tree) GetLeaf() *Leaf

func (*Tree) Kill

func (tr *Tree) Kill(leaf *Leaf, isActive bool)

func (*Tree) NearestHSplit

func (tr *Tree) NearestHSplit() *Tree

func (*Tree) NearestVSplit

func (tr *Tree) NearestVSplit() *Tree

func (*Tree) NextInCycle

func (tr *Tree) NextInCycle()

func (*Tree) Redraw

func (tr *Tree) Redraw()

func (*Tree) Remove

func (tr *Tree) Remove()

func (*Tree) Resize

func (tr *Tree) Resize(rect utils.Rect)

or error

func (*Tree) SetLeaf

func (tr *Tree) SetLeaf(leaf *Leaf)

func (*Tree) Sibling

func (tr *Tree) Sibling() *Tree

Find subling Tree

func (*Tree) SplitHorizontally

func (tr *Tree) SplitHorizontally()

Split Tree. Set new Active Tree to active.

func (*Tree) SplitVertically

func (tr *Tree) SplitVertically()

Split Tree. Set new Active Tree to active.

func (*Tree) StepResize

func (tr *Tree) StepResize(n int)

func (*Tree) Traverse

func (tr *Tree) Traverse(cb func(*Tree))

This method recursively traverses the tree and applies a callback function cb to each node it visits.

type View

type View interface {
	NewLeaf() *Leaf

	// Mainly used for splitting the screen.
	// In the new window created by splitting the screen,
	// a new tree.Leaf of the same type as the parent tree.Leaf before splitting is cloned.
	//
	// For te.Editor:
	// Create a new tree.Leaf (Editor) and make it the same as leaf *tree.Leaf
	// direction: "right", "bottom" are not referenced
	NewSiblingLeaf(direction string, leaf *Leaf) *Leaf

	Name() string // this view name

}

type ViewsStruct

type ViewsStruct struct {
	// contains filtered or unexported fields
}
var Views *ViewsStruct // User Views

func NewViews

func NewViews() *ViewsStruct

func (*ViewsStruct) GetDefaultView

func (vs *ViewsStruct) GetDefaultView() *View

Return the first registered *View as default view

func (*ViewsStruct) GetViewByName

func (vs *ViewsStruct) GetViewByName(name string) *View

Return *View by View Name

func (ViewsStruct) GetViews

func (vs ViewsStruct) GetViews() []View

func (*ViewsStruct) Register

func (vs *ViewsStruct) Register(view View)

Register View

Jump to

Keyboard shortcuts

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