SetImage sets the button left image from the specified filename If there is currently a selected icon, it is removed
(state ButtonState, imgfile string)
| 133 | // SetImage sets the button left image from the specified filename |
| 134 | // If there is currently a selected icon, it is removed |
| 135 | func (b *ImageButton) SetImage(state ButtonState, imgfile string) error { |
| 136 | |
| 137 | tex, err := texture.NewTexture2DFromImage(imgfile) |
| 138 | if err != nil { |
| 139 | return err |
| 140 | } |
| 141 | |
| 142 | if b.stateImages[state] != nil { |
| 143 | b.stateImages[state].Dispose() |
| 144 | } |
| 145 | b.stateImages[state] = tex |
| 146 | b.update() |
| 147 | |
| 148 | return nil |
| 149 | } |
| 150 | |
| 151 | // Dispose releases resources used by this widget |
| 152 | func (b *ImageButton) Dispose() { |
nothing calls this directly
no test coverage detected