Skip to main content

CotisLayoutManager

Struct CotisLayoutManager 

Source
pub struct CotisLayoutManager { /* private fields */ }
Expand description

Owns the layout tree, viewport size, text measurer, and post-frame element cache.

Implement LayoutManager via crate::cotis_traits and wire into CotisApp with a pipe (e.g. CotisLayoutToRenderListPipeForGenerics from cotis-pipes).

The renderer initializes text measurement and viewport dimensions through LayoutManagerCompatible.

Implementations§

Source§

impl CotisLayoutManager

Source

pub fn set_text_dim_fun( &mut self, fun: Box<dyn Fn(&str, &TextConfig) -> Dimensions>, )

Installs a function that measures text for layout.

Normally set automatically by LayoutManagerCompatible::init from the renderer’s RendererTextMeasuringProvider. Override only for custom measurement or testing.

Source§

impl CotisLayoutManager

Source

pub fn new(screen_dimensions: Dimensions) -> Self

Creates a layout manager whose root element fills screen_dimensions.

Source

pub fn set_dimensions(&mut self, screen_dimensions: Dimensions)

Updates the viewport size used for the root element.

Also called from LayoutManagerCompatible::prepare each frame.

Source

pub fn get_cache_element(&self, id: ElementId) -> Option<&LayoutElement>

Returns an element from the last completed frame layout cache.

Populated when CotisLayoutRun::finalize_layouts finishes. The returned LayoutElement is an internal engine type — not a stable public path API; visibility is under review. Use crate::cotis_traits::secondary_traits and cotis_utils::element_state traits for structured inspection.

Trait Implementations§

Source§

impl ElementBoundingBox for CotisLayoutManager

Source§

fn bounding_box(&self, id: ElementId) -> Option<BoundingBox>

Returns the bounding box of id. Read more
Source§

impl ElementClipInternalSize for CotisLayoutManager

Source§

fn clip_internal_size(&self, id: ElementId) -> Option<Vector2>

Returns clip internal size for id. Read more
Source§

impl ElementClipOffset for CotisLayoutManager

Source§

fn clip_offset(&self, id: ElementId) -> Option<Vector2>

Returns clipping child offset for id. Read more
Source§

impl ElementDebugName for CotisLayoutManager

Source§

fn debug_name(&self, id: ElementId) -> Option<&str>

Returns the debug name for id, if available.
Source§

impl ElementsList for CotisLayoutManager

Source§

fn get_element_ids(&self) -> Vec<ElementId>

Returns all known element IDs.
Source§

fn get_parent_id(&self, id: ElementId) -> Option<ElementId>

Returns the parent ID for id, if any. Read more
Source§

impl<'frame, T> LayoutManager<'frame, T, RenderCommandOutput<T>> for CotisLayoutManager
where T: CotisLayoutCompatible<'frame> + 'frame,

Source§

type ElementConfigurer<'layout> = CotisLayoutRun<'layout, T> where Self: 'layout

The configurator type used while constructing one frame.
Source§

fn begin_frame<'layout>( &'layout mut self, ) -> impl LayoutFrameManager<'frame, T, RenderCommandOutput<T>, Self::ElementConfigurer<'layout>>
where T: 'frame, RenderCommandOutput<T>: 'frame, Self: 'layout,

Starts a new frame and returns a frame manager used to build UI.
Source§

impl<Renderer: CotisWindowContext + RendererTextMeasuringProvider<TextConfig>> LayoutManagerCompatible<Renderer> for CotisLayoutManager

Source§

fn init(&mut self, renderer: &mut Renderer)

Initializes layout manager state against a renderer. Read more
Source§

fn prepare(&mut self, render: &Renderer)

Prepares the layout manager before starting a new frame.
Source§

impl LayoutTextMeasuring<TextConfig> for CotisLayoutManager

Source§

fn set_text_measuring_function( &mut self, text: Box<TextMeasurer<'_, DefaultTextConfig>>, )

Registers the text measuring function used by the layout implementation.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<H, TailTarget, Source, Idx> Embed<RenderTList<H, TailTarget>, There<Idx>> for Source
where TailTarget: IsRenderList, Source: Embed<TailTarget, Idx>,

Source§

fn embed(self) -> RenderTList<H, TailTarget>

Converts self into Target.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.