pub struct DialogLayout { /* private fields */ }Expand description
A dialog’s content laid out footer first: the footer (its buttons, a status line) always gets its whole height, at the bottom of the room, and the body takes what is left above it, scrolled when it needs more.
(Compiled, not run: a frame needs the kit’s fonts and textures.)
use egui_pop_core::overlay::DialogLayout;
let layout = DialogLayout::new(ui, "my.dialog").fill(true);
layout.body(ui, |ui, _height| {
ui.label("a long body");
});
layout.footer(ui, |ui| {
let _ = ui.button("OK");
});The footer’s height is the one it was last drawn at (a first estimate: a row of buttons); a change asks for another pass.
Implementations§
Source§impl DialogLayout
impl DialogLayout
Sourcepub fn new(ui: &Ui, id_salt: impl Hash + Debug) -> Self
pub fn new(ui: &Ui, id_salt: impl Hash + Debug) -> Self
The layout of the content of ui, from where its cursor is, in the
height it has left; id_salt tells its footer’s measure apart.
Sourcepub fn fill(self, fill: bool) -> Self
pub fn fill(self, fill: bool) -> Self
Whether the body fills the room, the footer at its bottom (a dialog of a set size); else the body is as tall as its content, up to the room, and the footer follows it.
Sourcepub fn max_height(self, height: f32) -> Self
pub fn max_height(self, height: f32) -> Self
At most this height for the body and the footer together (a dialog sized by its content, held to the window).
Sourcepub fn body_height(&self, ui: &Ui) -> f32
pub fn body_height(&self, ui: &Ui) -> f32
The height the body has before it scrolls: the room, less the footer. The footer’s measure holds the space after it, as much as the body keeps before it: the footer ends on the room’s bottom.
Sourcepub fn body<R>(&self, ui: &mut Ui, add: impl FnOnce(&mut Ui, f32) -> R) -> R
pub fn body<R>(&self, ui: &mut Ui, add: impl FnOnce(&mut Ui, f32) -> R) -> R
Draws the body, add given the height it has before it scrolls
(the scroll area’s own Ui has no end below).
Draws the footer, after the body (at the room’s bottom when the body fills it), and keeps its height for the next pass.
Trait Implementations§
Source§impl Clone for DialogLayout
impl Clone for DialogLayout
Source§fn clone(&self) -> DialogLayout
fn clone(&self) -> DialogLayout
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for DialogLayout
impl Debug for DialogLayout
impl Copy for DialogLayout
Auto Trait Implementations§
impl Freeze for DialogLayout
impl RefUnwindSafe for DialogLayout
impl Send for DialogLayout
impl Sync for DialogLayout
impl Unpin for DialogLayout
impl UnsafeUnpin for DialogLayout
impl UnwindSafe for DialogLayout
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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