Expand description
input(...) docs.
§Optional fields
labeloverride widget label.stepstep_fastflagspath to a function that returns the input flags.sizesize of the text box (multiline text input).catchmapApplies a mapping function to&mut Self(see example).
§Limitations
Text input is only supported for imgui::ImString types.
§Example
The input trait is implemented for numeric types (f32, f64, i32 and
u32) and their corresponding array and tuple types of up to 9 elements, as
well as imgui::ImGuiExt for text input.
#[derive(imgui_ext::Gui)]
struct Example {
#[imgui(input)]
input_0: f32,
#[imgui(input)]
input_1: [f32; 2],
#[imgui(input(step = 4, step_fast = 42))]
input_2: i32,
}§Result

§Input flags
You can load input flags from a function:
use imgui::ImGuiInputTextFlags;
#[derive(imgui_ext::Gui)]
struct Example {
#[imgui(input(flags = "my_flags"))]
n: f32,
}
fn my_flags() -> ImGuiInputTextFlags {
ImGuiInputTextFlags::Password
}§Mapping
The attribite map references a function to map from a &mut Self of the
field, into a type that is is compatible with a given annotation.
// Note that Foo doesn't derive 'imgui_ext::Gui'
struct Foo {
inner: [f32; 4],
}
#[derive(imgui_ext::Gui)]
struct Bar {
// The Foo type is not compatible with the input() annotation, but its inner attribute is.
#[imgui(input(map = "foo_to_array"))]
foo: Foo,
}
fn foo_to_array(foo: &mut Foo) -> &mut [f32; 4] {
&mut foo.inner
}