Skip to main content

RenderInlineChildrenContainerDefaults

Trait RenderInlineChildrenContainerDefaults 

Source
pub trait RenderInlineChildrenContainerDefaults: RenderBox + ContainerRenderObjectMixin<ChildType = AnyRenderBox, ParentDataType = TextParentData> {
    // Provided methods
    fn setup_parent_data(
        self: RenderHandle<Self>,
        app: &mut App,
        child: AnyRenderObject,
    ) { ... }
    fn layout_inline_children(
        self: RenderHandle<Self>,
        app: &mut App,
        max_width: f64,
        layout_child: ChildLayouter,
        get_child_baseline: ChildBaselineGetter,
    ) -> Vec<PlaceholderDimensions> { ... }
    fn position_inline_children(
        self: RenderHandle<Self>,
        app: &mut App,
        boxes: &[TextBox],
    ) { ... }
    fn default_apply_paint_transform(
        self: RenderHandle<Self>,
        app: &App,
        child: AnyRenderObject,
        transform: &mut Matrix4,
    ) { ... }
    fn paint_inline_children(
        self: RenderHandle<Self>,
        app: &mut App,
        context: &mut PaintingContext,
        offset: Offset,
    ) { ... }
    fn hit_test_inline_children(
        self: RenderHandle<Self>,
        app: &mut App,
        result: &mut BoxHitTestResult<'_>,
        position: Offset,
    ) -> bool { ... }
}
Expand description

A mixin that provides useful default behaviors for text RenderBoxes (RenderParagraph and RenderEditable for example) with inline content children managed by the ContainerRenderObjectMixin mixin.

This mixin assumes every child managed by the ContainerRenderObjectMixin mixin corresponds to a PlaceholderSpan, and they are organized in logical order of the text (the order each PlaceholderSpan is encountered when the user reads the text).

To use this mixin in a RenderBox class:

See also:

  • WidgetSpan::extract_from_inline_span, a helper function for extracting WidgetSpans from an InlineSpan tree.

Provided Methods§

Source

fn setup_parent_data( self: RenderHandle<Self>, app: &mut App, child: AnyRenderObject, )

Installs TextParentData on child, the mixin’s setupParentData.

Source

fn layout_inline_children( self: RenderHandle<Self>, app: &mut App, max_width: f64, layout_child: ChildLayouter, get_child_baseline: ChildBaselineGetter, ) -> Vec<PlaceholderDimensions>

Computes the layout for every inline child using the max_width constraint.

Returns a list of PlaceholderDimensions, representing the layout results for each child managed by the ContainerRenderObjectMixin mixin.

The get_child_baseline parameter and the layout_child parameter must be consistent: if layout_child computes the size of the child without modifying the actual layout of that child, then get_child_baseline must also be “dry”, and vice versa.

Since this method does not impose a maximum height constraint on the inline children, some children may become taller than this RenderBox.

See also:

Source

fn position_inline_children( self: RenderHandle<Self>, app: &mut App, boxes: &[TextBox], )

Positions each inline child according to the coordinates provided in the boxes list.

The boxes list must be in logical order, which is the order each child is encountered when the user reads the text. Usually the length of the list equals child_count, but it can be less than that, when some children are omitted due to ellipsing. It never exceeds child_count.

See also:

Source

fn default_apply_paint_transform( self: RenderHandle<Self>, app: &App, child: AnyRenderObject, transform: &mut Matrix4, )

Applies the transform that would be applied when painting the given child to the given matrix.

Render children whose TextParentData::offset is None zeros out the transform to indicate they’re invisible thus should not be painted.

Source

fn paint_inline_children( self: RenderHandle<Self>, app: &mut App, context: &mut PaintingContext, offset: Offset, )

Paints each inline child.

Render children whose TextParentData::offset is None will be skipped by this method.

Source

fn hit_test_inline_children( self: RenderHandle<Self>, app: &mut App, result: &mut BoxHitTestResult<'_>, position: Offset, ) -> bool

Performs a hit test on each inline child.

Render children whose TextParentData::offset is None will be skipped by this method.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§