Compare commits
2 Commits
7e275cc70e
...
73a5fab0bc
Author | SHA1 | Date | |
---|---|---|---|
73a5fab0bc | |||
61addc051b |
@ -69,6 +69,7 @@ func (this *Button) SetIcon (id tomo.Icon) {
|
|||||||
if this.icon != nil {
|
if this.icon != nil {
|
||||||
this.Insert(this.icon, this.label)
|
this.Insert(this.icon, this.label)
|
||||||
}
|
}
|
||||||
|
this.SetTag("icon", this.icon != nil)
|
||||||
this.applyLayout()
|
this.applyLayout()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
3
icon.go
3
icon.go
@ -27,6 +27,9 @@ func NewIcon (icon tomo.Icon, size tomo.IconSize) *Icon {
|
|||||||
|
|
||||||
// SetIcon sets the icon.
|
// SetIcon sets the icon.
|
||||||
func (this *Icon) SetIcon (icon tomo.Icon, size tomo.IconSize) {
|
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.AIcon(icon, size))
|
||||||
|
this.SetAttr(tomo.AMinimumSize(bounds.Dx(), bounds.Dy()))
|
||||||
this.SetTag(iconSizeString(size), true)
|
this.SetTag(iconSizeString(size), true)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user