DVUI

ninepatch

Parameters

#
self:*const Theme
*const Theme
style_name:Style.Name
Style.Name
ask:Options.NinepatchAsk
Options.NinepatchAsk

Source

Implementation

#
pub fn ninepatch(self: *const Theme, style_name: Style.Name, ask: Options.NinepatchAsk) ?*const dvui.Ninepatch {
    const cs: *const Style = switch (style_name) {
        .content => switch (ask) {
            .fill => return if (self.ninepatch_fill) |*np| np else null,
            .hover => return if (self.ninepatch_hover) |*np| np else null,
            .press => return if (self.ninepatch_press) |*np| np else null,
        },
        .control => &self.control,
        .window => &self.window,
        .highlight => &self.highlight,
        .err => &self.err,
        .app1 => &self.app1,
        .app2 => &self.app2,
        .app3 => &self.app3,
    };

    switch (ask) {
        .fill => return if (cs.ninepatch_fill) |*np| np else null,
        .hover => return if (cs.ninepatch_hover) |*np| np else null,
        .press => return if (cs.ninepatch_press) |*np| np else null,
    }
}