rust_widgets 2.5.2

Pure Rust cross-platform native GUI library with hardware-adaptive rendering, 180 widgets, touch/gesture support, i18n, and SVG-pipeline-accurate output
// Generated by the rust_widgets designer. Do not edit by hand.
//
// target profile : mini (build with `cargo build --no-default-features --features mini`)
// root control   : window
// nodes          : 4
// properties     : 2
//
// resolved at generation time (not calls in this file):
//   - the document's layout was solved into constant coordinates against 640x480

use rust_widgets::core::Rect;
use rust_widgets::widget::Widget;

pub fn build_ui() {
    let mut root = rust_widgets::widget::Window::new(String::from("Generated Demo"), Rect::new(0, 0, 640, 480));
    let n_0 = rust_widgets::widget::Label::new(String::from("Generated from a project document"), Rect::new(0, 0, 640, 156));
    let n_1 = {
        let mut n_1 = rust_widgets::widget::Button::new(String::from("Go"), Rect::new(0, 162, 640, 156));
        // enabled
        n_1.set_enabled(false);
        n_1
    };
    let n_2 = {
        let mut n_2 = rust_widgets::widget::Slider::new(Rect::new(0, 324, 640, 156));
        // value
        n_2.set_value(40);
        n_2
    };

    // A refused add must be *observable*: `try_add_child` records it in
    // `child_overflow_count`, and the assertion below turns a silent drop into a loud
    // failure. On `alloc_frugal` storage the extra child would otherwise vanish.
    let before = root.base().child_overflow_count();
    root.base_mut().try_add_child(n_0.base().id());
    debug_assert_eq!(
        root.base().child_overflow_count(),
        before,
        "child capacity exceeded while adding a child; split this container"
    );
    // A refused add must be *observable*: `try_add_child` records it in
    // `child_overflow_count`, and the assertion below turns a silent drop into a loud
    // failure. On `alloc_frugal` storage the extra child would otherwise vanish.
    let before = root.base().child_overflow_count();
    root.base_mut().try_add_child(n_1.base().id());
    debug_assert_eq!(
        root.base().child_overflow_count(),
        before,
        "child capacity exceeded while adding a child; split this container"
    );
    // A refused add must be *observable*: `try_add_child` records it in
    // `child_overflow_count`, and the assertion below turns a silent drop into a loud
    // failure. On `alloc_frugal` storage the extra child would otherwise vanish.
    let before = root.base().child_overflow_count();
    root.base_mut().try_add_child(n_2.base().id());
    debug_assert_eq!(
        root.base().child_overflow_count(),
        before,
        "child capacity exceeded while adding a child; split this container"
    );

    let _ = &root;
}