Documentation ¶
Index ¶
- Constants
- Variables
- type BaseTreeModel
- func (b *BaseTreeModel) AddChild(newModel TreeModel) error
- func (b *BaseTreeModel) AddChildAt(index int, newModel TreeModel) error
- func (b *BaseTreeModel) Children() []TreeModel
- func (b *BaseTreeModel) DisplayIcon() fyne.Resource
- func (b *BaseTreeModel) DisplayString() string
- func (b *BaseTreeModel) RemoveChild() TreeModel
- func (b *BaseTreeModel) RemoveChildAt(index int) TreeModel
- type TreeModel
- type TreeModelRegistry
- func (r *TreeModelRegistry) AddChild(parentID widget.TreeNodeID, data TreeModel) (widget.TreeNodeID, error)
- func (r *TreeModelRegistry) Children(parentID widget.TreeNodeID) []widget.TreeNodeID
- func (r *TreeModelRegistry) HasChildren(parentID widget.TreeNodeID) bool
- func (r *TreeModelRegistry) Node(nodeID widget.TreeNodeID) TreeModel
- func (r *TreeModelRegistry) Parent(childID widget.TreeNodeID) widget.TreeNodeID
- func (r *TreeModelRegistry) RemoveChild(dataID widget.TreeNodeID)
- func (r *TreeModelRegistry) Walk(walker TreeModelWalkFunc)
- type TreeModelWalkFunc
Constants ¶
View Source
const (
ModelRoot widget.TreeNodeID = ""
)
Variables ¶
View Source
var ( ErrNoSuchParent = errors.New("no such parent exists") ErrNilData = errors.New("nil data") )
View Source
var ErrBadIndex = errors.New("invalid index")
Functions ¶
This section is empty.
Types ¶
type BaseTreeModel ¶
type BaseTreeModel struct {
// contains filtered or unexported fields
}
BaseTreeModel is a helper type that implements TreeModel. Users only need to override DisplayIcon and/or DisplayString for read-only or non-persistent models.
func (*BaseTreeModel) AddChild ¶
func (b *BaseTreeModel) AddChild(newModel TreeModel) error
func (*BaseTreeModel) AddChildAt ¶
func (b *BaseTreeModel) AddChildAt(index int, newModel TreeModel) error
func (*BaseTreeModel) Children ¶
func (b *BaseTreeModel) Children() []TreeModel
func (*BaseTreeModel) DisplayIcon ¶
func (b *BaseTreeModel) DisplayIcon() fyne.Resource
func (*BaseTreeModel) DisplayString ¶
func (b *BaseTreeModel) DisplayString() string
func (*BaseTreeModel) RemoveChild ¶
func (b *BaseTreeModel) RemoveChild() TreeModel
func (*BaseTreeModel) RemoveChildAt ¶
func (b *BaseTreeModel) RemoveChildAt(index int) TreeModel
type TreeModel ¶
type TreeModel interface { DisplayIcon() fyne.Resource // DisplayIcon returns the icon resource that should be displayed by the tree node. Return nil for no icon. DisplayString() string // DisplayString returns the string that should be displayed by the tree node. Return an empty string for no label. Children() []TreeModel // Children returns a shallow copy of the list of child TreeModel. AddChild(TreeModel) error // AddChild appends a child to the child list. The error value should indicate that the addition was rejected. AddChildAt(int, TreeModel) error // AddChildAt adds a child to the child list at a particular location. The error value should indicate that the addition was rejected. RemoveChild() TreeModel // RemoveChild removes a child from the end of the list, if it exists. Returns nil if nothing was removed. RemoveChildAt(int) TreeModel // RemoveChildAt removes a child from the child list if one exists at the given location. Returns nil if nothing was removed or if the index was out of bounds. }
TreeModel must be implemented by any type that should respond to events from a generated tree.
type TreeModelRegistry ¶
type TreeModelRegistry struct {
// contains filtered or unexported fields
}
func NewTreeModelRegistry ¶
func NewTreeModelRegistry() *TreeModelRegistry
func (*TreeModelRegistry) AddChild ¶
func (r *TreeModelRegistry) AddChild(parentID widget.TreeNodeID, data TreeModel) (widget.TreeNodeID, error)
func (*TreeModelRegistry) Children ¶
func (r *TreeModelRegistry) Children(parentID widget.TreeNodeID) []widget.TreeNodeID
func (*TreeModelRegistry) HasChildren ¶
func (r *TreeModelRegistry) HasChildren(parentID widget.TreeNodeID) bool
func (*TreeModelRegistry) Node ¶
func (r *TreeModelRegistry) Node(nodeID widget.TreeNodeID) TreeModel
func (*TreeModelRegistry) Parent ¶
func (r *TreeModelRegistry) Parent(childID widget.TreeNodeID) widget.TreeNodeID
func (*TreeModelRegistry) RemoveChild ¶
func (r *TreeModelRegistry) RemoveChild(dataID widget.TreeNodeID)
func (*TreeModelRegistry) Walk ¶
func (r *TreeModelRegistry) Walk(walker TreeModelWalkFunc)
Walk traverses the registered tree, depth-first. Attempting to modify the tree while walking will result in a deadlock.
type TreeModelWalkFunc ¶
type TreeModelWalkFunc = func(parentID widget.TreeNodeID, parent TreeModel, nodeID widget.TreeNodeID, node TreeModel)
Click to show internal directories.
Click to hide internal directories.