Label text update methods

This commit is contained in:
mars 2022-11-06 19:00:56 -07:00
parent 1e43b0a2c4
commit 4a091bd206
2 changed files with 14 additions and 0 deletions

View File

@ -48,6 +48,12 @@ impl RoundButton {
icon,
}
}
pub fn set_text(&mut self, text: &str) {
if let Some(icon) = self.icon.as_mut() {
icon.set_text(text);
}
}
}
impl Button for RoundButton {

View File

@ -128,6 +128,14 @@ impl Icon {
offset: Vec2::ZERO,
}
}
pub fn set_text(&mut self, text: &str) {
if self.text.text != text {
self.text.text = text.to_string();
self.layout = None;
self.dirty = true;
}
}
}
impl Widget for Icon {