[][src]Module imgui_ext::vars

vars(...) docs.

Pushes style and color parameters to the stack, so they can be applied to the widgets contained in the annotation.

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

Params

  • content(...) widgets inside this annotation will have the style and color params applied.

Optional params

  • style = "..." path to a function that returns the style parameters.
  • color = "..." path to a function that returns the color parameters.

Example

use imgui::{ImGuiCol, StyleVar};

#[derive(imgui_ext::Gui)]
struct Example {
    #[imgui(vars(
        style = "example_style",
        color = "example_color",
        content(
            input(label = "foo##input"),
            drag(label = "foo##drag"),
            slider(label = "foo##slider", min = "-1.0", max = "1.0")
        )
    ))]
    foo: f32,
}

fn example_style() -> &'static [StyleVar] {
    &[StyleVar::FrameRounding(4.0)]
}

fn example_color() -> &'static [(ImGuiCol, [f32; 4])] {
    &[(ImGuiCol::Button, [1.0, 0.0, 1.0, 1.0])]
}

Result