(ctx *LayoutContext)
| 723 | } |
| 724 | |
| 725 | func (cb *ComboBox) CreateLayoutItem(ctx *LayoutContext) LayoutItem { |
| 726 | var layoutFlags LayoutFlags |
| 727 | if cb.Editable() { |
| 728 | layoutFlags = GrowableHorz | GreedyHorz |
| 729 | } else { |
| 730 | layoutFlags = GrowableHorz |
| 731 | } |
| 732 | |
| 733 | defaultSize := cb.dialogBaseUnitsToPixels(Size{30, 12}) |
| 734 | |
| 735 | if cb.model != nil && cb.maxItemTextWidth <= 0 { |
| 736 | cb.maxItemTextWidth = cb.calculateMaxItemTextWidth() |
| 737 | } |
| 738 | |
| 739 | // FIXME: Use GetThemePartSize instead of guessing |
| 740 | w := maxi(defaultSize.Width, cb.maxItemTextWidth+int(win.GetSystemMetricsForDpi(win.SM_CXVSCROLL, uint32(ctx.dpi)))+8) |
| 741 | h := defaultSize.Height + 1 |
| 742 | |
| 743 | return &comboBoxLayoutItem{ |
| 744 | layoutFlags: layoutFlags, |
| 745 | idealSize: Size{w, h}, |
| 746 | } |
| 747 | } |
| 748 | |
| 749 | type comboBoxLayoutItem struct { |
| 750 | LayoutItemBase |
nothing calls this directly
no test coverage detected