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

Method SetIcon

gui/tabbar.go:473–492  ·  view source on GitHub ↗

SetIcon sets the optional icon of the Tab header

(icon string)

Source from the content-addressed store, hash-verified

471
472// SetIcon sets the optional icon of the Tab header
473func (tab *Tab) SetIcon(icon string) *Tab {
474
475 // Remove previous header image if any
476 if tab.image != nil {
477 tab.header.Remove(tab.image)
478 tab.image.Dispose()
479 tab.image = nil
480 }
481 // Creates or updates icon
482 if tab.icon == nil {
483 tab.icon = NewIcon(icon)
484 tab.icon.SetPaddingsFrom(&tab.styles.IconPaddings)
485 tab.header.Add(tab.icon)
486 } else {
487 tab.icon.SetText(icon)
488 }
489 // Needs to recalculate all Tabs because this Tab width will change
490 tab.tb.recalc()
491 return tab
492}
493
494// SetImage sets the optional image of the Tab header
495func (tab *Tab) SetImage(imgfile string) error {

Callers 3

newWindowTitleFunction · 0.45
buildMenuFunction · 0.45
buildTabBarFunction · 0.45

Calls 7

NewIconFunction · 0.85
SetPaddingsFromMethod · 0.80
DisposeMethod · 0.65
RemoveMethod · 0.45
AddMethod · 0.45
SetTextMethod · 0.45
recalcMethod · 0.45

Tested by

no test coverage detected