Documentation ¶
Index ¶
- type IdTree
- func (t *IdTree) Add(parent Ider, child Ider)
- func (t *IdTree) Children(parent Ider) []Ider
- func (t *IdTree) Clear()
- func (t *IdTree) Get(id string) Ider
- func (t *IdTree) GetAll() []Ider
- func (t *IdTree) Parent(child Ider) Ider
- func (t *IdTree) Remove(item Ider)
- func (t *IdTree) RemoveChildren(parent Ider)
- func (t *IdTree) Root(child Ider) Ider
- type Ider
- type TreeNode
- func (n *TreeNode) AddChildNode(c TreeNodeI)
- func (n *TreeNode) ChildNodes() []TreeNodeI
- func (n *TreeNode) Init(self TreeNodeI)
- func (n *TreeNode) ParentNode() TreeNodeI
- func (n *TreeNode) RemoveAllChildNodes()
- func (n *TreeNode) RemoveChildNode(c TreeNodeI)
- func (n *TreeNode) SetParent(p TreeNodeI)
- func (n *TreeNode) TopNode() TreeNodeI
- type TreeNodeI
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type IdTree ¶
The IdTree is a collection of Ider objects in a tree structure. Objects must have a unique id within the structure. It is likely that each of your objects will need a pointer to the IdTree to manipulate it, but that is an implementation dependant thing
func (*IdTree) RemoveChildren ¶
Remove all child controls
type Ider ¶
type Ider interface {
ID() string
}
Any object that returns a string id can be stored in the tree.
type TreeNode ¶
type TreeNode struct {
// contains filtered or unexported fields
}
A kind of mixin for anything that controls child controls, which are all controls, but also the top level form or page Creates a parent/child tree of controls that is used by the drawing code to draw the controls
func (*TreeNode) AddChildNode ¶
addChildNode adds the given node as a child of the current node
func (*TreeNode) ChildNodes ¶
func (*TreeNode) ParentNode ¶
func (*TreeNode) RemoveAllChildNodes ¶
func (n *TreeNode) RemoveAllChildNodes()
func (*TreeNode) RemoveChildNode ¶
The central removal function. Manages the entire remove process. Other removal functions should call here.
type TreeNodeI ¶
type TreeNodeI interface { AddChildNode(TreeNodeI) RemoveAllChildNodes() RemoveChildNode(TreeNodeI) ParentNode() TreeNodeI SetParent(TreeNodeI) TopNode() TreeNodeI ChildNodes() []TreeNodeI }
An interface and structure together that can turn any struct into a tree structure with parent/child relationships To use it, simply embed the TreeNode structure into another structure and call Init. This TreeNodeI structure will be convertable to the parent object