widgetNextSibling returns next sibling or nil if none, including Parts, which are considered to come after Children.
(w Widget)
| 470 | // widgetNextSibling returns next sibling or nil if none, |
| 471 | // including Parts, which are considered to come after Children. |
| 472 | func widgetNextSibling(w Widget) Widget { |
| 473 | wb := w.AsWidget() |
| 474 | if wb.Parent == nil { |
| 475 | return nil |
| 476 | } |
| 477 | parent := wb.Parent.(Widget) |
| 478 | myidx := wb.IndexInParent() |
| 479 | if myidx >= 0 && myidx < wb.Parent.AsTree().NumChildren()-1 { |
| 480 | return parent.AsTree().Child(myidx + 1).(Widget) |
| 481 | } |
| 482 | return widgetNextSibling(parent) |
| 483 | } |
| 484 | |
| 485 | // widgetPrev returns the previous widget in the tree, |
| 486 | // including Parts, which are considered to come after Children. |
no test coverage detected