mirror of
https://github.com/emilk/egui.git
synced 2026-09-01 14:20:04 -04:00
Add helper constructors to CentralPanel
This commit is contained in:
@@ -976,15 +976,25 @@ pub struct CentralPanel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl 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.
|
/// Change the background color, margins, etc.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn frame(mut self, frame: Frame) -> Self {
|
pub fn frame(mut self, frame: Frame) -> Self {
|
||||||
self.frame = Some(frame);
|
self.frame = Some(frame);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
impl CentralPanel {
|
|
||||||
/// Show the panel inside a [`Ui`].
|
/// Show the panel inside a [`Ui`].
|
||||||
pub fn show_inside<R>(
|
pub fn show_inside<R>(
|
||||||
self,
|
self,
|
||||||
|
|||||||
Reference in New Issue
Block a user