init
It's expected to call this when self is undefined
Parameters
- self:*SuggestionWidget
- *SuggestionWidget
- src:std.builtin.SourceLocation
- std.builtin.SourceLocation
- init_opts:InitOptions
- InitOptions
- opts:Options
- Options
Source
Implementation
pub fn init(self: *SuggestionWidget, src: std.builtin.SourceLocation, init_opts: InitOptions, opts: Options) void {
self.* = .{
.options = defaults.override(opts),
.init_options = init_opts,
// SAFETY: Set bellow
.selected_index = undefined,
// SAFETY: Set bellow
.menu = undefined,
};
self.menu.init(src, .{ .dir = .horizontal, .close_without_focused_child = false }, .{ .role = .none, .rect = .{}, .id_extra = self.options.idExtra(), .name = "Suggestions Menu" });
self.selected_index = dvui.dataGet(null, self.menu.data().id, "_selected", usize) orelse 0;
}