mirror of
https://github.com/emilk/egui.git
synced 2026-06-26 22:53:14 -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:
@@ -1,8 +1,8 @@
|
||||
//! Snapshot tests for `Panel`'s drag-to-close and drag-to-expand gestures.
|
||||
//!
|
||||
//! Covers:
|
||||
//! * [`Panel::show_animated_inside`] — drag-to-close on a `Left` panel.
|
||||
//! * [`Panel::show_animated_between_inside`] — drag-to-close on the expanded panel
|
||||
//! * [`Panel::show_collapsible`] — drag-to-close on a `Left` panel.
|
||||
//! * [`Panel::show_switched`] — drag-to-close on the expanded panel
|
||||
//! followed by drag-to-expand on the collapsed panel, both via the shared
|
||||
//! resize handle.
|
||||
|
||||
@@ -27,10 +27,10 @@ fn drag_to_close_animated_inside() {
|
||||
.resizable(true)
|
||||
.default_size(120.0)
|
||||
.min_size(60.0)
|
||||
.show_animated_inside(ui, &mut state.is_expanded, |ui| {
|
||||
.show_collapsible(ui, &mut state.is_expanded, |ui| {
|
||||
ui.label("Left panel content");
|
||||
});
|
||||
egui::CentralPanel::default().show_inside(ui, |ui| {
|
||||
egui::CentralPanel::default().show(ui, |ui| {
|
||||
ui.label("Central");
|
||||
});
|
||||
},
|
||||
@@ -83,7 +83,7 @@ fn drag_to_close_and_reopen_animated_between() {
|
||||
let expanded = Panel::bottom("between_expanded")
|
||||
.resizable(true)
|
||||
.default_size(expanded_size);
|
||||
Panel::show_animated_between_inside(
|
||||
Panel::show_switched(
|
||||
ui,
|
||||
&mut state.is_expanded,
|
||||
collapsed,
|
||||
@@ -104,7 +104,7 @@ fn drag_to_close_and_reopen_animated_between() {
|
||||
}
|
||||
},
|
||||
);
|
||||
egui::CentralPanel::default().show_inside(ui, |ui| {
|
||||
egui::CentralPanel::default().show(ui, |ui| {
|
||||
ui.label("Central");
|
||||
});
|
||||
},
|
||||
|
||||
@@ -30,7 +30,7 @@ struct MyTestApp {}
|
||||
|
||||
impl eframe::App for MyTestApp {
|
||||
fn ui(&mut self, ui: &mut egui::Ui, frame: &mut eframe::Frame) {
|
||||
egui::Panel::top("top").show_inside(ui, |ui| {
|
||||
egui::Panel::top("top").show(ui, |ui| {
|
||||
ui.label("This is a test of painting directly with glow.");
|
||||
});
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ fn main() -> eframe::Result {
|
||||
let options = eframe::NativeOptions::default();
|
||||
eframe::run_ui_native("My egui App", options, move |ui, _frame| {
|
||||
// A bottom panel to force the tooltips to consider if the fit below or under the widget:
|
||||
egui::Panel::bottom("bottom").show_inside(ui, |ui| {
|
||||
egui::Panel::bottom("bottom").show(ui, |ui| {
|
||||
ui.horizontal(|ui| {
|
||||
ui.vertical(|ui| {
|
||||
ui.label("Single tooltips:");
|
||||
@@ -33,7 +33,7 @@ fn main() -> eframe::Result {
|
||||
});
|
||||
});
|
||||
|
||||
egui::CentralPanel::default().show_inside(ui, |ui| {
|
||||
egui::CentralPanel::default().show(ui, |ui| {
|
||||
ui.horizontal(|ui| {
|
||||
if ui.button("Reset egui memory").clicked() {
|
||||
ui.memory_mut(|mem| *mem = Default::default());
|
||||
|
||||
@@ -36,7 +36,7 @@ impl eframe::App for MyApp {
|
||||
fn ui(&mut self, ui: &mut egui::Ui, _frame: &mut eframe::Frame) {
|
||||
ui.all_styles_mut(|style| style.interaction.tooltip_delay = 0.0);
|
||||
|
||||
egui::Panel::left("side_panel_left").show_inside(ui, |ui| {
|
||||
egui::Panel::left("side_panel_left").show(ui, |ui| {
|
||||
ui.heading("Information");
|
||||
ui.label(
|
||||
"This is a demo/test environment of the `UiStack` feature. The tables display \
|
||||
@@ -84,7 +84,7 @@ impl eframe::App for MyApp {
|
||||
});
|
||||
});
|
||||
|
||||
egui::Panel::right("side_panel_right").show_inside(ui, |ui| {
|
||||
egui::Panel::right("side_panel_right").show(ui, |ui| {
|
||||
egui::ScrollArea::both().auto_shrink(false).show(ui, |ui| {
|
||||
stack_ui(ui);
|
||||
|
||||
@@ -94,7 +94,7 @@ impl eframe::App for MyApp {
|
||||
});
|
||||
});
|
||||
|
||||
egui::CentralPanel::default().show_inside(ui, |ui| {
|
||||
egui::CentralPanel::default().show(ui, |ui| {
|
||||
egui::ScrollArea::both().auto_shrink(false).show(ui, |ui| {
|
||||
ui.label("stack here:");
|
||||
stack_ui(ui);
|
||||
@@ -174,7 +174,7 @@ impl eframe::App for MyApp {
|
||||
|
||||
egui::Panel::bottom("bottom_panel")
|
||||
.resizable(true)
|
||||
.show_inside(ui, |ui| {
|
||||
.show(ui, |ui| {
|
||||
egui::ScrollArea::vertical()
|
||||
.auto_shrink(false)
|
||||
.show(ui, |ui| {
|
||||
|
||||
@@ -154,7 +154,7 @@ impl Default for App {
|
||||
|
||||
impl eframe::App for App {
|
||||
fn ui(&mut self, ui: &mut egui::Ui, _frame: &mut eframe::Frame) {
|
||||
egui::CentralPanel::default().show_inside(ui, |ui| {
|
||||
egui::CentralPanel::default().show(ui, |ui| {
|
||||
ui.heading("Root viewport");
|
||||
{
|
||||
let mut embed_viewports = ui.embed_viewports();
|
||||
@@ -182,7 +182,7 @@ fn show_as_popup(
|
||||
// Not a real viewport - already has a frame
|
||||
content(ui);
|
||||
} else {
|
||||
egui::CentralPanel::default().show_inside(ui, content);
|
||||
egui::CentralPanel::default().show(ui, content);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user