SetIcon sets the left icon of this menu item If an image was previously set it is replaced by this icon
(icon string)
| 576 | // SetIcon sets the left icon of this menu item |
| 577 | // If an image was previously set it is replaced by this icon |
| 578 | func (mi *MenuItem) SetIcon(icon string) *MenuItem { |
| 579 | |
| 580 | // Remove and dispose previous icon |
| 581 | if mi.licon != nil { |
| 582 | mi.Panel.Remove(mi.licon) |
| 583 | mi.Dispose() |
| 584 | mi.licon = nil |
| 585 | } |
| 586 | // Sets the new icon |
| 587 | mi.licon = NewIcon(icon) |
| 588 | mi.Panel.Add(mi.licon) |
| 589 | mi.update() |
| 590 | return mi |
| 591 | } |
| 592 | |
| 593 | // SetImage sets the left image of this menu item |
| 594 | // If an icon was previously set it is replaced by this image |