DVUI

Parameters

#
self:*FloatingWindowWidget
*FloatingWindowWidget

Source

Implementation

#
pub fn deinit(self: *FloatingWindowWidget) void {
    defer if (dvui.widgetIsAllocated(self)) dvui.widgetFree(self);
    defer self.* = undefined;
    if (self.layout) |*l| l.deinit();

    if (self.auto_size_refresh_prev_value) |pv| {
        if (dvui.currentWindow().extra_frames_needed == 0) {
            self.auto_size = false;
        }
        dvui.currentWindow().extra_frames_needed = @max(dvui.currentWindow().extra_frames_needed, pv);
    }

    if (self.init_options.process_events_in_deinit) {
        self.processEventsAfter();
    }

    if (!dvui.firstFrame(self.data().id)) {
        // if firstFrame, we already did this in init
        dvui.dataSet(null, self.data().id, "_rect", self.data().rect);
        if (self.init_options.rect) |ior| {
            // send rect back to user
            ior.* = self.data().rect;
        }
    }

    if (dvui.captured(self.data().id)) {
        dvui.dataSet(null, self.data().id, "_drag_part", self.drag_part.?);
    }

    dvui.dataSet(null, self.data().id, "_auto_pos", self.auto_pos);
    dvui.dataSet(null, self.data().id, "_auto_size", self.auto_size);
    self.data().minSizeSetAndRefresh();

    // outside normal layout, don't call minSizeForChild or self.data().minSizeReportToParent();

    dvui.parentReset(self.data().id, self.data().parent);
    dvui.currentWindow().last_focused_id_this_frame = self.prev_last_focus;

    // standard subwindow stuff
    {
        _ = dvui.ScrollContainerWidget.scrollSet(self.prev_scroll);
        _ = dvui.subwindowCurrentSet(self.prev_windowInfo.id, self.prev_windowInfo.rect);
        dvui.clipSet(self.prevClip);
        self.render_ftb.deinit();
    }
}