Trait Widget

Source
pub trait Widget {
    // Required methods
    fn draw(&mut self, parent: &mut dyn CellAccessor);
    fn pack(
        &mut self,
        parent: &dyn HasSize,
        halign: HorizontalAlign,
        valign: VerticalAlign,
        margin: (usize, usize),
    );
    fn draw_box(&mut self);
    fn resize(&mut self, new_size: Size);
    fn frame(&self) -> &Frame;
    fn frame_mut(&mut self) -> &mut Frame;
}
Expand description

Widgets are the foundation of UI, all frontend objects inherit the widget type and are generalized through either the widget itself or a specialized widget (e.g. Button, Layout).

Required Methods§

Source

fn draw(&mut self, parent: &mut dyn CellAccessor)

Draws the widget to the valid CellAccessor passed

Source

fn pack( &mut self, parent: &dyn HasSize, halign: HorizontalAlign, valign: VerticalAlign, margin: (usize, usize), )

Aligns the widget with the parent as reference

Source

fn draw_box(&mut self)

Expose the painter trait draw_box for all widgets, which outlines the space enclosed within the widget

Source

fn resize(&mut self, new_size: Size)

Resize the given widget to new dimensions given by Size

Source

fn frame(&self) -> &Frame

Return a reference the renderer, Base in general cases

Source

fn frame_mut(&mut self) -> &mut Frame

Return a mutable reference to the renderer, Base in general cases

Implementors§