From 60aac053fb19f4c196a0ede069c6b548e0dedd84 Mon Sep 17 00:00:00 2001 From: Sasha Koshka Date: Tue, 21 Mar 2023 12:26:06 -0400 Subject: [PATCH] Add ability to change an icon's icon --- elements/basic/icon.go | 10 ++++++++++ theme/assets/wintergreen-icons-small.png | Bin 1882 -> 1915 bytes 2 files changed, 10 insertions(+) diff --git a/elements/basic/icon.go b/elements/basic/icon.go index 3b6750f..a6894fb 100644 --- a/elements/basic/icon.go +++ b/elements/basic/icon.go @@ -24,6 +24,16 @@ func NewIcon (id theme.Icon, size theme.IconSize) (element *Icon) { return } +func (element *Icon) SetIcon (id theme.Icon, size theme.IconSize) { + element.id = id + element.size = size + element.updateMinimumSize() + if element.core.HasImage() { + element.draw() + element.core.DamageAll() + } +} + // SetTheme sets the element's theme. func (element *Icon) SetTheme (new theme.Theme) { if new == element.theme.Theme { return } diff --git a/theme/assets/wintergreen-icons-small.png b/theme/assets/wintergreen-icons-small.png index 9ddeec0f1eae7931580a96fc491000e91103cce4..10cdcee734f6c6ea66a36edd1ec081ba2f8fedd4 100644 GIT binary patch delta 1856 zcmV-G2fz5*4*L#}Hh(ZlL_t(|+U?qLXdBlZ2k<+DxsH$?qaC4?Ax!@W{crgzgs>cA zl;Hm3Ka4OGf+?otk1<9W#eaB4?;^4j1ge-;4Ivwn;+jJ;jnY3tl4{jE)pgA*8Yea8 z(t7sYRaGQgbxyLX++B31xA&xaP+M7rMH|?jguz16$KUsR?|;d9KZ$7tTS3&vg>eNZ z26(^%0spW783=HIcZJ15kAM>^m0(FOLg{8QK9CL8QA$pwT_NW52-KIgX8a`#gfi3V z##OG4a1NXx_GOR2gR?PD9+V6y-b`M71HMy4umMdBT<#IL^XHh8PQ(WwlbOEy%B)yK ziDPk+;C7Ed%zu%MbV4p>uYZ`l`U*T>L?1Nf5C%^42r$gFm`X^-$IslDjt`_0#rY53 zOwCpKQ-A3ZP<$zNc2F*U6#g)oZoudrC()Qew!dd!X)elM!!@|^n;Uo*U_x-hD2`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