Window now checks for minimum size on adopt

This commit is contained in:
Sasha Koshka 2023-04-15 01:19:39 -04:00
parent 437aef0c27
commit a43f5ce595
3 changed files with 3 additions and 10 deletions

View File

@ -153,6 +153,9 @@ func (window *window) Adopt (child tomo.Element) {
if ok && childEntity != nil { if ok && childEntity != nil {
window.child = childEntity window.child = childEntity
childEntity.setWindow(window) childEntity.setWindow(window)
window.setMinimumSize (
childEntity.minWidth,
childEntity.minHeight)
window.resizeChildToFit() window.resizeChildToFit()
} }
} }

View File

@ -65,7 +65,6 @@ func (element *Checkbox) Enabled () bool {
func (element *Checkbox) SetEnabled (enabled bool) { func (element *Checkbox) SetEnabled (enabled bool) {
if element.enabled == enabled { return } if element.enabled == enabled { return }
element.enabled = enabled element.enabled = enabled
if element.entity == nil { return }
element.entity.Invalidate() element.entity.Invalidate()
} }
@ -150,7 +149,6 @@ func (element *Checkbox) HandleMouseUp (x, y int, button input.Button) {
} }
func (element *Checkbox) HandleKeyDown (key input.Key, modifiers input.Modifiers) { func (element *Checkbox) HandleKeyDown (key input.Key, modifiers input.Modifiers) {
if element.entity == nil { return }
if key == input.KeyEnter { if key == input.KeyEnter {
element.pressed = true element.pressed = true
element.entity.Invalidate() element.entity.Invalidate()

View File

@ -51,7 +51,6 @@ func (element *Label) Entity () tomo.Entity {
func (element *Label) EmCollapse (columns int, rows int) { func (element *Label) EmCollapse (columns int, rows int) {
element.forcedColumns = columns element.forcedColumns = columns
element.forcedRows = rows element.forcedRows = rows
if element.entity == nil { return }
element.updateMinimumSize() element.updateMinimumSize()
} }