displayContainer
Create and expander to display a container field and indent the container's fields. can be used for the custom display of structs and unions.
Parameters
- src:std.builtin.SourceLocation
- std.builtin.SourceLocation
- field_name:?[]const u8
- ?[]const u8
- default_expanded:bool
- bool
Source
Implementation
pub fn displayContainer(src: std.builtin.SourceLocation, field_name: ?[]const u8, default_expanded: bool) ?*dvui.BoxWidget {
var vbox: ?*dvui.BoxWidget = null;
if (field_name == null or dvui.expander(
src,
field_name.?,
.{ .default_expanded = default_expanded },
.{ .expand = .horizontal },
)) {
// Use src again in case exoander is not created.
vbox = dvui.box(src, .{ .dir = .vertical }, .{
.expand = .horizontal,
.border = if (field_name != null) .{ .x = 1 } else null,
.background = true,
.margin = if (field_name != null) .{ .x = 12 } else null,
.id_extra = 1,
});
}
return vbox;
}