Trait kas::layout::AutoLayout

source ·
pub trait AutoLayout {
    // Required methods
    fn size_rules(&mut self, size_mgr: SizeMgr<'_>, axis: AxisInfo) -> SizeRules;
    fn set_rect(&mut self, mgr: &mut ConfigMgr<'_>, rect: Rect);
    fn find_id(&mut self, coord: Coord) -> Option<WidgetId>;
    fn draw(&mut self, draw: DrawMgr<'_>);
}
Expand description

Implementation generated by use of layout = .. property of #[widget]

This trait need not be implemented by the user, however it may be useful to adjust the result of an automatic implementation, for example:

use kas::prelude::*;

impl_scope! {
    #[derive(Debug)]
    #[widget {
        layout = "Example";
    }]
    struct Example {
        core: widget_core!(),
    }
    impl Layout for Self {
        fn size_rules(&mut self, size_mgr: SizeMgr, axis: AxisInfo) -> SizeRules {
            let mut rules = kas::layout::AutoLayout::size_rules(self, size_mgr, axis);
            rules.set_stretch(Stretch::High);
            rules
        }
    }
}

It is not recommended to import this trait since method names conflict with Layout.

Required Methods§

source

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

Get size rules for the given axis

This functions identically to Layout::size_rules.

source

fn set_rect(&mut self, mgr: &mut ConfigMgr<'_>, rect: Rect)

Set size and position

This functions identically to Layout::set_rect.

source

fn find_id(&mut self, coord: Coord) -> Option<WidgetId>

Translate a coordinate to a WidgetId

This functions identically to Layout::find_id.

source

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

Draw a widget and its children

This functions identically to Layout::draw.

Implementors§

source§

impl AutoLayout for MenuToggle

source§

impl AutoLayout for CheckButton

source§

impl AutoLayout for RadioButton

source§

impl AutoLayout for TextButton

source§

impl<D> AutoLayout for SubMenu<D>where D: Directional,

source§

impl<D, W> AutoLayout for List<D, W>where D: Directional, W: Widget,

source§

impl<M> AutoLayout for MenuEntry<M>where M: Clone + Debug + 'static,

source§

impl<M> AutoLayout for ComboBox<M>where M: Clone + Debug + 'static,

source§

impl<T> AutoLayout for MessageBox<T>where T: FormattableText + 'static,

source§

impl<T> AutoLayout for TextEdit<T>where T: SingleDataMut<Item = String>,

source§

impl<T> AutoLayout for Spinner<T>where T: SpinnerValue,

source§

impl<T, V> AutoLayout for SingleView<T, V>where T: SingleData, V: Driver<<T as SharedData>::Item, T>,

source§

impl<W> AutoLayout for Window<W>where W: Widget,

source§

impl<W> AutoLayout for Button<W>where W: Widget,

source§

impl<W> AutoLayout for Frame<W>where W: Widget,

source§

impl<W> AutoLayout for NavFrame<W>where W: Widget,

source§

impl<W> AutoLayout for PopupFrame<W>where W: Widget,

source§

impl<W> AutoLayout for TabStack<W>where W: Widget,

source§

impl<W, D> AutoLayout for WithLabel<W, D>where W: Widget, D: Directional,

source§

impl<W, M, N, F> AutoLayout for MapMessage<W, M, N, F>where W: Widget, M: Debug + 'static, N: Debug + 'static, F: FnMut(M) -> N + 'static,