[][src]Module imgui_ext::tree

tree(...) docs.

Annotation to build static Tree UIs.

This is a rather complex annotation. It's not meant to be used extensively though..

Optional params

  • label = ".." Node label
  • flags = ".." Local function returning ImGuiTreeNodeFlags
  • node(..) Nested content (any of the supported annotations).
  • cond One of the ImGuiCond variants.

Example

use imgui::{ImGuiTreeNodeFlags, ImString};

#[derive(imgui_ext::Gui)]
pub struct Tree {
    #[imgui(tree(
        label = "Sliders",
        cond = "FirstUseEver",
        flags = "flags",
        node(nested)
    ))]
    sliders: Sliders,
    #[imgui(tree(label = "Inputs", flags = "flags", node(nested)))]
    inputs: Inputs,
    #[imgui(tree(label = "Color picker", flags = "flags", node(color(picker))))]
    color: [f32; 3],
}

fn flags() -> ImGuiTreeNodeFlags {
    ImGuiTreeNodeFlags::Framed
}

#[derive(imgui_ext::Gui)]
pub struct Sliders {
    #[imgui(text("Slider widgets:"), slider(min = 0.0, max = 3.0))]
    s1: f32,
    #[imgui(slider(min = "-4", max = 4))]
    s2: [i32; 3],
    #[imgui(slider(min = "-1.0", max = 1.0))]
    s3: [f64; 2],
}

#[derive(imgui_ext::Gui)]
pub struct Inputs {
    #[imgui(text("Input widgets:"), input)]
    i1: f32,
    #[imgui(input)]
    i2: imgui::ImString,
    #[imgui(input)]
    i3: [f32; 8],
}

Result