MCPcopy Create free account
hub / github.com/lxn/walk / CreateLayoutItem

Method CreateLayoutItem

combobox.go:725–747  ·  view source on GitHub ↗
(ctx *LayoutContext)

Source from the content-addressed store, hash-verified

723}
724
725func (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
749type comboBoxLayoutItem struct {
750 LayoutItemBase

Callers

nothing calls this directly

Calls 4

EditableMethod · 0.95
maxiFunction · 0.85

Tested by

no test coverage detected