Struct egui::placer::Placer

source ·
pub(crate) struct Placer {
    grid: Option<GridLayout>,
    layout: Layout,
    region: Region,
}

Fields§

§grid: Option<GridLayout>

If set this will take precedence over crate::layout.

§layout: Layout§region: Region

Implementations§

source§

impl Placer

source

pub(crate) fn new(max_rect: Rect, layout: Layout) -> Self

source

pub(crate) fn set_grid(&mut self, grid: GridLayout)

source

pub(crate) fn save_grid(&mut self)

source

pub(crate) fn grid(&self) -> Option<&GridLayout>

source

pub(crate) fn is_grid(&self) -> bool

source

pub(crate) fn layout(&self) -> &Layout

source

pub(crate) fn prefer_right_to_left(&self) -> bool

source

pub(crate) fn min_rect(&self) -> Rect

source

pub(crate) fn max_rect(&self) -> Rect

source

pub(crate) fn force_set_min_rect(&mut self, min_rect: Rect)

source

pub(crate) fn cursor(&self) -> Rect

source

pub(crate) fn set_cursor(&mut self, cursor: Rect)

source§

impl Placer

source

pub(crate) fn align_size_within_rect(&self, size: Vec2, outer: Rect) -> Rect

source

pub(crate) fn available_rect_before_wrap(&self) -> Rect

source

pub(crate) fn available_size(&self) -> Vec2

Amount of space available for a widget. For wrapping layouts, this is the maximum (after wrap).

source

pub(crate) fn next_space(&self, child_size: Vec2, item_spacing: Vec2) -> Rect

Returns where to put the next widget that is of the given size. The returned frame_rect will always be justified along the cross axis. This is what you then pass to advance_after_rects. Use justify_and_align to get the inner widget_rect.

source

pub(crate) fn next_widget_position(&self) -> Pos2

Where do we expect a zero-sized widget to be placed?

source

pub(crate) fn justify_and_align(&self, rect: Rect, child_size: Vec2) -> Rect

Apply justify or alignment after calling next_space.

source

pub(crate) fn advance_cursor(&mut self, amount: f32)

Advance the cursor by this many points. Self::min_rect will expand to contain the cursor.

source

pub(crate) fn advance_after_rects( &mut self, frame_rect: Rect, widget_rect: Rect, item_spacing: Vec2, )

Advance cursor after a widget was added to a specific rectangle and expand the region min_rect.

  • frame_rect: the frame inside which a widget was e.g. centered
  • widget_rect: the actual rect used by the widget
source

pub(crate) fn end_row(&mut self, item_spacing: Vec2, painter: &Painter)

Move to the next row in a grid layout or wrapping layout. Otherwise does nothing.

source

pub(crate) fn set_row_height(&mut self, height: f32)

Set row height in horizontal wrapping layout.

source§

impl Placer

source

pub(crate) fn expand_to_include_rect(&mut self, rect: Rect)

Expand the min_rect and max_rect of this ui to include a child at the given rect.

source

pub(crate) fn expand_to_include_x(&mut self, x: f32)

Expand the min_rect and max_rect of this ui to include a child at the given x-coordinate.

source

pub(crate) fn expand_to_include_y(&mut self, y: f32)

Expand the min_rect and max_rect of this ui to include a child at the given y-coordinate.

source

fn next_widget_space_ignore_wrap_justify(&self, size: Vec2) -> Rect

source

pub(crate) fn set_max_width(&mut self, width: f32)

Set the maximum width of the ui. You won’t be able to shrink it below the current minimum size.

source

pub(crate) fn set_max_height(&mut self, height: f32)

Set the maximum height of the ui. You won’t be able to shrink it below the current minimum size.

source

pub(crate) fn set_min_width(&mut self, width: f32)

Set the minimum width of the ui. This can’t shrink the ui, only make it larger.

source

pub(crate) fn set_min_height(&mut self, height: f32)

Set the minimum height of the ui. This can’t shrink the ui, only make it larger.

source§

impl Placer

source

pub(crate) fn debug_paint_cursor(&self, painter: &Painter, text: impl ToString)

Auto Trait Implementations§

§

impl Freeze for Placer

§

impl !RefUnwindSafe for Placer

§

impl Send for Placer

§

impl Sync for Placer

§

impl Unpin for Placer

§

impl !UnwindSafe for Placer

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