pub struct SidePanel { /* private fields */ }
Expand description
A panel that covers the entire left or right side of a Ui
or screen.
The order in which you add panels matter! The first panel you add will always be the outermost, and the last you add will always be the innermost.
⚠ Always add any CentralPanel
last.
See the module level docs for more details.
egui::SidePanel::left("my_left_panel").show(ctx, |ui| {
ui.label("Hello World!");
});
See also TopBottomPanel
.
Implementations
sourceimpl SidePanel
impl SidePanel
sourcepub fn new(side: Side, id_source: impl Hash) -> Self
pub fn new(side: Side, id_source: impl Hash) -> Self
id_source
: Something unique, e.g. "my_panel"
.
sourcepub fn resizable(self, resizable: bool) -> Self
pub fn resizable(self, resizable: bool) -> Self
Can panel be resized by dragging the edge of it?
Default is true
.
If you want your panel to be resizable you also need a widget in it that takes up more space as you resize it, such as:
- Wrapping text (
Ui::horizontal_wrapped
). - A
ScrollArea
. - A
Separator
. - A
TextEdit
. - …
sourcepub fn default_width(self, default_width: f32) -> Self
pub fn default_width(self, default_width: f32) -> Self
The initial wrapping width of the SidePanel
.
pub fn min_width(self, min_width: f32) -> Self
pub fn max_width(self, max_width: f32) -> Self
sourcepub fn width_range(self, width_range: RangeInclusive<f32>) -> Self
pub fn width_range(self, width_range: RangeInclusive<f32>) -> Self
The allowable width range for resizable panels.
sourceimpl SidePanel
impl SidePanel
sourcepub fn show_inside<R>(
self,
ui: &mut Ui,
add_contents: impl FnOnce(&mut Ui) -> R
) -> InnerResponse<R>
pub fn show_inside<R>(
self,
ui: &mut Ui,
add_contents: impl FnOnce(&mut Ui) -> R
) -> InnerResponse<R>
Show the panel inside a Ui
.
Auto Trait Implementations
impl RefUnwindSafe for SidePanel
impl Send for SidePanel
impl Sync for SidePanel
impl Unpin for SidePanel
impl UnwindSafe for SidePanel
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more