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

Method SetIcon

gui/button.go:81–97  ·  view source on GitHub ↗

SetIcon sets the button icon from the default Icon font. If there is currently a selected image, it is removed

(icode string)

Source from the content-addressed store, hash-verified

79// SetIcon sets the button icon from the default Icon font.
80// If there is currently a selected image, it is removed
81func (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

Callers 1

buildButtonFunction · 0.95

Calls 7

recalcMethod · 0.95
updateMethod · 0.95
NewIconFunction · 0.85
FontSizeMethod · 0.80
RemoveMethod · 0.45
SetFontSizeMethod · 0.45
AddMethod · 0.45

Tested by

no test coverage detected