Struct egui::containers::Resize

source ·
pub struct Resize {
    id: Option<Id>,
    id_salt: Option<Id>,
    resizable: Vec2b,
    pub(crate) min_size: Vec2,
    pub(crate) max_size: Vec2,
    default_size: Vec2,
    with_stroke: bool,
}
Expand description

A region that can be resized by dragging the bottom right corner.

Fields§

§id: Option<Id>§id_salt: Option<Id>§resizable: Vec2b

If false, we are no enabled

§min_size: Vec2§max_size: Vec2§default_size: Vec2§with_stroke: bool

Implementations§

source§

impl Resize

source

pub fn id(self, id: Id) -> Self

Assign an explicit and globally unique id.

source

pub fn id_source(self, id_salt: impl Hash) -> Self

👎Deprecated: Renamed id_salt

A source for the unique Id, e.g. .id_source("second_resize_area") or .id_source(loop_index).

source

pub fn id_salt(self, id_salt: impl Hash) -> Self

A source for the unique Id, e.g. .id_salt("second_resize_area") or .id_salt(loop_index).

source

pub fn default_width(self, width: f32) -> Self

Preferred / suggested width. Actual width will depend on contents.

Examples:

  • if the contents is text, this will decide where we break long lines.
  • if the contents is a canvas, this decides the width of it,
  • if the contents is some buttons, this is ignored and we will auto-size.
source

pub fn default_height(self, height: f32) -> Self

Preferred / suggested height. Actual height will depend on contents.

Examples:

  • if the contents is a crate::ScrollArea then this decides the maximum size.
  • if the contents is a canvas, this decides the height of it,
  • if the contents is text and buttons, then the default_height is ignored and the height is picked automatically..
source

pub fn default_size(self, default_size: impl Into<Vec2>) -> Self

source

pub fn min_size(self, min_size: impl Into<Vec2>) -> Self

Won’t shrink to smaller than this

source

pub fn min_width(self, min_width: f32) -> Self

Won’t shrink to smaller than this

source

pub fn min_height(self, min_height: f32) -> Self

Won’t shrink to smaller than this

source

pub fn max_size(self, max_size: impl Into<Vec2>) -> Self

Won’t expand to larger than this

source

pub fn max_width(self, max_width: f32) -> Self

Won’t expand to larger than this

source

pub fn max_height(self, max_height: f32) -> Self

Won’t expand to larger than this

source

pub fn resizable(self, resizable: impl Into<Vec2b>) -> Self

Can you resize it with the mouse?

Note that a window can still auto-resize.

Default is true.

source

pub fn is_resizable(&self) -> Vec2b

source

pub fn auto_sized(self) -> Self

Not manually resizable, just takes the size of its contents. Text will not wrap, but will instead make your window width expand.

source

pub fn fixed_size(self, size: impl Into<Vec2>) -> Self

source

pub fn with_stroke(self, with_stroke: bool) -> Self

source§

impl Resize

source

fn begin(&self, ui: &mut Ui) -> Prepared

source

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

source

fn end(self, ui: &mut Ui, prepared: Prepared)

Trait Implementations§

source§

impl Clone for Resize

source§

fn clone(&self) -> Resize

Returns a copy 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 Resize

source§

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

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

impl Default for Resize

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl Copy for Resize

Auto Trait Implementations§

§

impl Freeze for Resize

§

impl RefUnwindSafe for Resize

§

impl Send for Resize

§

impl Sync for Resize

§

impl Unpin for Resize

§

impl UnwindSafe for Resize

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, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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> 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.
source§

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