Skip to main content

MacroDefinedLayout

Trait MacroDefinedLayout 

Source
pub trait MacroDefinedLayout {
    // Required methods
    fn rect(&self) -> Rect;
    fn size_rules(&mut self, cx: &mut SizeCx<'_>, axis: AxisInfo) -> SizeRules;
    fn set_rect(&mut self, cx: &mut SizeCx<'_>, rect: Rect, hints: AlignHints);
    fn draw(&self, draw: DrawCx<'_>);
}
Expand description

Macro-defined layout

This trait is a copy of Layout, implemented by the #[layout] macro. In some cases it is useful to invoke kas::MacroDefinedLayout::set_rect (or other method) from the corresponding Layout method to perform some other action before using the default implementation.

[#[layout]]: kas::layout

Required Methods§

Source

fn rect(&self) -> Rect

Get the widget’s region

Source

fn size_rules(&mut self, cx: &mut SizeCx<'_>, axis: AxisInfo) -> SizeRules

Get size rules for the given axis

Source

fn set_rect(&mut self, cx: &mut SizeCx<'_>, rect: Rect, hints: AlignHints)

Set size and position

Source

fn draw(&self, draw: DrawCx<'_>)

Draw a widget and its children

Implementors§