generated from PlexSheep/rs-base
39 lines
1 KiB
Rust
39 lines
1 KiB
Rust
use egui::{Color32, ImageSource};
|
|
|
|
use super::{Entry, ICON_RAW};
|
|
|
|
pub struct ShowBox {
|
|
entry: Entry,
|
|
frame: egui::Frame,
|
|
}
|
|
|
|
impl ShowBox {
|
|
pub fn new(entry: &Entry) -> Self {
|
|
let frame = egui::Frame::none();
|
|
Self {
|
|
entry: entry.to_owned(),
|
|
frame,
|
|
}
|
|
}
|
|
}
|
|
|
|
impl egui::Widget for ShowBox {
|
|
fn ui(self, ui: &mut egui::Ui) -> egui::Response {
|
|
egui::Frame::none()
|
|
// .fill(Color32::DARK_GRAY)
|
|
.show(ui, |ui| {
|
|
ui.label("Label with red background");
|
|
ui.vertical_centered(|ui| {
|
|
ui.add(
|
|
egui::Image::new(self.entry.img())
|
|
.rounding(5.0)
|
|
.bg_fill(Color32::DARK_GRAY)
|
|
.shrink_to_fit()
|
|
.maintain_aspect_ratio(true),
|
|
);
|
|
ui.button("i dont get it").union(ui.label("caption"))
|
|
})
|
|
})
|
|
.response
|
|
}
|
|
}
|