demo: add expandable top panel to panels-in-window demo

This commit is contained in:
Emil Ernerfeldt 2021-08-27 20:08:01 +02:00
parent 52193c2273
commit 7c67066190

View file

@ -20,25 +20,17 @@ impl super::Demo for WindowWithPanels {
impl super::View for WindowWithPanels { impl super::View for WindowWithPanels {
fn ui(&mut self, ui: &mut egui::Ui) { fn ui(&mut self, ui: &mut egui::Ui) {
egui::TopBottomPanel::top("top_panel") // Note that the order we add the panels is very important!
.resizable(false)
.min_height(0.0)
.show_inside(ui, |ui| {
egui::menu::bar(ui, |ui| {
egui::menu::menu(ui, "Menu", |ui| {
if ui.button("Option 1").clicked() {}
if ui.button("Option 2").clicked() {}
if ui.button("Option 3").clicked() {}
});
});
});
egui::TopBottomPanel::bottom("bottom_panel_A") egui::TopBottomPanel::top("top_panel")
.resizable(false) .resizable(true)
.min_height(0.0) .min_height(32.0)
.show_inside(ui, |ui| { .show_inside(ui, |ui| {
ui.vertical_centered(|ui| { egui::ScrollArea::auto_sized().show(ui, |ui| {
ui.heading("Outer Bottom Panel"); ui.vertical_centered(|ui| {
ui.heading("Expandable Upper Panel");
});
ui.add(egui::Label::new(crate::LOREM_IPSUM_LONG).small().weak());
}); });
}); });
@ -68,12 +60,12 @@ impl super::View for WindowWithPanels {
}); });
}); });
egui::TopBottomPanel::bottom("bottom_panel_B") egui::TopBottomPanel::bottom("bottom_panel")
.resizable(false) .resizable(false)
.min_height(0.0) .min_height(0.0)
.show_inside(ui, |ui| { .show_inside(ui, |ui| {
ui.vertical_centered(|ui| { ui.vertical_centered(|ui| {
ui.heading("Inner Bottom Panel"); ui.heading("Bottom Panel");
}); });
}); });