mirror of
https://github.com/emilk/egui.git
synced 2026-08-29 04:40:03 -04:00
Rename Panel methods (#8192)
The three methods for showing a `Panel` are now: * `panel.show`: always show the panel. * `panel.show_collapsible`: show or hide the panel, with a slide animation in between. * `Panel::show_switched`: animate between two different panels: a thin/collapsed one and a thick/expanded one.
This commit is contained in:
@@ -245,7 +245,7 @@ impl DemoWindows {
|
||||
}
|
||||
|
||||
fn mobile_top_bar(&mut self, ui: &mut egui::Ui) {
|
||||
egui::Panel::top("menu_bar").show_inside(ui, |ui| {
|
||||
egui::Panel::top("menu_bar").show(ui, |ui| {
|
||||
menu::MenuBar::new()
|
||||
.config(menu::MenuConfig::new().style(StyleModifier::default()))
|
||||
.ui(ui, |ui| {
|
||||
@@ -275,7 +275,7 @@ impl DemoWindows {
|
||||
.resizable(false)
|
||||
.default_size(160.0)
|
||||
.min_size(160.0)
|
||||
.show_inside(ui, |ui| {
|
||||
.show(ui, |ui| {
|
||||
ui.vertical_centered_justified(|ui| {
|
||||
ui.add_space(4.0);
|
||||
ui.add(
|
||||
@@ -296,7 +296,7 @@ impl DemoWindows {
|
||||
self.demo_list_ui(ui);
|
||||
});
|
||||
|
||||
egui::Panel::top("menu_bar").show_inside(ui, |ui| {
|
||||
egui::Panel::top("menu_bar").show(ui, |ui| {
|
||||
menu::MenuBar::new().ui(ui, |ui| {
|
||||
file_menu_button(ui);
|
||||
});
|
||||
|
||||
@@ -27,7 +27,7 @@ impl crate::Demo for ExtraViewport {
|
||||
// Not a real viewport
|
||||
ui.label("This egui integration does not support multiple viewports");
|
||||
} else {
|
||||
egui::CentralPanel::default().show_inside(ui, |ui| {
|
||||
egui::CentralPanel::default().show(ui, |ui| {
|
||||
viewport_content(ui, open);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ impl crate::View for Panels {
|
||||
egui::Panel::top("top_panel")
|
||||
.resizable(true)
|
||||
.min_size(32.0)
|
||||
.show_animated_inside(ui, top, |ui| {
|
||||
.show_collapsible(ui, top, |ui| {
|
||||
egui::ScrollArea::vertical().show(ui, |ui| {
|
||||
ui.vertical_centered(|ui| {
|
||||
ui.heading("Expandable Upper Panel");
|
||||
@@ -62,7 +62,7 @@ impl crate::View for Panels {
|
||||
.resizable(true)
|
||||
.default_size(150.0)
|
||||
.size_range(80.0..=200.0)
|
||||
.show_animated_inside(ui, left, |ui| {
|
||||
.show_collapsible(ui, left, |ui| {
|
||||
ui.vertical_centered(|ui| {
|
||||
ui.heading("Left Panel");
|
||||
});
|
||||
@@ -75,7 +75,7 @@ impl crate::View for Panels {
|
||||
.resizable(true)
|
||||
.default_size(150.0)
|
||||
.size_range(80.0..=200.0)
|
||||
.show_animated_inside(ui, right, |ui| {
|
||||
.show_collapsible(ui, right, |ui| {
|
||||
ui.vertical_centered(|ui| {
|
||||
ui.heading("Right Panel");
|
||||
});
|
||||
@@ -89,7 +89,7 @@ impl crate::View for Panels {
|
||||
// re-expand. Both panels are `.resizable(true)` so each one's edge accepts
|
||||
// the gesture; the collapsed panel uses `exact_size` so even a tiny
|
||||
// outward drag is enough to trigger the swap.
|
||||
egui::Panel::show_animated_between_inside(
|
||||
egui::Panel::show_switched(
|
||||
ui,
|
||||
bottom,
|
||||
egui::Panel::bottom("bottom_panel_collapsed")
|
||||
@@ -115,7 +115,7 @@ impl crate::View for Panels {
|
||||
);
|
||||
|
||||
// TODO(emilk): This extra panel is superfluous - just use what's left of `ui` instead
|
||||
egui::CentralPanel::default().show_inside(ui, |ui| {
|
||||
egui::CentralPanel::default().show(ui, |ui| {
|
||||
ui.vertical_centered(|ui| {
|
||||
ui.heading("Central Panel");
|
||||
});
|
||||
|
||||
@@ -164,7 +164,7 @@ mod tests {
|
||||
let text = "Hello, world!".to_owned();
|
||||
let mut harness = Harness::new_ui_state(
|
||||
move |ui, text| {
|
||||
CentralPanel::default().show_inside(ui, |ui| {
|
||||
CentralPanel::default().show(ui, |ui| {
|
||||
ui.text_edit_singleline(text);
|
||||
});
|
||||
},
|
||||
|
||||
@@ -36,7 +36,7 @@ impl crate::View for Tooltips {
|
||||
ui.add(crate::egui_github_link_file_line!());
|
||||
});
|
||||
|
||||
egui::Panel::right("scroll_test").show_inside(ui, |ui| {
|
||||
egui::Panel::right("scroll_test").show(ui, |ui| {
|
||||
ui.label(
|
||||
"The scroll area below has many labels with interactive tooltips. \
|
||||
The purpose is to test that the tooltips close when you scroll.",
|
||||
@@ -56,7 +56,7 @@ impl crate::View for Tooltips {
|
||||
});
|
||||
});
|
||||
|
||||
egui::CentralPanel::default().show_inside(ui, |ui| {
|
||||
egui::CentralPanel::default().show(ui, |ui| {
|
||||
self.misc_tests(ui);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -33,14 +33,14 @@ impl Default for EasyMarkEditor {
|
||||
|
||||
impl EasyMarkEditor {
|
||||
pub fn panels(&mut self, ui: &mut egui::Ui) {
|
||||
egui::Panel::bottom("easy_mark_bottom").show_inside(ui, |ui| {
|
||||
egui::Panel::bottom("easy_mark_bottom").show(ui, |ui| {
|
||||
let layout = egui::Layout::top_down(egui::Align::Center).with_main_justify(true);
|
||||
ui.allocate_ui_with_layout(ui.available_size(), layout, |ui| {
|
||||
ui.add(crate::egui_github_link_file!())
|
||||
})
|
||||
});
|
||||
|
||||
egui::CentralPanel::default().show_inside(ui, |ui| {
|
||||
egui::CentralPanel::default().show(ui, |ui| {
|
||||
self.ui(ui);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user