Skip to main content

DeclarativeUi

Trait DeclarativeUi 

Source
pub trait DeclarativeUi {
    // Required method
    fn render<'a>(&mut self, node: &mut Node<'a>) -> GuiResult<WidgetId>;
}
Expand description

Extension trait to add declarative rendering to the Ui engine.

§GTK container layout contract

GTK flow containers (Container, GroupBox) lay their flow children out natively using an internal gtk::Box container rather than placing each child at layout-computed absolute coordinates. Because of this:

  1. Spacing between flow children is governed by the box spacing (Ui::set_container_gap).
  2. Container insets are governed by the container’s CSS padding (Ui::set_container_padding).

During DeclarativeUi::render, Node::padding and Node::gap are forwarded directly to these backend container properties, ensuring that the native GTK box and the shared layout agree on child spacing and margins across all supported backends (Mock, GTK4, Win32).

Required Methods§

Source

fn render<'a>(&mut self, node: &mut Node<'a>) -> GuiResult<WidgetId>

Renders a declarative Node tree into the Ui engine, creating and attaching widgets, applying styles, and forwarding explicit window dimensions and container spacing/padding to native backend properties.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§