Compare commits

..

2 Commits

Author SHA1 Message Date
73a5fab0bc Icon sets its minimum size properly 2024-08-11 12:20:23 -04:00
61addc051b Button sets an icon tag 2024-08-11 12:20:12 -04:00
2 changed files with 4 additions and 0 deletions

View File

@ -69,6 +69,7 @@ func (this *Button) SetIcon (id tomo.Icon) {
if this.icon != nil {
this.Insert(this.icon, this.label)
}
this.SetTag("icon", this.icon != nil)
this.applyLayout()
}

View File

@ -27,6 +27,9 @@ func NewIcon (icon tomo.Icon, size tomo.IconSize) *Icon {
// SetIcon sets the icon.
func (this *Icon) SetIcon (icon tomo.Icon, size tomo.IconSize) {
iconTexture := icon.Texture(size)
bounds := iconTexture.Bounds()
this.SetAttr(tomo.AIcon(icon, size))
this.SetAttr(tomo.AMinimumSize(bounds.Dx(), bounds.Dy()))
this.SetTag(iconSizeString(size), true)
}