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§
fn new(id: TheId) -> Selfwhere
Self: Sized,
Sourcefn dim_mut(&mut self) -> &mut TheDim
fn dim_mut(&mut self) -> &mut TheDim
Returns a mutable reference to the dimensions of the widget.
Sourcefn limiter(&self) -> &TheSizeLimiter
fn limiter(&self) -> &TheSizeLimiter
Returns a reference to the size limiter of the widget.
Sourcefn limiter_mut(&mut self) -> &mut TheSizeLimiter
fn limiter_mut(&mut self) -> &mut TheSizeLimiter
Returns a mutable reference to the limiter of the widget.
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>>
Sourcefn draw(
&mut self,
buffer: &mut TheRGBABuffer,
style: &mut Box<dyn TheStyle>,
ctx: &mut TheContext,
)
fn draw( &mut self, buffer: &mut TheRGBABuffer, style: &mut Box<dyn TheStyle>, ctx: &mut TheContext, )
Draw the widget in the given style
Provided Methods§
Sourcefn set_dim(&mut self, dim: TheDim, ctx: &mut TheContext)
fn set_dim(&mut self, dim: TheDim, ctx: &mut TheContext)
Set the dimensions of the widget
Sourcefn set_margin(&mut self, margin: Vec4<i32>)
fn set_margin(&mut self, margin: Vec4<i32>)
Sets the margin for content in the layout
Sourcefn set_padding(&mut self, padding: i32)
fn set_padding(&mut self, padding: i32)
Set the padding for content in the layout
Sourcefn set_background_color(&mut self, color: Option<TheThemeColors>)
fn set_background_color(&mut self, color: Option<TheThemeColors>)
Set the background color for the layout
Sourcefn needs_redraw(&mut self) -> bool
fn needs_redraw(&mut self) -> bool
If this function returns true it indicates that the layout needs a redraw.
Sourcefn supports_mouse_wheel(&self) -> bool
fn supports_mouse_wheel(&self) -> bool
This layouts supports mouse wheel events (TheListLayout etc)
Sourcefn mouse_wheel_scroll(&mut self, coord: Vec2<i32>)
fn mouse_wheel_scroll(&mut self, coord: Vec2<i32>)
And if yes, process them here.
Sourcefn relayout(&mut self, ctx: &mut TheContext)
fn relayout(&mut self, ctx: &mut TheContext)
Relayouts the layout.
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, )
Sourcefn as_stack_layout(&mut self) -> Option<&mut dyn TheStackLayoutTrait>
fn as_stack_layout(&mut self) -> Option<&mut dyn TheStackLayoutTrait>
Attempts to cast to TheStackLayoutTrait. Only valid for TheStackLayout.
Sourcefn as_list_layout(&mut self) -> Option<&mut dyn TheListLayoutTrait>
fn as_list_layout(&mut self) -> Option<&mut dyn TheListLayoutTrait>
Attempts to cast to TheListLayoutTrait. Only valid for TheListLayout.
Sourcefn as_rowlist_layout(&mut self) -> Option<&mut dyn TheRowListLayoutTrait>
fn as_rowlist_layout(&mut self) -> Option<&mut dyn TheRowListLayoutTrait>
Attempts to cast to TheRowListLayoutTrait. Only valid for TheRowListLayout.
Sourcefn as_rgba_layout(&mut self) -> Option<&mut dyn TheRGBALayoutTrait>
fn as_rgba_layout(&mut self) -> Option<&mut dyn TheRGBALayoutTrait>
Attempts to cast to TheRGBALayoutTrait. Only valid for TheRGBALayout.
Sourcefn as_tab_layout(&mut self) -> Option<&mut dyn TheTabLayoutTrait>
fn as_tab_layout(&mut self) -> Option<&mut dyn TheTabLayoutTrait>
Attempts to cast to TheTabLayoutTrait. Only valid for TheTabLayout.
Attempts to cast to TheSharedHLayoutTrait. Only valid for TheSharedHLayout.
Attempts to cast to TheSharedVLayoutTrait. Only valid for TheSharedVLayout.
Sourcefn as_hlayout(&mut self) -> Option<&mut dyn TheHLayoutTrait>
fn as_hlayout(&mut self) -> Option<&mut dyn TheHLayoutTrait>
Attempts to cast to TheHLayoutTrait. Only valid for TheHLayout.
Sourcefn as_vlayout(&mut self) -> Option<&mut dyn TheVLayoutTrait>
fn as_vlayout(&mut self) -> Option<&mut dyn TheVLayoutTrait>
Attempts to cast to TheVLayoutTrait. Only valid for TheVLayout.
Sourcefn as_text_layout(&mut self) -> Option<&mut dyn TheTextLayoutTrait>
fn as_text_layout(&mut self) -> Option<&mut dyn TheTextLayoutTrait>
Attempts to cast to TheTextLayout. Only valid for TheTextLayout.
Sourcefn as_tree_layout(&mut self) -> Option<&mut dyn TheTreeLayoutTrait>
fn as_tree_layout(&mut self) -> Option<&mut dyn TheTreeLayoutTrait>
Attempts to cast to TheTreeLayout. Only valid for TheTreeLayout.