Compare commits

..

No commits in common. "29b6c10fd11a5fdf88a66ca0c43d58a64c6c0dcf" and "c5447f58f1c178159e89c79b13f79ee420c5cb44" have entirely different histories.

2 changed files with 22 additions and 28 deletions

View file

@ -101,17 +101,19 @@ impl Player {
} }
fn main_panel(&mut self, ui: &mut egui::Ui, ctx: &egui::Context) { fn main_panel(&mut self, ui: &mut egui::Ui, ctx: &egui::Context) {
let mut tb = TableBuilder::new(ui); let tb = TableBuilder::new(ui)
.column(Column::remainder())
let entries_per_line: usize = ctx.screen_rect().width() as usize / 256; .column(Column::remainder())
.column(Column::remainder())
for _ in 0..entries_per_line { .column(Column::remainder())
tb = tb.column(Column::remainder()); .column(Column::remainder())
} .column(Column::remainder())
.column(Column::remainder())
.column(Column::remainder());
tb.body(|mut body| { tb.body(|mut body| {
for line in self.entries().chunks(entries_per_line) { for line in self.entries().chunks(8) {
body.row(240.0, |mut row| { body.row(30.0, |mut row| {
for e in line { for e in line {
row.col(|ui| { row.col(|ui| {
ui.add(ShowBox::new(e)); ui.add(ShowBox::new(e));

View file

@ -18,25 +18,17 @@ impl ShowBox {
} }
impl egui::Widget for ShowBox { impl egui::Widget for ShowBox {
fn ui(mut self, ui: &mut egui::Ui) -> egui::Response { fn ui(self, ui: &mut egui::Ui) -> egui::Response {
egui::Frame::none() ui.vertical_centered(|ui| {
.fill(Color32::GRAY) ui.add(
.show(ui, |ui| { egui::Image::new(ImageSource::Bytes {
ui.label("Label with red background"); uri: std::borrow::Cow::Borrowed("fuck you"),
ui.vertical_centered(|ui| { bytes: egui::load::Bytes::Static(ICON_RAW),
ui.add(
egui::Image::new(ImageSource::Bytes {
uri: std::borrow::Cow::Borrowed("fuck you"),
bytes: egui::load::Bytes::Static(ICON_RAW),
})
.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"))
}) })
}) .rounding(5.0),
.response );
ui.button("i dont get it").union(ui.label("caption"))
})
.response
} }
} }