(index int, widget Widget)
| 550 | } |
| 551 | |
| 552 | func (s *Splitter) onRemovedWidget(index int, widget Widget) (err error) { |
| 553 | defer func() { |
| 554 | if err != nil { |
| 555 | return |
| 556 | } |
| 557 | |
| 558 | s.updateMarginsForFocusEffect() |
| 559 | }() |
| 560 | |
| 561 | _, isHandle := widget.(*splitterHandle) |
| 562 | if !s.removing && isHandle && s.children.Len()%2 == 1 { |
| 563 | return newError("cannot remove splitter handle") |
| 564 | } |
| 565 | |
| 566 | if !isHandle { |
| 567 | sl := s.layout.(*splitterLayout) |
| 568 | widget.AsWidgetBase().Property("Visible").Changed().Detach(sl.hwnd2Item[widget.Handle()].visibleChangedHandle) |
| 569 | } |
| 570 | |
| 571 | if !isHandle && s.children.Len() > 1 { |
| 572 | defer func() { |
| 573 | if err != nil { |
| 574 | return |
| 575 | } |
| 576 | |
| 577 | var handleIndex int |
| 578 | if index == 0 { |
| 579 | handleIndex = 0 |
| 580 | } else { |
| 581 | handleIndex = index - 1 |
| 582 | } |
| 583 | |
| 584 | s.removing = true |
| 585 | handle := s.children.items[handleIndex].window.(*splitterHandle) |
| 586 | |
| 587 | if err = handle.SetParent(nil); err == nil { |
| 588 | sl := s.layout.(*splitterLayout) |
| 589 | |
| 590 | for _, item := range sl.hwnd2Item { |
| 591 | item.oldExplicitSize = 0 |
| 592 | item.keepSize = false |
| 593 | } |
| 594 | |
| 595 | sl.resetNeeded = true |
| 596 | s.RequestLayout() |
| 597 | |
| 598 | handle.Dispose() |
| 599 | } |
| 600 | |
| 601 | s.removing = false |
| 602 | }() |
| 603 | } |
| 604 | |
| 605 | err = s.ContainerBase.onRemovedWidget(index, widget) |
| 606 | |
| 607 | return |
| 608 | } |
| 609 |
nothing calls this directly
no test coverage detected