Skip to main content

TheLayout

Trait TheLayout 

Source
pub trait TheLayout: Send {
Show 32 methods // Required methods fn new(id: TheId) -> Self where Self: Sized; fn id(&self) -> &TheId; fn dim(&self) -> &TheDim; fn dim_mut(&mut self) -> &mut TheDim; fn limiter(&self) -> &TheSizeLimiter; fn limiter_mut(&mut self) -> &mut TheSizeLimiter; fn get_widget( &mut self, name: Option<&String>, uuid: Option<&Uuid>, ) -> Option<&mut Box<dyn TheWidget>>; fn get_widget_at_coord( &mut self, coord: Vec2<i32>, ) -> Option<&mut Box<dyn TheWidget>>; fn widgets(&mut self) -> &mut Vec<Box<dyn TheWidget>>; fn draw( &mut self, buffer: &mut TheRGBABuffer, style: &mut Box<dyn TheStyle>, ctx: &mut TheContext, ); // Provided methods fn set_dim(&mut self, dim: TheDim, ctx: &mut TheContext) { ... } fn set_margin(&mut self, margin: Vec4<i32>) { ... } fn set_padding(&mut self, padding: i32) { ... } fn set_background_color(&mut self, color: Option<TheThemeColors>) { ... } fn needs_redraw(&mut self) -> bool { ... } fn supports_mouse_wheel(&self) -> bool { ... } fn mouse_wheel_scroll(&mut self, coord: Vec2<i32>) { ... } fn relayout(&mut self, ctx: &mut TheContext) { ... } fn get_layout( &mut self, name: Option<&String>, uuid: Option<&Uuid>, ) -> Option<&mut Box<dyn TheLayout>> { ... } fn get_layout_at_coord(&mut self, coord: Vec2<i32>) -> Option<TheId> { ... } fn redirected_widget_value( &mut self, widget_id: &TheId, value: &TheValue, ctx: &mut TheContext, ) { ... } fn as_stack_layout(&mut self) -> Option<&mut dyn TheStackLayoutTrait> { ... } fn as_list_layout(&mut self) -> Option<&mut dyn TheListLayoutTrait> { ... } fn as_rowlist_layout(&mut self) -> Option<&mut dyn TheRowListLayoutTrait> { ... } fn as_rgba_layout(&mut self) -> Option<&mut dyn TheRGBALayoutTrait> { ... } fn as_tab_layout(&mut self) -> Option<&mut dyn TheTabLayoutTrait> { ... } fn as_sharedhlayout(&mut self) -> Option<&mut dyn TheSharedHLayoutTrait> { ... } fn as_sharedvlayout(&mut self) -> Option<&mut dyn TheSharedVLayoutTrait> { ... } fn as_hlayout(&mut self) -> Option<&mut dyn TheHLayoutTrait> { ... } fn as_vlayout(&mut self) -> Option<&mut dyn TheVLayoutTrait> { ... } fn as_text_layout(&mut self) -> Option<&mut dyn TheTextLayoutTrait> { ... } fn as_tree_layout(&mut self) -> Option<&mut dyn TheTreeLayoutTrait> { ... }
}
Expand description

TheLayout trait defines an abstract layout interface for widgets.

Required Methods§

Source

fn new(id: TheId) -> Self
where Self: Sized,

Source

fn id(&self) -> &TheId

Returns the id of the layout.

Source

fn dim(&self) -> &TheDim

Returns a reference to the dimensions of the widget.

Source

fn dim_mut(&mut self) -> &mut TheDim

Returns a mutable reference to the dimensions of the widget.

Source

fn limiter(&self) -> &TheSizeLimiter

Returns a reference to the size limiter of the widget.

Source

fn limiter_mut(&mut self) -> &mut TheSizeLimiter

Returns a mutable reference to the limiter of the widget.

Source

fn get_widget( &mut self, name: Option<&String>, uuid: Option<&Uuid>, ) -> Option<&mut Box<dyn TheWidget>>

