MacroDefinedLayout

Trait MacroDefinedLayout 

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

Macro-defined layout

This trait is a copy of Layout, implemented by the [#[layout]] attribute.

This trait may prove useful to modify the layout code generated by [#[layout]] with additional code. For examples, see the RadioButton and SpinBox widgets.

[#[layout]]: kas::layout

Required Methods§

Source

fn rect(&self) -> Rect

Get the widget’s region

Source

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

Get size rules for the given axis

Source

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

Set size and position

Source

fn try_probe(&self, coord: Coord) -> Option<Id>

Probe a coordinate for a widget’s Id

Source

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

Draw a widget and its children

Implementors§