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) {
let mut tb = TableBuilder::new(ui);
let entries_per_line: usize = ctx.screen_rect().width() as usize / 256;
for _ in 0..entries_per_line {
tb = tb.column(Column::remainder());
}
let tb = TableBuilder::new(ui)
.column(Column::remainder())
.column(Column::remainder())
.column(Column::remainder())
.column(Column::remainder())
.column(Column::remainder())
.column(Column::remainder())
.column(Column::remainder())
.column(Column::remainder());
tb.body(|mut body| {
for line in self.entries().chunks(entries_per_line) {
body.row(240.0, |mut row| {
for line in self.entries().chunks(8) {
body.row(30.0, |mut row| {
for e in line {
row.col(|ui| {
ui.add(ShowBox::new(e));

View file

@ -18,25 +18,17 @@ impl ShowBox {
}
impl egui::Widget for ShowBox {
fn ui(mut self, ui: &mut egui::Ui) -> egui::Response {
egui::Frame::none()
.fill(Color32::GRAY)
.show(ui, |ui| {
ui.label("Label with red background");
fn ui(self, ui: &mut egui::Ui) -> egui::Response {
ui.vertical_centered(|ui| {
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),
.rounding(5.0),
);
ui.button("i dont get it").union(ui.label("caption"))
})
})
.response
}
}