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

Method SetImage

gui/button.go:101–114  ·  view source on GitHub ↗

SetImage sets the button left image from the specified filename If there is currently a selected icon, it is removed

(imgfile string)

Source from the content-addressed store, hash-verified

99// SetImage sets the button left image from the specified filename
100// If there is currently a selected icon, it is removed
101func (b *Button) SetImage(imgfile string) error {
102
103 img, err := NewImage(imgfile)
104 if err != nil {
105 return err
106 }
107 if b.image != nil {
108 b.Panel.Remove(b.image)
109 }
110 b.image = img
111 b.Panel.Add(b.image)
112 b.recalc()
113 return nil
114}
115
116// SetStyles set the button styles overriding the default style
117func (b *Button) SetStyles(bs *ButtonStyles) {

Callers 1

buildButtonFunction · 0.95

Calls 4

recalcMethod · 0.95
NewImageFunction · 0.85
RemoveMethod · 0.45
AddMethod · 0.45

Tested by

no test coverage detected