From 49f010a8d6ac16f665460d2e5e82e3cddfdbc260 Mon Sep 17 00:00:00 2001 From: Sasha Koshka Date: Mon, 6 May 2024 23:23:59 -0400 Subject: [PATCH] Button.SetIcon now takes in theme.Icon --- button.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/button.go b/button.go index 7f1b2e2..5163f77 100644 --- a/button.go +++ b/button.go @@ -46,10 +46,14 @@ func (this *Button) SetText (text string) { this.label.SetText(text) } -// SetIcon sets an icon for this button. -// TODO: use tomo.Icon instead, use small size icons -func (this *Button) SetIcon (icon *Icon) { +// SetIcon sets an icon for this button. Setting the icon to IconUnknown will +// remove it. +func (this *Button) SetIcon (id theme.Icon) { if this.icon != nil { this.Delete(this.icon) } + + var icon *Icon; if id != theme.IconUnknown { + icon = NewIcon(id, theme.IconSizeSmall) + } this.icon = icon if this.icon == nil {