Removed references to flexible from containers

This commit is contained in:
Sasha Koshka 2023-03-11 00:48:15 -05:00
parent 51084a6cfe
commit 1be769526d
2 changed files with 0 additions and 44 deletions

View File

@ -20,12 +20,10 @@ type Container struct {
layout layouts.Layout
children []layouts.LayoutEntry
warping bool
flexible bool
config config.Wrapped
theme theme.Wrapped
onFlexibleHeightChange func ()
onFocusRequest func () (granted bool)
onFocusMotionRequest func (input.KeynavDirection) (granted bool)
}
@ -70,9 +68,6 @@ func (element *Container) Adopt (child elements.Element, expand bool) {
element.redoAll()
element.core.DamageAll()
})
if child0, ok := child.(elements.Flexible); ok {
child0.OnFlexibleHeightChange(element.notifyFlexibleChange)
}
if child0, ok := child.(elements.Focusable); ok {
child0.OnFocusRequest (func () (granted bool) {
return element.childFocusRequestCallback(child0)
@ -153,9 +148,6 @@ func (element *Container) clearChildEventHandlers (child elements.Element) {
child0.HandleUnfocus()
}
}
if child0, ok := child.(elements.Flexible); ok {
child0.OnFlexibleHeightChange(nil)
}
}
// DisownAll removes all child elements from the container at once.
@ -251,18 +243,6 @@ func (element *Container) SetConfig (new config.Config) {
element.redoAll()
}
func (element *Container) FlexibleHeightFor (width int) (height int) {
margin := element.theme.Margin(theme.PatternBackground)
padding := element.theme.Padding(theme.PatternBackground)
return element.layout.FlexibleHeightFor (
element.children,
margin, padding, width)
}
func (element *Container) OnFlexibleHeightChange (callback func ()) {
element.onFlexibleHeightChange = callback
}
func (element *Container) OnFocusRequest (callback func () (granted bool)) {
element.onFocusRequest = callback
element.Propagator.OnFocusRequest(callback)
@ -275,15 +255,6 @@ func (element *Container) OnFocusMotionRequest (
element.Propagator.OnFocusMotionRequest(callback)
}
func (element *Container) forFlexible (callback func (child elements.Flexible) bool) {
for _, entry := range element.children {
child, flexible := entry.Element.(elements.Flexible)
if flexible {
if !callback(child) { break }
}
}
}
func (element *Container) reflectChildProperties () {
focusable := false
for _, entry := range element.children {
@ -296,12 +267,6 @@ func (element *Container) reflectChildProperties () {
if !focusable && element.Focused() {
element.Propagator.HandleUnfocus()
}
element.flexible = false
element.forFlexible (func (elements.Flexible) bool {
element.flexible = true
return false
})
}
func (element *Container) childFocusRequestCallback (
@ -326,12 +291,6 @@ func (element *Container) updateMinimumSize () {
element.core.SetMinimumSize(width, height)
}
func (element *Container) notifyFlexibleChange () {
if element.onFlexibleHeightChange != nil {
element.onFlexibleHeightChange()
}
}
func (element *Container) doLayout () {
margin := element.theme.Margin(theme.PatternBackground)
padding := element.theme.Padding(theme.PatternBackground)

View File

@ -131,9 +131,6 @@ func (element *ScrollContainer) clearChildEventHandlers (child elements.Scrollab
child0.HandleUnfocus()
}
}
if child0, ok := child.(elements.Flexible); ok {
child0.OnFlexibleHeightChange(nil)
}
}
// SetTheme sets the element's theme.