[][src]Trait kas::Layout

pub trait Layout: WidgetCore {
    fn size_rules(
        &mut self,
        size_handle: &mut dyn SizeHandle,
        axis: AxisInfo
    ) -> SizeRules;
fn draw(&self, draw_handle: &mut dyn DrawHandle, mgr: &Manager); fn set_rect(&mut self, _size_handle: &mut dyn SizeHandle, rect: Rect) { ... } }

Positioning and drawing routines for widgets

These methods are often implemented via a derive trait, hence live in their own trait. (This may be revised in the future.)

Required methods

fn size_rules(
    &mut self,
    size_handle: &mut dyn SizeHandle,
    axis: AxisInfo
) -> SizeRules

Get size rules for the given axis.

This method takes &mut self to allow local caching of child widget configuration for future size_rules and set_rect calls.

If operating on one axis and the other is fixed, then the other parameter is used for the fixed dimension. Additionally, one may assume that size_rules has previously been called on the fixed axis with the current widget configuration.

fn draw(&self, draw_handle: &mut dyn DrawHandle, mgr: &Manager)

Draw a widget

This method is called to draw each visible widget (and should not attempt recursion on child widgets).

Loading content...

Provided methods

fn set_rect(&mut self, _size_handle: &mut dyn SizeHandle, rect: Rect)

Adjust to the given size.

For many widgets this operation is trivial and the default implementation will suffice. For layout widgets (those with children), this operation is more complex.

One may assume that size_rules has been called for each axis with the current widget configuration.

Loading content...

Implementations on Foreign Types

impl<M> Layout for Box<dyn Handler<Msg = M>>[src]

Loading content...

Implementors

impl Layout for Label[src]

impl Layout for MessageBox[src]

impl<D: Direction> Layout for ScrollBar<D>[src]

impl<D: Direction, W: Widget> Layout for List<D, W>[src]

impl<H: 'static> Layout for EditBox<H>[src]

impl<M: Clone + Debug> Layout for TextButton<M>[src]

impl<OT: 'static> Layout for CheckBox<OT>[src]

impl<W: Widget + 'static> Layout for Window<W>[src]

impl<W: Widget> Layout for ScrollRegion<W>[src]

Loading content...