Documentation ¶
Index ¶
- Constants
- func InitTreeNode(newNode *TreeNode, model TreeNodeModel)
- func NewExpandHandle(node *TreeNode) *expandHandle
- type NodeEventHandler
- type StaticNodeModel
- type TapEventHandler
- type TreeContainer
- func (n TreeContainer) Append(node *TreeNode) error
- func (t *TreeContainer) CreateRenderer() fyne.WidgetRenderer
- func (n TreeContainer) IndexOf(node *TreeNode) int
- func (n TreeContainer) InsertAt(position int, node *TreeNode) error
- func (n TreeContainer) InsertSorted(node *TreeNode) error
- func (n TreeContainer) Len() int
- func (t *TreeContainer) NumRoots() int
- func (t *TreeContainer) Refresh()
- func (n TreeContainer) Remove(node *TreeNode) (removedNode fyne.CanvasObject, err error)
- func (n TreeContainer) RemoveAt(position int) (removedNode fyne.CanvasObject, err error)
- type TreeNode
- func (n TreeNode) Append(node *TreeNode) error
- func (n *TreeNode) Condense()
- func (n *TreeNode) CreateRenderer() fyne.WidgetRenderer
- func (n *TreeNode) DoubleTapped(pe *fyne.PointEvent)
- func (n *TreeNode) Expand()
- func (n *TreeNode) GetModelIconResource() fyne.Resource
- func (n *TreeNode) GetModelText() string
- func (n *TreeNode) GetParent() *TreeNode
- func (n TreeNode) IndexOf(node *TreeNode) int
- func (n TreeNode) InsertAt(position int, node *TreeNode) error
- func (n TreeNode) InsertSorted(node *TreeNode) error
- func (n *TreeNode) IsBranch() bool
- func (n *TreeNode) IsCondensed() bool
- func (n *TreeNode) IsExpanded() bool
- func (n *TreeNode) IsLeaf() bool
- func (n TreeNode) Len() int
- func (n *TreeNode) NumChildren() int
- func (n TreeNode) Remove(node *TreeNode) (removedNode fyne.CanvasObject, err error)
- func (n TreeNode) RemoveAt(position int) (removedNode fyne.CanvasObject, err error)
- func (n *TreeNode) SetBranch()
- func (n *TreeNode) SetLeaf()
- func (n *TreeNode) TappedSecondary(pe *fyne.PointEvent)
- func (n *TreeNode) ToggleExpand()
- type TreeNodeModel
Constants ¶
const (
HierarchyPadding = 24
)
Variables ¶
This section is empty.
Functions ¶
func InitTreeNode ¶
func InitTreeNode(newNode *TreeNode, model TreeNodeModel)
InitTreeNode initializes the given tree node with the given model. If newNode is nil, then a new one will be created.
func NewExpandHandle ¶
func NewExpandHandle(node *TreeNode) *expandHandle
Types ¶
type NodeEventHandler ¶
type NodeEventHandler func()
NodeEventHandler is a handler function for node events triggered by the view.
type StaticNodeModel ¶
func NewStaticBoundModel ¶
func NewStaticBoundModel(resource fyne.Resource, text string) *StaticNodeModel
NewStaticBoundModel creates a TreeNode and StaticNodeModel at the same time, and returns the bound model.
func NewStaticModel ¶
func NewStaticModel(resource fyne.Resource, text string) *StaticNodeModel
NewStaticModel creates a TreeNodeModel with fixed values that never change.
func (*StaticNodeModel) GetIconResource ¶
func (s *StaticNodeModel) GetIconResource() fyne.Resource
func (*StaticNodeModel) GetText ¶
func (s *StaticNodeModel) GetText() string
func (*StaticNodeModel) SetTreeNode ¶
func (s *StaticNodeModel) SetTreeNode(node *TreeNode)
type TapEventHandler ¶
type TapEventHandler func(pe *fyne.PointEvent)
TapEventHandler is a handler function for tap events triggered by the view.
type TreeContainer ¶
type TreeContainer struct { widget.BaseWidget Background color.Color // contains filtered or unexported fields }
TreeContainer widget simplifies display of several root tree nodes.
func NewTreeContainer ¶
func NewTreeContainer() *TreeContainer
func (*TreeContainer) CreateRenderer ¶ added in v0.0.2
func (t *TreeContainer) CreateRenderer() fyne.WidgetRenderer
func (TreeContainer) IndexOf ¶
IndexOf returns the index of the given node in the list if it's present, -1 otherwise.
func (TreeContainer) InsertAt ¶
InsertAt a new TreeNode at the given position as a child of this Objects.
func (TreeContainer) InsertSorted ¶
func (*TreeContainer) NumRoots ¶
func (t *TreeContainer) NumRoots() int
func (*TreeContainer) Refresh ¶
func (t *TreeContainer) Refresh()
type TreeNode ¶
type TreeNode struct { widget.BaseWidget OnBeforeExpand NodeEventHandler OnAfterCondense NodeEventHandler OnTappedSecondary TapEventHandler OnIconTapped TapEventHandler OnLabelTapped TapEventHandler OnTapped TapEventHandler OnDoubleTapped TapEventHandler // contains filtered or unexported fields }
TreeNode holds a TreeNodeModel's position within the view.
func NewBranchTreeNode ¶
func NewBranchTreeNode(model TreeNodeModel) *TreeNode
func NewLeafTreeNode ¶
func NewLeafTreeNode(model TreeNodeModel) *TreeNode
func NewTreeNode ¶
func NewTreeNode(model TreeNodeModel) *TreeNode
NewTreeNode constructs a tree node with the given model.
func (*TreeNode) Condense ¶
func (n *TreeNode) Condense()
Condense condenses the node and triggers the AfterCondense hook in the model if it's a branch and not already condensed.
func (*TreeNode) CreateRenderer ¶
func (n *TreeNode) CreateRenderer() fyne.WidgetRenderer
func (*TreeNode) DoubleTapped ¶
func (n *TreeNode) DoubleTapped(pe *fyne.PointEvent)
func (*TreeNode) Expand ¶
func (n *TreeNode) Expand()
Expand expands the node and triggers the OnBeforeExpand hook in the model if it's a branch and not already expanded.
func (*TreeNode) GetModelIconResource ¶
GetModelIconResource gets the icon for this node.
func (*TreeNode) GetModelText ¶
GetModelText gets the text for this node.
func (TreeNode) IndexOf ¶
IndexOf returns the index of the given node in the list if it's present, -1 otherwise.
func (TreeNode) InsertAt ¶
InsertAt a new TreeNode at the given position as a child of this Objects.
func (TreeNode) InsertSorted ¶
func (*TreeNode) IsCondensed ¶
IsCondensed returns whether this node is condensed down and child nodes are not shown.
func (*TreeNode) IsExpanded ¶
IsExpanded returns whether this node is expanded.
func (*TreeNode) NumChildren ¶
NumChildren returns how many child nodes this node has.
func (TreeNode) Remove ¶
func (n TreeNode) Remove(node *TreeNode) (removedNode fyne.CanvasObject, err error)
Remove searches for the given node to remove and return it if it exists, returns nil and an error otherwise.
func (TreeNode) RemoveAt ¶
func (n TreeNode) RemoveAt(position int) (removedNode fyne.CanvasObject, err error)
Remove the child node at the given position and return it. An error is returned if the index is invalid or the node is not found.
func (*TreeNode) SetBranch ¶
func (n *TreeNode) SetBranch()
SetBranch sets this node to a branch node.
func (*TreeNode) TappedSecondary ¶
func (n *TreeNode) TappedSecondary(pe *fyne.PointEvent)
func (*TreeNode) ToggleExpand ¶
func (n *TreeNode) ToggleExpand()
ToggleExpand toggles the expand state of the node.
type TreeNodeModel ¶
type TreeNodeModel interface { // GetIconResource should return the user defined icon Resource to show in the view, or nil if no icon is needed. GetIconResource() fyne.Resource // GetText should return the user defined Text to display for this node in the view, or "" if no Text is needed. GetText() string // SetTreeNode is called by node initialization when the model is bound to the node. SetTreeNode(node *TreeNode) }
TreeNodeModel is the interface to user defined data.