pub struct Node<'a> {Show 19 fields
pub kind: WidgetKind,
pub text: Option<String>,
pub icon: Option<IconRole>,
pub children: Vec<Node<'a>>,
pub id_out: Option<&'a mut WidgetId>,
pub bg_color: Option<Color>,
pub style: Style,
pub direction: Option<ContainerDirection>,
pub wrap: Option<ContainerWrap>,
pub gap: Option<i32>,
pub padding: Option<i32>,
pub align_self: Option<AlignSelf>,
pub min_width: Option<f32>,
pub max_width: Option<f32>,
pub min_height: Option<f32>,
pub max_height: Option<f32>,
pub flex_shrink: Option<f32>,
pub flex_basis: Option<Dimension>,
pub split_ratio: Option<u8>,
}Expand description
A declarative representation of a UI widget tree.
Fields§
§kind: WidgetKind§text: Option<String>§icon: Option<IconRole>§children: Vec<Node<'a>>§id_out: Option<&'a mut WidgetId>§bg_color: Option<Color>§style: Style§direction: Option<ContainerDirection>§wrap: Option<ContainerWrap>§gap: Option<i32>§padding: Option<i32>§align_self: Option<AlignSelf>§min_width: Option<f32>§max_width: Option<f32>§min_height: Option<f32>§max_height: Option<f32>§flex_shrink: Option<f32>§flex_basis: Option<Dimension>§split_ratio: Option<u8>Implementations§
Source§impl<'a> Node<'a>
impl<'a> Node<'a>
pub fn new(kind: WidgetKind) -> Self
Sourcepub fn split_ratio(self, ratio: u8) -> Self
pub fn split_ratio(self, ratio: u8) -> Self
Sets the split ratio percentage (0..=100) for SplitPane widgets.
pub fn text(self, text: impl Into<String>) -> Self
Sourcepub fn optional_icon(self, icon: Option<IconRole>) -> Self
pub fn optional_icon(self, icon: Option<IconRole>) -> Self
Sets or clears the stock-art icon with an optional value.
pub fn child(self, child: Node<'a>) -> Self
pub fn bind_id(self, id_out: &'a mut WidgetId) -> Self
Sourcepub fn bind(self, id_out: &'a mut WidgetId) -> Self
pub fn bind(self, id_out: &'a mut WidgetId) -> Self
Alias for Self::bind_id.
Sourcepub fn mount<B: Backend>(
&mut self,
ui: &mut Ui<B>,
parent: Option<WidgetId>,
) -> GuiResult<WidgetId>
pub fn mount<B: Backend>( &mut self, ui: &mut Ui<B>, parent: Option<WidgetId>, ) -> GuiResult<WidgetId>
Renders this node tree into ui and optionally attaches the root to parent.
pub fn bg_color(self, color: Color) -> Self
Sourcepub fn size(self, width: f32, height: f32) -> Self
pub fn size(self, width: f32, height: f32) -> Self
Sets explicit logical-pixel layout dimensions.
For windows, render also forwards both rounded dimensions to the
backend before presentation. They must round to positive i32 values.
Other widget kinds retain flex-layout sizing.
pub fn flex_direction(self, direction: FlexDirection) -> Self
Sourcepub fn wrap(self, wrap: ContainerWrap) -> Self
pub fn wrap(self, wrap: ContainerWrap) -> Self
Sets container wrapping mode.
pub fn flex_grow(self, grow: f32) -> Self
Sourcepub fn flex_wrap(self, wrap: FlexWrap) -> Self
pub fn flex_wrap(self, wrap: FlexWrap) -> Self
Wraps children onto new rows/lines when the container runs out of
space on the main axis (wrapsizer).
Sourcepub fn align_items(self, align: AlignItems) -> Self
pub fn align_items(self, align: AlignItems) -> Self
Cross-axis alignment of the children inside each line.
Sourcepub fn justify_content(self, justify: JustifyContent) -> Self
pub fn justify_content(self, justify: JustifyContent) -> Self
Main-axis distribution of the children (e.g. SpaceBetween).
Sourcepub fn align_content(self, align: AlignContent) -> Self
pub fn align_content(self, align: AlignContent) -> Self
Distribution of wrapped lines on the cross axis.
pub fn percent_size(self, width_pct: f32, height_pct: f32) -> Self
Sourcepub fn gap(self, width: f32, height: f32) -> Self
pub fn gap(self, width: f32, height: f32) -> Self
Sets the gap between items.
For container widgets (Container, GroupBox), this spacing is
also forwarded to the backend container’s flow spacing (Ui::set_container_gap)
during DeclarativeUi::render. This aligns native flow containers (such as
GTK4, whose flow containers pack children into a GtkBox ignoring
computed layout coordinates) with the shared layout model.
Sourcepub fn padding(self, val: f32) -> Self
pub fn padding(self, val: f32) -> Self
Sets uniform padding across all sides.
For container widgets (Container, GroupBox), this inset is
forwarded to the backend container properties (Ui::set_container_padding)
during DeclarativeUi::render.
pub fn margin(self, val: f32) -> Self
Sourcepub fn align_self(self, align: AlignSelf) -> Self
pub fn align_self(self, align: AlignSelf) -> Self
Overrides cross-axis alignment for this child (equivalent to wxALIGN_* or wxEXPAND).
Sourcepub fn min_width(self, width: f32) -> Self
pub fn min_width(self, width: f32) -> Self
Sets the minimum width in logical pixels (equivalent to wxWindow::SetMinSize / wxSizer::SetItemMinSize).
Sourcepub fn max_width(self, width: f32) -> Self
pub fn max_width(self, width: f32) -> Self
Sets the maximum width in logical pixels (equivalent to wxWindow::SetMaxSize).
Sourcepub fn min_height(self, height: f32) -> Self
pub fn min_height(self, height: f32) -> Self
Sets the minimum height in logical pixels (equivalent to wxWindow::SetMinSize / wxSizer::SetItemMinSize).
Sourcepub fn max_height(self, height: f32) -> Self
pub fn max_height(self, height: f32) -> Self
Sets the maximum height in logical pixels (equivalent to wxWindow::SetMaxSize).
Sourcepub fn min_size(self, width: f32, height: f32) -> Self
pub fn min_size(self, width: f32, height: f32) -> Self
Sets both minimum width and minimum height in logical pixels.
Sourcepub fn max_size(self, width: f32, height: f32) -> Self
pub fn max_size(self, width: f32, height: f32) -> Self
Sets both maximum width and maximum height in logical pixels.
Sourcepub fn flex_shrink(self, shrink: f32) -> Self
pub fn flex_shrink(self, shrink: f32) -> Self
Sets the flex shrink factor (relative rate at which item shrinks when space is constrained).
Sourcepub fn flex_basis(self, basis: Dimension) -> Self
pub fn flex_basis(self, basis: Dimension) -> Self
Sets the initial main-axis size of the item before space distribution.
Sourcepub fn display(self, display: Display) -> Self
pub fn display(self, display: Display) -> Self
Sets the layout display model (e.g. Display::Flex or Display::Grid).
Sourcepub fn spacer() -> Node<'static>
pub fn spacer() -> Node<'static>
Creates an expanding spacer (Container with flex_grow = 1.0 and no children),
equivalent to wxSizer::AddStretchSpacer().
Sourcepub fn stretch_spacer() -> Node<'static>
pub fn stretch_spacer() -> Node<'static>
Alias for Node::spacer, equivalent to wxSizer::AddStretchSpacer().