Added GetScrollOffset() and GetRowCount() to TreeView. Resolves #283

This commit is contained in:
Oliver 2019-06-09 18:25:13 +02:00
parent 384f577a62
commit b62197ade4
1 changed files with 15 additions and 0 deletions

View File

@ -375,6 +375,21 @@ func (t *TreeView) SetSelectedFunc(handler func(node *TreeNode)) *TreeView {
return t
}
// GetScrollOffset returns the number of node rows that were skipped at the top
// of the tree view. Note that when the user navigates the tree view, this value
// is only updated after the tree view has been redrawn.
func (t *TreeView) GetScrollOffset() int {
return t.offsetY
}
// GetRowCount returns the number of "visible" nodes. This includes nodes which
// fall outside the tree view's box but notably does not include the children
// of collapsed nodes. Note that this value is only up to date after the tree
// view has been drawn.
func (t *TreeView) GetRowCount() int {
return len(t.nodes)
}
// process builds the visible tree, populates the "nodes" slice, and processes
// pending selection actions.
func (t *TreeView) process() {