mirror of
https://github.com/emilk/egui.git
synced 2026-09-02 06:40:06 -04:00
Add Panel to replace SidePanel and TopBottomPanel (#5659)
This combines `SidePanel` and `TopBottomPanel` into a single `Panel`. The old types are still there as type aliases, but are deprecated. `.min_width(…)` etc are now called `.min_size(…)` etc. Again, the old names are still there, but deprecated. (edited by @emilk) --------- Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
This commit is contained in:
committed by
GitHub
parent
178f3c9198
commit
5b6a0196f9
@@ -236,7 +236,7 @@ impl DemoWindows {
|
||||
}
|
||||
|
||||
fn mobile_top_bar(&mut self, ctx: &Context) {
|
||||
egui::TopBottomPanel::top("menu_bar").show(ctx, |ui| {
|
||||
egui::Panel::top("menu_bar").show(ctx, |ui| {
|
||||
menu::MenuBar::new()
|
||||
.config(menu::MenuConfig::new().style(StyleModifier::default()))
|
||||
.ui(ui, |ui| {
|
||||
@@ -262,10 +262,10 @@ impl DemoWindows {
|
||||
}
|
||||
|
||||
fn desktop_ui(&mut self, ctx: &Context) {
|
||||
egui::SidePanel::right("egui_demo_panel")
|
||||
egui::Panel::right("egui_demo_panel")
|
||||
.resizable(false)
|
||||
.default_width(160.0)
|
||||
.min_width(160.0)
|
||||
.default_size(160.0)
|
||||
.min_size(160.0)
|
||||
.show(ctx, |ui| {
|
||||
ui.add_space(4.0);
|
||||
ui.vertical_centered(|ui| {
|
||||
@@ -289,7 +289,7 @@ impl DemoWindows {
|
||||
self.demo_list_ui(ui);
|
||||
});
|
||||
|
||||
egui::TopBottomPanel::top("menu_bar").show(ctx, |ui| {
|
||||
egui::Panel::top("menu_bar").show(ctx, |ui| {
|
||||
menu::MenuBar::new().ui(ui, |ui| {
|
||||
file_menu_button(ui);
|
||||
});
|
||||
|
||||
@@ -22,9 +22,9 @@ impl crate::View for Panels {
|
||||
fn ui(&mut self, ui: &mut egui::Ui) {
|
||||
// Note that the order we add the panels is very important!
|
||||
|
||||
egui::TopBottomPanel::top("top_panel")
|
||||
egui::Panel::top("top_panel")
|
||||
.resizable(true)
|
||||
.min_height(32.0)
|
||||
.min_size(32.0)
|
||||
.show_inside(ui, |ui| {
|
||||
egui::ScrollArea::vertical().show(ui, |ui| {
|
||||
ui.vertical_centered(|ui| {
|
||||
@@ -34,10 +34,10 @@ impl crate::View for Panels {
|
||||
});
|
||||
});
|
||||
|
||||
egui::SidePanel::left("left_panel")
|
||||
egui::Panel::left("left_panel")
|
||||
.resizable(true)
|
||||
.default_width(150.0)
|
||||
.width_range(80.0..=200.0)
|
||||
.default_size(150.0)
|
||||
.size_range(80.0..=200.0)
|
||||
.show_inside(ui, |ui| {
|
||||
ui.vertical_centered(|ui| {
|
||||
ui.heading("Left Panel");
|
||||
@@ -47,10 +47,10 @@ impl crate::View for Panels {
|
||||
});
|
||||
});
|
||||
|
||||
egui::SidePanel::right("right_panel")
|
||||
egui::Panel::right("right_panel")
|
||||
.resizable(true)
|
||||
.default_width(150.0)
|
||||
.width_range(80.0..=200.0)
|
||||
.default_size(150.0)
|
||||
.size_range(80.0..=200.0)
|
||||
.show_inside(ui, |ui| {
|
||||
ui.vertical_centered(|ui| {
|
||||
ui.heading("Right Panel");
|
||||
@@ -60,9 +60,9 @@ impl crate::View for Panels {
|
||||
});
|
||||
});
|
||||
|
||||
egui::TopBottomPanel::bottom("bottom_panel")
|
||||
egui::Panel::bottom("bottom_panel")
|
||||
.resizable(false)
|
||||
.min_height(0.0)
|
||||
.min_size(0.0)
|
||||
.show_inside(ui, |ui| {
|
||||
ui.vertical_centered(|ui| {
|
||||
ui.heading("Bottom Panel");
|
||||
|
||||
@@ -35,7 +35,7 @@ impl crate::View for Tooltips {
|
||||
ui.add(crate::egui_github_link_file_line!());
|
||||
});
|
||||
|
||||
egui::SidePanel::right("scroll_test").show_inside(ui, |ui| {
|
||||
egui::Panel::right("scroll_test").show_inside(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.",
|
||||
|
||||
@@ -33,7 +33,7 @@ impl Default for EasyMarkEditor {
|
||||
|
||||
impl EasyMarkEditor {
|
||||
pub fn panels(&mut self, ctx: &egui::Context) {
|
||||
egui::TopBottomPanel::bottom("easy_mark_bottom").show(ctx, |ui| {
|
||||
egui::Panel::bottom("easy_mark_bottom").show(ctx, |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!())
|
||||
|
||||
Reference in New Issue
Block a user