views

package
v1.4.2-0...-d7b39fe Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2020 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	STVert  = 0
	STHoriz = 1
	STUndef = 2
)

Variables

This section is empty.

Functions

func NewID

func NewID() uint64

NewID returns a new unique id

Types

type Node

type Node struct {
	View

	Kind SplitType
	// contains filtered or unexported fields
}

A Node describes a split in the tree If a node is a leaf node then it corresponds to a buffer that is being displayed otherwise it has a number of children of the opposite type (vertical splits have horizontal children and vice versa)

func NewNode

func NewNode(Kind SplitType, x, y, w, h int, parent *Node, id uint64) *Node

NewNode returns a new node with the given specifications

func NewRoot

func NewRoot(x, y, w, h int) *Node

NewRoot returns an empty Node with a size and location The type of the node will be determined by the first action on the node In other words, a lone split is neither horizontal nor vertical, it only becomes one or the other after a vsplit or hsplit is made

func (*Node) CanResize

func (n *Node) CanResize() bool

CanResize returns if this node can be resized

func (*Node) Children

func (n *Node) Children() []*Node

Children returns this node's children

func (*Node) GetNode

func (n *Node) GetNode(id uint64) *Node

GetNode returns the node with the given id in the tree of children that this node has access to or nil if the node with that id cannot be found

func (*Node) HSplit

func (n *Node) HSplit(bottom bool) uint64

HSplit creates a horizontal split and returns the id of the new split bottom specifies if the new split should be created on the top or bottom of the current split

func (*Node) ID

func (n *Node) ID() uint64

ID returns this node's id or 0 if it is not viewable

func (*Node) IsLeaf

func (n *Node) IsLeaf() bool

IsLeaf returns if this node is a leaf node

func (*Node) PropScale

func (n *Node) PropScale() bool

PropScale returns if this node is proportionally scaled

func (*Node) Resize

func (n *Node) Resize(w, h int)

Resize sets this node's size and resizes all children accordlingly

func (*Node) ResizeSplit

func (n *Node) ResizeSplit(size int) bool

ResizeSplit resizes a certain split to a given size

func (*Node) SetPropScale

func (n *Node) SetPropScale(b bool)

SetPropScale sets the propScale flag

func (*Node) SetResize

func (n *Node) SetResize(b bool)

SetResize sets the resize flag

func (*Node) String

func (n *Node) String() string

String returns the string form of the node and all children (used for debugging)

func (*Node) Unsplit

func (n *Node) Unsplit()

Unsplit deletes this split and resizes everything else accordingly

func (*Node) VSplit

func (n *Node) VSplit(right bool) uint64

VSplit creates a vertical split and returns the id of the new split right specifies if the new split should be created on the right or left of the current split

type SplitType

type SplitType uint8

type View

type View struct {
	X, Y int
	W, H int
}

A View is a size and location of a split

Jump to

Keyboard shortcuts

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