diff --git a/elements/basic/container.go b/elements/basic/container.go index 7770ba8..47ff7ed 100644 --- a/elements/basic/container.go +++ b/elements/basic/container.go @@ -324,7 +324,7 @@ func (element *Container) HandleSelection (direction tomo.SelectionDirection) (o } func (element *Container) FlexibleHeightFor (width int) (height int) { - return element.layout.MinimumHeightFor(element.children, width) + return element.layout.FlexibleHeightFor(element.children, width) } func (element *Container) OnFlexibleHeightChange (callback func ()) { @@ -431,7 +431,7 @@ func (element *Container) childSelectionRequestCallback ( func (element *Container) updateMinimumSize () { width, height := element.layout.MinimumSize(element.children) if element.flexible { - height = element.layout.MinimumHeightFor(element.children, width) + height = element.layout.FlexibleHeightFor(element.children, width) } element.core.SetMinimumSize(width, height) } diff --git a/layout.go b/layout.go index 4482d2e..8ca1f8c 100644 --- a/layout.go +++ b/layout.go @@ -23,8 +23,8 @@ type Layout interface { // needs to properly arrange the given slice of layout entries. MinimumSize (entries []LayoutEntry) (width, height int) - // MinimumHeightFor Returns the minimum height the layout needs to lay + // FlexibleHeightFor Returns the minimum height the layout needs to lay // out the specified elements at the given width, taking into account // flexible elements. - MinimumHeightFor (entries []LayoutEntry, squeeze int) (height int) + FlexibleHeightFor (entries []LayoutEntry, squeeze int) (height int) } diff --git a/layouts/dialog.go b/layouts/dialog.go index f662129..347f5b7 100644 --- a/layouts/dialog.go +++ b/layouts/dialog.go @@ -134,7 +134,9 @@ func (layout Dialog) MinimumSize ( return } -func (layout Dialog) MinimumHeightFor ( +// FlexibleHeightFor Returns the minimum height the layout needs to lay out the +// specified elements at the given width, taking into account flexible elements. +func (layout Dialog) FlexibleHeightFor ( entries []tomo.LayoutEntry, width int, ) ( @@ -147,7 +149,7 @@ func (layout Dialog) MinimumHeightFor ( if len(entries) > 0 { mainChildHeight := 0 if child, flexible := entries[0].Element.(tomo.Flexible); flexible { - mainChildHeight = child.MinimumHeightFor(width) + mainChildHeight = child.FlexibleHeightFor(width) } else { _, mainChildHeight = entries[0].MinimumSize() } diff --git a/layouts/horizontal.go b/layouts/horizontal.go index 8207087..fcda8ff 100644 --- a/layouts/horizontal.go +++ b/layouts/horizontal.go @@ -75,7 +75,9 @@ func (layout Horizontal) MinimumSize ( return } -func (layout Horizontal) MinimumHeightFor ( +// FlexibleHeightFor Returns the minimum height the layout needs to lay out the +// specified elements at the given width, taking into account flexible elements. +func (layout Horizontal) FlexibleHeightFor ( entries []tomo.LayoutEntry, width int, ) ( @@ -100,7 +102,7 @@ func (layout Horizontal) MinimumHeightFor ( entryWidth = expandingElementWidth } if child, flexible := entry.Element.(tomo.Flexible); flexible { - entryHeight = child.MinimumHeightFor(entryWidth) + entryHeight = child.FlexibleHeightFor(entryWidth) } if entryHeight > height { height = entryHeight } diff --git a/layouts/vertical.go b/layouts/vertical.go index e3f4a50..48a473c 100644 --- a/layouts/vertical.go +++ b/layouts/vertical.go @@ -32,7 +32,7 @@ func (layout Vertical) Arrange (entries []tomo.LayoutEntry, width, height int) { var entryMinHeight int if child, flexible := entry.Element.(tomo.Flexible); flexible { - entryMinHeight = child.MinimumHeightFor(width) + entryMinHeight = child.FlexibleHeightFor(width) } else { _, entryMinHeight = entry.MinimumSize() } @@ -102,9 +102,9 @@ func (layout Vertical) MinimumSize ( return } -// MinimumHeightFor Returns the minimum height the layout needs to lay out the +// FlexibleHeightFor Returns the minimum height the layout needs to lay out the // specified elements at the given width, taking into account flexible elements. -func (layout Vertical) MinimumHeightFor ( +func (layout Vertical) FlexibleHeightFor ( entries []tomo.LayoutEntry, width int, ) ( @@ -118,7 +118,7 @@ func (layout Vertical) MinimumHeightFor ( for index, entry := range entries { child, flexible := entry.Element.(tomo.Flexible) if flexible { - height += child.MinimumHeightFor(width) + height += child.FlexibleHeightFor(width) } else { _, entryHeight := entry.MinimumSize() height += entryHeight