TreeView represents the treeview widget.
| 115 | |
| 116 | // TreeView represents the treeview widget. |
| 117 | type TreeView struct { |
| 118 | // mu protects access to the TreeView's fields. |
| 119 | mu sync.Mutex |
| 120 | // position stores the widget's top-left position. |
| 121 | position image.Point |
| 122 | // opts holds the configuration options for the TreeView. |
| 123 | opts *options |
| 124 | // selectedNode is the currently selected node. |
| 125 | selectedNode *TreeNode |
| 126 | // visibleNodes is the list of currently visible nodes. |
| 127 | visibleNodes []*TreeNode |
| 128 | // logger logs debugging information. |
| 129 | logger *log.Logger |
| 130 | // expandedIcon is the icon used for expanded nodes. |
| 131 | expandedIcon string |
| 132 | // collapsedIcon is the icon used for collapsed nodes. |
| 133 | collapsedIcon string |
| 134 | // leafIcon is the icon used for leaf nodes. |
| 135 | leafIcon string |
| 136 | // scrollOffset is the current vertical scroll offset. |
| 137 | scrollOffset int |
| 138 | // indentationPerLevel is the number of spaces to indent per tree level. |
| 139 | indentationPerLevel int |
| 140 | // canvasWidth is the width of the canvas. |
| 141 | canvasWidth int |
| 142 | // canvasHeight is the height of the canvas. |
| 143 | canvasHeight int |
| 144 | // totalContentHeight is the total height of the content. |
| 145 | totalContentHeight int |
| 146 | // waitingIcons are the icons used for the spinner. |
| 147 | waitingIcons []string |
| 148 | // lastSpinnerAdvance is when the spinner was last ticked, used to advance |
| 149 | // spinner state in Draw() without a background goroutine. |
| 150 | lastSpinnerAdvance time.Time |
| 151 | // lastClickTime is the timestamp of the last handled click. |
| 152 | lastClickTime time.Time |
| 153 | // lastKeyTime is the timestamp for debouncing the enter key. |
| 154 | lastKeyTime time.Time |
| 155 | } |
| 156 | |
| 157 | // spinnerInterval is how often the spinner icons advance when waitingIcons are |
| 158 | // configured. Advancement is driven by Draw() rather than a background |
nothing calls this directly
no outgoing calls
no test coverage detected