DVUI

gridHeading

Create a heading with a static label

Parameters

#
src:std.builtin.SourceLocation
std.builtin.SourceLocation
g:*GridWidget
*GridWidget
col_num:usize
usize
heading:[]const u8
[]const u8
resize_opts:?GridWidget.HeaderResizeWidget.InitOptions
?GridWidget.HeaderResizeWidget.InitOptions
cell_style:anytype
anytype

Source

Implementation

#
pub fn gridHeading(
    src: std.builtin.SourceLocation,
    g: *GridWidget,
    col_num: usize,
    heading: []const u8,
    resize_opts: ?GridWidget.HeaderResizeWidget.InitOptions,
    cell_style: anytype, // GridWidget.CellStyle
) void {
    const label_defaults: Options = .{
        .corners = CornerRect{},
        .expand = .horizontal,
        .gravity_x = 0.5,
        .gravity_y = 0.5,
        .background = true,
    };
    const opts = if (@TypeOf(cell_style) == @TypeOf(.{})) GridWidget.CellStyle.none else cell_style;

    const label_options = label_defaults.override(opts.options(.colRow(col_num, 0)));
    var cell = g.headerCell(src, col_num, opts.cellOptions(.colRow(col_num, 0)));
    defer cell.deinit();

    labelNoFmt(@src(), heading, .{}, label_options);
    gridHeadingSeparator(resize_opts);
}