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§
Sourcefn draw(&mut self, parent: &mut dyn CellAccessor)
fn draw(&mut self, parent: &mut dyn CellAccessor)
Draws the widget to the valid CellAccessor
passed
Sourcefn pack(
&mut self,
parent: &dyn HasSize,
halign: HorizontalAlign,
valign: VerticalAlign,
margin: (usize, usize),
)
fn pack( &mut self, parent: &dyn HasSize, halign: HorizontalAlign, valign: VerticalAlign, margin: (usize, usize), )
Aligns the widget with the parent
as reference