1
0
mirror of https://github.com/emilk/egui.git synced 2026-09-02 06:40:06 -04:00

Remove some uses of top-level panels in our examples (#7729)

We're phasing out top-level panels (panels that use `Context` directly,
instead of being inside another `Ui`).
As a first step, stop using them in our demo library and application.

* Part of https://github.com/emilk/egui/issues/3524
This commit is contained in:
Emil Ernerfeldt
2025-11-21 20:22:01 +01:00
committed by GitHub
parent d53a4a9c1d
commit d5869bfeaf
13 changed files with 165 additions and 136 deletions

View File

@@ -976,15 +976,25 @@ pub struct CentralPanel {
}
impl CentralPanel {
/// A central panel with no margin or background color
pub fn no_frame() -> Self {
Self {
frame: Some(Frame::NONE),
}
}
/// A central panel with a background color and some inner margins
pub fn default_margins() -> Self {
Self { frame: None }
}
/// Change the background color, margins, etc.
#[inline]
pub fn frame(mut self, frame: Frame) -> Self {
self.frame = Some(frame);
self
}
}
impl CentralPanel {
/// Show the panel inside a [`Ui`].
pub fn show_inside<R>(
self,