Skip to main content

LayoutOps

Trait LayoutOps 

Source
pub trait LayoutOps {
    // Required methods
    fn measure_child(&mut self, child: RNode, p: Proposal) -> Size;
    fn place_child(&mut self, child: RNode, rect: Rect);
    fn flex_of(&self, child: RNode) -> Flex;
    fn children_of(&self, node: RNode) -> Vec<RNode>;
    fn measure_leaf(&mut self, p: Proposal) -> Size;
    fn baseline_of(&mut self, child: RNode, size: Size) -> Option<f64>;
    fn set_scroll_content(&mut self, content: Size);

    // Provided methods
    fn place_child_native(&mut self, child: RNode, rect: Rect) { ... }
    fn scroll_bar_inset(&mut self, _vertical: bool) -> f64 { ... }
    fn report_overflow(&mut self, _needed: f64, _available: f64) { ... }
}
Expand description

The engine surface visible to Layout implementations.

Required Methods§

Source

fn measure_child(&mut self, child: RNode, p: Proposal) -> Size

Source

fn place_child(&mut self, child: RNode, rect: Rect)

Source

fn flex_of(&self, child: RNode) -> Flex

Source

fn children_of(&self, node: RNode) -> Vec<RNode>

Source

fn measure_leaf(&mut self, p: Proposal) -> Size

Native intrinsic measurement of the current node (leaves).

Source

fn baseline_of(&mut self, child: RNode, size: Size) -> Option<f64>

A child’s first text baseline at size, from the top of its box (docs/baseline.md): the toolkit answers for a native leaf, the child’s own Layout::baseline for a container. None ⇒ no baseline to align to.

Source

fn set_scroll_content(&mut self, content: Size)

Report scroll content size for the current node (§7.6).

Provided Methods§

Source

fn place_child_native(&mut self, child: RNode, rect: Rect)

Place a child whose on-screen frame is native-owned (nav pages in splitter panes / nav-controller views): never direction-mirrored, because the toolkit positions it.

Source

fn scroll_bar_inset(&mut self, _vertical: bool) -> f64

The room the current scroll node’s scroll bar takes from its content area while the content overflows (Toolkit::scroll_bar_inset); 0 where bars overlay the content.

Source

fn report_overflow(&mut self, _needed: f64, _available: f64)

Report that the current node’s children outgrew the bounds its place() was given (needed vs available main-axis points). A diagnostic hook, not a layout input: the engine logs it once per node in debug builds and ignores it in release, and placement proceeds unchanged either way. Scroll containers never report, since content larger than the viewport is their normal state.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<B: Toolkit> LayoutOps for EngineCx<'_, B>

Day API ↩ Guides· daybrite.dev