[][src]Struct egui::Layout

pub struct Layout { /* fields omitted */ }

The layout of a Ui, e.g. horizontal left-aligned.

Implementations

impl Layout[src]

pub fn from_dir_align(dir: Direction, align: Option<Align>) -> Self[src]

None align means justified, e.g. fill full width/height.

pub fn vertical(align: Align) -> Self[src]

pub fn horizontal(align: Align) -> Self[src]

pub fn justified(dir: Direction) -> Self[src]

Full-width layout. Nice for menues etc where each button is full width.

#[must_use]pub fn reverse(self) -> Self[src]

#[must_use]pub fn with_reversed(self, reversed: bool) -> Self[src]

pub fn dir(self) -> Direction[src]

pub fn align(self) -> Option<Align>[src]

pub fn is_reversed(self) -> bool[src]

pub fn initial_cursor(self, max_rect: Rect) -> Pos2[src]

pub fn available(self, cursor: Pos2, max_rect: Rect) -> Rect[src]

Given the cursor in the region, how much space is available for the next widget?

pub fn advance_cursor(self, cursor: &mut Pos2, amount: f32)[src]

Advance the cursor by this many points.

pub fn rect_from_cursor_size(self, cursor: Pos2, size: Vec2) -> Rect[src]

pub fn allocate_space(
    self,
    cursor: &mut Pos2,
    style: &Style,
    available_size: Vec2,
    child_size: Vec2
) -> Rect
[src]

Reserve this much space and move the cursor. Returns where to put the widget.

How sizes are negotiated

Each widget should have a minimum desired size and a desired size. When asking for space, ask AT LEAST for you minimum, and don't ask for more than you need. If you want to fill the space, ask about available().size() and use that.

You may get MORE space than you asked for, for instance for Justified aligned layouts, like in menus.

You may get LESS space than you asked for if the current layout won't fit what you asked for.

impl Layout[src]

pub fn debug_paint_cursor(&self, cursor: Pos2, painter: &Painter)[src]

Shows where the next widget is going to be placed

Trait Implementations

impl Clone for Layout[src]

impl Copy for Layout[src]

impl Debug for Layout[src]

impl Default for Layout[src]

impl PartialEq<Layout> for Layout[src]

impl StructuralPartialEq for Layout[src]

Auto Trait Implementations

impl RefUnwindSafe for Layout

impl Send for Layout

impl Sync for Layout

impl Unpin for Layout

impl UnwindSafe for Layout

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.