mirror of
https://github.com/rivo/tview.git
synced 2025-04-24 13:48:56 +08:00
Added GetScrollOffset() and GetRowCount() to TreeView. Resolves #283
This commit is contained in:
parent
384f577a62
commit
b62197ade4
15
treeview.go
15
treeview.go
@ -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() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user