MCPcopy
hub / github.com/g3n/engine / SetIcon

Method SetIcon

gui/menu.go:578–591  ·  view source on GitHub ↗

SetIcon sets the left icon of this menu item If an image was previously set it is replaced by this icon

(icon string)

Source from the content-addressed store, hash-verified

576// SetIcon sets the left icon of this menu item
577// If an image was previously set it is replaced by this icon
578func (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

Callers

nothing calls this directly

Calls 5

updateMethod · 0.95
NewIconFunction · 0.85
DisposeMethod · 0.65
RemoveMethod · 0.45
AddMethod · 0.45

Tested by

no test coverage detected