Fixed style application

This commit is contained in:
Sasha Koshka 2024-06-12 00:39:00 -04:00
parent 02de78c997
commit 6619987b5a
3 changed files with 19 additions and 15 deletions

View File

@ -479,6 +479,7 @@ func (this *box) setParent (parent parent) {
this.SetFocused(false) this.SetFocused(false)
} }
this.parent = parent this.parent = parent
this.recursiveReApply()
} }
func (this *box) getParent () parent { func (this *box) getParent () parent {
@ -527,6 +528,8 @@ func (this *box) invalidateMinimum () {
} }
func (this *box) recursiveReApply () { func (this *box) recursiveReApply () {
if this.getHierarchy() == nil { return }
// re-apply styling, icons *if needed* // re-apply styling, icons *if needed*
// style // style

View File

@ -13,10 +13,6 @@ type Hierarchy struct {
system *System system *System
canvas canvas.Canvas canvas canvas.Canvas
style tomo.Style
styleNonce int
iconsNonce int
root anyBox root anyBox
focused anyBox focused anyBox
hovered anyBox hovered anyBox
@ -146,14 +142,11 @@ func (this *Hierarchy) Close () {
this.system.removeHierarchy(this) this.system.removeHierarchy(this)
} }
func (this *Hierarchy) setStyle (style tomo.Style) { func (this *Hierarchy) setStyle () {
this.style = style
this.styleNonce ++
if this.root != nil { this.root.recursiveReApply() } if this.root != nil { this.root.recursiveReApply() }
} }
func (this *Hierarchy) setIcons (icons tomo.Icons) { func (this *Hierarchy) setIcons () {
this.iconsNonce ++
if this.root != nil { this.root.recursiveReApply() } if this.root != nil { this.root.recursiveReApply() }
} }