DVUI

init

It's expected to call this when self is undefined

Parameters

#
self:*CacheSizeWidget
*CacheSizeWidget
src:std.builtin.SourceLocation
std.builtin.SourceLocation
init_opts:InitOptions
InitOptions
opts:Options
Options

Source

Implementation

#
pub fn init(self: *CacheSizeWidget, src: std.builtin.SourceLocation, init_opts: InitOptions, opts: Options) void {
    const defaults = Options{ .name = "CacheSize" };
    self.* = .{
        .wd = .init(src, .{}, defaults.override(opts)),
        .init_opts = init_opts,
        .refresh_prev_value = dvui.currentWindow().extra_frames_needed,
        .stable = undefined,
    };

    self.stable = dvui.dataGetDefault(null, self.data().id, "stable", bool, false);
    if (init_opts.invalidate) self.stable = false;
    if (self.data().visible()) self.stable = false;

    dvui.currentWindow().extra_frames_needed = 0;
    dvui.parentSet(self.widget());
    self.data().register();
    self.data().borderAndBackground(.{});
}