Skip to main content

DialogLayout

Struct DialogLayout 

Source
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

Source

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.

Source

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.

Source

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).

Source

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.

Source

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).

Source

pub fn footer<R>(self, ui: &mut Ui, add: impl FnOnce(&mut Ui) -> R) -> R

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

Source§

fn clone(&self) -> DialogLayout

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for DialogLayout

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Copy for DialogLayout

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

§

fn simd_from(_simd: S, value: T) -> T

§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

§

fn simd_into(self, simd: S) -> T

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

§

impl<T> SerializableAny for T
where T: 'static + Any + Clone + for<'a> Send + Sync,