update updates the button visual state
()
| 178 | |
| 179 | // update updates the button visual state |
| 180 | func (b *Button) update() { |
| 181 | |
| 182 | if !b.Enabled() { |
| 183 | b.applyStyle(&b.styles.Disabled) |
| 184 | return |
| 185 | } |
| 186 | if b.pressed && b.mouseOver { |
| 187 | b.applyStyle(&b.styles.Pressed) |
| 188 | return |
| 189 | } |
| 190 | if b.mouseOver { |
| 191 | b.applyStyle(&b.styles.Over) |
| 192 | return |
| 193 | } |
| 194 | b.applyStyle(&b.styles.Normal) |
| 195 | } |
| 196 | |
| 197 | // applyStyle applies the specified button style |
| 198 | func (b *Button) applyStyle(bs *ButtonStyle) { |