DVUI

show

Runs the display function for all the current dialogs

Parameters

#
self:*Dialogs
*Dialogs

Source

Implementation

#
pub fn show(self: *Dialogs) void {
    const io = dvui.io;
    var i: usize = 0;
    var dia: ?Dialog = null;
    while (true) {
        self.mutex.lockUncancelable(io);
        if (i < self.stack.items.len and
            dia != null and
            dia.?.id == self.stack.items[i].id)
        {
            // we just did this one, move to the next
            i += 1;
        }

        if (i < self.stack.items.len) {
            dia = self.stack.items[i];
        } else {
            dia = null;
        }
        self.mutex.unlock(io);

        if (dia) |d| {
            d.display(d.id) catch |err| {
                dvui.log.warn("Dialog {x} got {any} from its display function", .{ d.id, err });
            };
        } else {
            break;
        }
    }
}