Source

fn get_widget_at_coord( &mut self, coord: Vec2<i32>, ) -> Option<&mut Box<dyn TheWidget>>

Source

fn widgets(&mut self) -> &mut Vec<Box<dyn TheWidget>>

Source

fn draw( &mut self, buffer: &mut TheRGBABuffer, style: &mut Box<dyn TheStyle>, ctx: &mut TheContext, )

Draw the widget in the given style

Provided Methods§

Source

fn set_dim(&mut self, dim: TheDim, ctx: &mut TheContext)

Set the dimensions of the widget

Source

fn set_margin(&mut self, margin: Vec4<i32>)

Sets the margin for content in the layout

Source

fn set_padding(&mut self, padding: i32)

Set the padding for content in the layout

Source

fn set_background_color(&mut self, color: Option<TheThemeColors>)

Set the background color for the layout

Source

fn needs_redraw(&mut self) -> bool

If this function returns true it indicates that the layout needs a redraw.

Source

fn supports_mouse_wheel(&self) -> bool

This layouts supports mouse wheel events (TheListLayout etc)

Source

fn mouse_wheel_scroll(&mut self, coord: Vec2<i32>)

And if yes, process them here.

Source

fn relayout(&mut self, ctx: &mut TheContext)

Relayouts the layout.

Source

fn get_layout( &mut self, name: Option<&String>, uuid: Option<&Uuid>, ) -> Option<&mut Box<dyn TheLayout>>

Source

fn get_layout_at_coord(&mut self, coord: Vec2<i32>) -> Option<TheId>

Source

fn redirected_widget_value( &mut self, widget_id: &TheId, value: &TheValue, ctx: &mut TheContext, )

Source

fn as_stack_layout(&mut self) -> Option<&mut dyn TheStackLayoutTrait>

Attempts to cast to TheStackLayoutTrait. Only valid for TheStackLayout.

Source

fn as_list_layout(&mut self) -> Option<&mut dyn TheListLayoutTrait>

Attempts to cast to TheListLayoutTrait. Only valid for TheListLayout.

Source

fn as_rowlist_layout(&mut self) -> Option<&mut dyn TheRowListLayoutTrait>

Attempts to cast to TheRowListLayoutTrait. Only valid for TheRowListLayout.

Source

fn as_rgba_layout(&mut self) -> Option<&mut dyn TheRGBALayoutTrait>

Attempts to cast to TheRGBALayoutTrait. Only valid for TheRGBALayout.

Source

fn as_tab_layout(&mut self) -> Option<&mut dyn TheTabLayoutTrait>

Attempts to cast to TheTabLayoutTrait. Only valid for TheTabLayout.

Source

fn as_sharedhlayout(&mut self) -> Option<&mut dyn TheSharedHLayoutTrait>

Attempts to cast to TheSharedHLayoutTrait. Only valid for TheSharedHLayout.

Source

fn as_sharedvlayout(&mut self) -> Option<&mut dyn TheSharedVLayoutTrait>

Attempts to cast to TheSharedVLayoutTrait. Only valid for TheSharedVLayout.

Source

fn as_hlayout(&mut self) -> Option<&mut dyn TheHLayoutTrait>

Attempts to cast to TheHLayoutTrait. Only valid for TheHLayout.

Source

fn as_vlayout(&mut self) -> Option<&mut dyn TheVLayoutTrait>

Attempts to cast to TheVLayoutTrait. Only valid for TheVLayout.

Source

fn as_text_layout(&mut self) -> Option<&mut dyn TheTextLayoutTrait>

Attempts to cast to TheTextLayout. Only valid for TheTextLayout.

Source

fn as_tree_layout(&mut self) -> Option<&mut dyn TheTreeLayoutTrait>

Attempts to cast to TheTreeLayout. Only valid for TheTreeLayout.

Implementors§