SetIcon sets the button icon from the default Icon font. If there is currently a selected image, it is removed
(icode string)
| 79 | // SetIcon sets the button icon from the default Icon font. |
| 80 | // If there is currently a selected image, it is removed |
| 81 | func (b *Button) SetIcon(icode string) { |
| 82 | |
| 83 | ico := NewIcon(icode) |
| 84 | if b.image != nil { |
| 85 | b.Panel.Remove(b.image) |
| 86 | b.image = nil |
| 87 | } |
| 88 | if b.icon != nil { |
| 89 | b.Panel.Remove(b.icon) |
| 90 | } |
| 91 | b.icon = ico |
| 92 | b.icon.SetFontSize(b.Label.FontSize() * 1.4) |
| 93 | b.Panel.Add(b.icon) |
| 94 | |
| 95 | b.recalc() |
| 96 | b.update() |
| 97 | } |
| 98 | |
| 99 | // SetImage sets the button left image from the specified filename |
| 100 | // If there is currently a selected icon, it is removed |
no test coverage detected