structUI
Display a struct and allow the user to edit values
Refer to struct_ui.zig for full API. Call StructOptions(T) to to create display options for the struct or use .{} for defaults. See struct_ui.displayStruct for more details.
NOTE:
Any modifyable string slice fields are assigned to a duplicate copy of the the TextWidget's text.
These allocations are automatically cleaned up when Window.deinit() is called.
struct_ui.string_map can be used to check which strings have been modified and had memory allocated
or to remove strings that should not be automatically deallocated by struct_ui.
Parameters
- src:std.builtin.SourceLocation
- std.builtin.SourceLocation
- field_name:?[]const u8
- ?[]const u8
- struct_ptr:anytype
- anytype
- depth:usize
- usize
- struct_options:anytype
- anytype
- opts:dvui.Options
- dvui.Options
Source
Implementation
pub fn structUI(src: std.builtin.SourceLocation, comptime field_name: ?[]const u8, struct_ptr: anytype, comptime depth: usize, struct_options: anytype, opts: dvui.Options) void {
const default_options: dvui.Options = .{ .expand = .horizontal };
var vbox = dvui.box(src, .{ .dir = .vertical }, default_options.override(opts));
defer vbox.deinit();
const struct_box = struct_ui.displayStruct(@src(), field_name, struct_ptr, depth, .default, struct_options, null);
if (struct_box) |b| b.deinit();
}