xmpd/src/ui/gui/windows/error.rs
2024-09-22 00:42:50 +03:00

33 lines
800 B
Rust

use egui::{Color32, Label, RichText};
use super::{State, Window};
#[derive(Debug, Default)]
pub struct GuiError {
text: String,
}
impl Window for GuiError {
fn ui(&mut self, _: &mut State, ctx: &egui::Context, open: &mut bool) -> anyhow::Result<()> {
egui::Window::new("ERROR!!!! D:")
.open(open)
.show(ctx, |ui| {
ui.vertical(|ui| {
ui.label(RichText::new("Error:").size(30.0).color(Color32::RED));
ui.horizontal(|ui| {
ui.add(Label::new(self.text.clone()).wrap(true));
})
})
});
Ok(())
}
}
impl GuiError {
pub fn set_error_message<S: ToString>(&mut self, text: S) {
self.text = text.to_string();
}
}