pub struct Aligned { /* private fields */ }Expand description
Align some widgets of unknown size within the available space of a Ui.
For instance, this can put a group of widgets in the bottom-right corner of the parent Ui.
egui is an immediate mode GUI, so the size of the contents is not known until they have been added.
This container remembers the size from the previous pass, and uses that to place the contents.
On the first pass (when no size is known yet) the contents are added invisibly,
and a new pass is requested with crate::Context::request_discard, so there is no visible flicker.
Like a crate::Panel, this reserves space in the parent Ui along its main axis,
so you can e.g. put something at the bottom of a vertical Ui and keep adding widgets above it:
egui::Aligned::new(egui::Align2::RIGHT_BOTTOM).show(ui, |ui| {
let _ = ui.button("Bottom right");
});
ui.label("This goes at the top, in the space left above the button");More precisely: if the contents are aligned to the end of the parent’s main axis
(e.g. Align::Max in a top-down Ui), the cursor is moved so that widgets added afterwards
end up before the contents. Otherwise the cursor advances past the contents, as usual.
egui::Aligned::new(egui::Align2::RIGHT_BOTTOM).show(ui, |ui| {
ui.label("Bottom right");
let _ = ui.button("Click me");
});Implementations§
Trait Implementations§
Auto Trait Implementations§
impl Forget for Aligned
impl Freeze for Aligned
impl Move for Aligned
impl RefUnwindSafe for Aligned
impl Send for Aligned
impl Sync for Aligned
impl Unpin for Aligned
impl UnsafeUnpin for Aligned
impl UnwindSafe for Aligned
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more