From 1239f4e03df4852a7e8adeff595a6596f8934b8c Mon Sep 17 00:00:00 2001 From: Sasha Koshka Date: Wed, 15 Mar 2023 23:57:22 -0400 Subject: [PATCH] Made DocumentContainer satisfy FlexibleParent --- elements/basic/documentContainer.go | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/elements/basic/documentContainer.go b/elements/basic/documentContainer.go index a5ddda9..194488a 100644 --- a/elements/basic/documentContainer.go +++ b/elements/basic/documentContainer.go @@ -43,12 +43,6 @@ func (element *DocumentContainer) Adopt (child elements.Element) { if child0, ok := child.(elements.Configurable); ok { child0.SetConfig(element.config.Config) } - // if child0, ok := child.(elements.Flexible); ok { - // child0.OnFlexibleHeightChange (func () { - // element.redoAll() - // element.core.DamageAll() - // }) - // } // add child element.children = append (element.children, layouts.LayoutEntry { @@ -211,6 +205,16 @@ func (element *DocumentContainer) NotifyMinimumSizeChange (child elements.Elemen element.core.DamageAll() } +// NotifyFlexibleHeightChange notifies the parent that the parameters +// affecting a child's flexible height have changed. This method is +// expected to be called by flexible child element when their content +// changes. +func (element *DocumentContainer) NotifyFlexibleHeightChange (child elements.Flexible) { + element.redoAll() + element.core.DamageAll() +} + + // SetTheme sets the element's theme. func (element *DocumentContainer) SetTheme (new theme.Theme) { if new == element.theme.Theme { return }