|
|
|
@ -20,7 +20,6 @@ type containerBox struct {
|
|
|
|
attrLayout attrHierarchy[tomo.AttrLayout]
|
|
|
|
attrLayout attrHierarchy[tomo.AttrLayout]
|
|
|
|
|
|
|
|
|
|
|
|
children []anyBox
|
|
|
|
children []anyBox
|
|
|
|
layout tomo.Layout
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
on struct {
|
|
|
|
on struct {
|
|
|
|
contentBoundsChange event.FuncBroadcaster
|
|
|
|
contentBoundsChange event.FuncBroadcaster
|
|
|
|
@ -187,19 +186,21 @@ func (this *containerBox) setAttr (attr tomo.Attr, user bool) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (this *containerBox) recommendedHeight (width int) int {
|
|
|
|
func (this *containerBox) recommendedHeight (width int) int {
|
|
|
|
if this.layout == nil || this.attrOverflow.Value().Y {
|
|
|
|
layout := this.attrLayout.Value().Layout
|
|
|
|
|
|
|
|
if layout == nil || this.attrOverflow.Value().Y {
|
|
|
|
return this.minSize.Value().Y
|
|
|
|
return this.minSize.Value().Y
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
return this.layout.RecommendedHeight(this.layoutHints(), this.boxQuerier(), width) +
|
|
|
|
return layout.RecommendedHeight(this.layoutHints(), this.boxQuerier(), width) +
|
|
|
|
this.borderAndPaddingSum().Vertical()
|
|
|
|
this.borderAndPaddingSum().Vertical()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (this *containerBox) recommendedWidth (height int) int {
|
|
|
|
func (this *containerBox) recommendedWidth (height int) int {
|
|
|
|
if this.layout == nil || this.attrOverflow.Value().X {
|
|
|
|
layout := this.attrLayout.Value().Layout
|
|
|
|
|
|
|
|
if layout == nil || this.attrOverflow.Value().X {
|
|
|
|
return this.minSize.Value().X
|
|
|
|
return this.minSize.Value().X
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
return this.layout.RecommendedWidth(this.layoutHints(), this.boxQuerier(), height) +
|
|
|
|
return layout.RecommendedWidth(this.layoutHints(), this.boxQuerier(), height) +
|
|
|
|
this.borderAndPaddingSum().Horizontal()
|
|
|
|
this.borderAndPaddingSum().Horizontal()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -274,8 +275,9 @@ func (this *containerBox) layoutHints () tomo.LayoutHints {
|
|
|
|
func (this *containerBox) contentMinimum () image.Point {
|
|
|
|
func (this *containerBox) contentMinimum () image.Point {
|
|
|
|
overflow := this.attrOverflow.Value()
|
|
|
|
overflow := this.attrOverflow.Value()
|
|
|
|
minimum := this.box.contentMinimum()
|
|
|
|
minimum := this.box.contentMinimum()
|
|
|
|
if this.layout != nil {
|
|
|
|
layout := this.attrLayout.Value().Layout
|
|
|
|
layoutMinimum := this.layout.MinimumSize (
|
|
|
|
if layout != nil {
|
|
|
|
|
|
|
|
layoutMinimum := layout.MinimumSize (
|
|
|
|
this.layoutHints(),
|
|
|
|
this.layoutHints(),
|
|
|
|
this.boxQuerier())
|
|
|
|
this.boxQuerier())
|
|
|
|
if overflow.X { layoutMinimum.X = 0 }
|
|
|
|
if overflow.X { layoutMinimum.X = 0 }
|
|
|