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

Method SetIcon

gui/imagelabel.go:68–81  ·  view source on GitHub ↗

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

(icon string)

Source from the content-addressed store, hash-verified

66// SetIcon sets the image label icon from the default Icon font.
67// If there is currently a selected image, it is removed
68func (il *ImageLabel) SetIcon(icon string) {
69
70 if il.image != nil {
71 il.Panel.Remove(il.image)
72 il.image = nil
73 }
74 if il.icon == nil {
75 il.icon = NewIcon(icon)
76 il.icon.SetFontSize(StyleDefault().Label.PointSize * 1.4)
77 il.Panel.Add(il.icon)
78 }
79 il.icon.SetText(icon)
80 il.recalc()
81}
82
83// SetImageVisible sets the image visibility
84func (il *ImageLabel) SetImageVisible(vis bool) {

Callers 2

CopyFieldsMethod · 0.95
buildImageLabelFunction · 0.95

Calls 7

recalcMethod · 0.95
NewIconFunction · 0.85
StyleDefaultFunction · 0.85
RemoveMethod · 0.45
SetFontSizeMethod · 0.45
AddMethod · 0.45
SetTextMethod · 0.45

Tested by

no test coverage detected