()
| 573 | } |
| 574 | |
| 575 | func (li *gridLayoutItem) PerformLayout() []LayoutResultItem { |
| 576 | widths := li.sectionSizesForSpace(Horizontal, li.geometry.ClientSize.Width, nil) |
| 577 | heights := li.sectionSizesForSpace(Vertical, li.geometry.ClientSize.Height, widths) |
| 578 | |
| 579 | items := make([]LayoutResultItem, 0, len(li.item2Info)) |
| 580 | |
| 581 | margins := MarginsFrom96DPI(li.margins96dpi, li.ctx.dpi) |
| 582 | spacing := IntFrom96DPI(li.spacing96dpi, li.ctx.dpi) |
| 583 | |
| 584 | for item, info := range li.item2Info { |
| 585 | if !shouldLayoutItem(item) { |
| 586 | continue |
| 587 | } |
| 588 | |
| 589 | x := margins.HNear |
| 590 | for i := 0; i < info.cell.column; i++ { |
| 591 | if w := widths[i]; w > 0 { |
| 592 | x += w + spacing |
| 593 | } |
| 594 | } |
| 595 | |
| 596 | y := margins.VNear |
| 597 | for i := 0; i < info.cell.row; i++ { |
| 598 | if h := heights[i]; h > 0 { |
| 599 | y += h + spacing |
| 600 | } |
| 601 | } |
| 602 | |
| 603 | width := li.spannedWidth(info, widths) |
| 604 | height := li.spannedHeight(info, heights) |
| 605 | |
| 606 | w := width |
| 607 | h := height |
| 608 | |
| 609 | if lf := item.LayoutFlags(); lf&GrowableHorz == 0 || lf&GrowableVert == 0 { |
| 610 | var s Size |
| 611 | if hfw, ok := item.(HeightForWidther); !ok || !hfw.HasHeightForWidth() { |
| 612 | if is, ok := item.(IdealSizer); ok { |
| 613 | s = is.IdealSize() |
| 614 | } |
| 615 | } |
| 616 | |
| 617 | max := item.Geometry().MaxSize |
| 618 | if max.Width > 0 && s.Width > max.Width { |
| 619 | s.Width = max.Width |
| 620 | } |
| 621 | if lf&GrowableHorz == 0 { |
| 622 | w = s.Width |
| 623 | } |
| 624 | w = mini(w, width) |
| 625 | |
| 626 | if hfw, ok := item.(HeightForWidther); ok && hfw.HasHeightForWidth() { |
| 627 | h = hfw.HeightForWidth(w) |
| 628 | } else { |
| 629 | if max.Height > 0 && s.Height > max.Height { |
| 630 | s.Height = max.Height |
| 631 | } |
| 632 | if lf&GrowableVert == 0 { |
nothing calls this directly
no test coverage detected