DVUI

toast

Add a simple toast. Use toastAdd for more complex toasts.

If opts.subwindow_id is null, the toast will be shown during Window.end. If opts.subwindow_id is the id of a FloatingWindowWidget, it will be shown when that widget runs init(). Otherwise separate code must call toastsShow or toastsFor with that subwindow_id to retrieve this toast and display it.

Can be called from any thread, but if called from a non-GUI thread or outside Window.begin/Window.end, you must set opts.window.

Parameters

#
src:std.builtin.SourceLocation
std.builtin.SourceLocation
opts:ToastOptions
ToastOptions

Source

Implementation

#
pub fn toast(src: std.builtin.SourceLocation, opts: ToastOptions) void {
    const id_mutex = dvui.toastAdd(opts.window, src, opts.id_extra, opts.subwindow_id, opts.displayFn, opts.timeout);
    const id = id_mutex.id;
    dvui.dataSetSlice(opts.window, id, "_message", opts.message);
    id_mutex.mutex.unlock(io);
}