MCPcopy Index your code
hub / github.com/g3n/engine / InsertAt

Method InsertAt

gui/tree.go:260–272  ·  view source on GitHub ↗

InsertAt inserts a child panel at the specified position in this node If the position is invalid, the function panics

(pos int, child IPanel)

Source from the content-addressed store, hash-verified

258// InsertAt inserts a child panel at the specified position in this node
259// If the position is invalid, the function panics
260func (n *TreeNode) InsertAt(pos int, child IPanel) {
261
262 if pos < 0 || pos > len(n.items) {
263 panic("TreeNode.InsertAt(): Invalid position")
264 }
265 // Insert item in the items array
266 n.items = append(n.items, nil)
267 copy(n.items[pos+1:], n.items[pos:])
268 n.items[pos] = child
269 if n.expanded {
270 n.updateItems()
271 }
272}
273
274// Add adds a child panel to this node
275func (n *TreeNode) Add(child IPanel) {

Callers 1

AddMethod · 0.95

Calls 1

updateItemsMethod · 0.95

Tested by

no test coverage detected