#[macro_export]
macro_rules! render_component_in_current_box {
(
in: $arg_surface : expr, // Eg: in: surface
component_id: $arg_component_id : expr, // Eg: "0"
from: $arg_component_registry_map : expr, // Eg: from: component_registry_map
global_data: $arg_global_data : expr, // Eg: global_data
has_focus: $arg_has_focus : expr // Eg: has_focus
) => {
let maybe_component_ref = $crate::ComponentRegistry::try_to_get_component_by_id(
$arg_component_registry_map,
$arg_component_id,
);
if let Some(component_ref) = maybe_component_ref {
let surface_bounds = $crate::SurfaceBounds::from(&*($arg_surface));
let current_box = $arg_surface.current_box()?;
let queue = component_ref.render(
$arg_global_data,
*current_box,
surface_bounds,
$arg_has_focus,
)?;
$arg_surface.render_pipeline += queue;
}
};
}
#[macro_export]
macro_rules! render_component_in_given_box {
(
in: $arg_surface : expr, // Eg: in: surface
box: $arg_box : expr, // Eg: box: FlexBox::default()
component_id: $arg_component_id : expr, from: $arg_component_registry_map : expr, global_data: $arg_global_data : expr, has_focus: $arg_has_focus : expr ) => {{
let maybe_component_ref = $crate::ComponentRegistry::try_to_get_component_by_id(
$arg_component_registry_map,
$arg_component_id,
);
if let Some(component_ref) = maybe_component_ref {
let surface_bounds = $crate::SurfaceBounds::from(&*($arg_surface));
let queue: $crate::RenderPipeline = component_ref.render(
$arg_global_data,
$arg_box,
surface_bounds,
$arg_has_focus,
)?;
$arg_surface.render_pipeline += queue;
}
}};
}