Zig 0.17.0-dev (Split by item)

This is an example of documentation generated by ZigDoc, an alternative to Zig's built-in Auto Doc feature. See also examples in other modes/formats. The project being documented here (as the example) is the Zig library itself.

MenuItemFlags

res.MenuItemFlags
pub const MenuItemFlags = struct

File

Code

pub const MenuItemFlags = struct {
    value: u16 = 0,

    pub fn apply(self: *MenuItemFlags, option: rc.MenuItem.Option) void {
        self.value |= optionValue(option);
    }

    pub fn isSet(self: MenuItemFlags, option: rc.MenuItem.Option) bool {
        return self.value & optionValue(option) != 0;
    }

    fn optionValue(option: rc.MenuItem.Option) u16 {
        return @intCast(switch (option) {
            .checked => MF.CHECKED,
            .grayed => MF.GRAYED,
            .help => MF.HELP,
            .inactive => MF.DISABLED,
            .menubarbreak => MF.MENUBARBREAK,
            .menubreak => MF.MENUBREAK,
        });
    }

    pub fn markLast(self: *MenuItemFlags) void {
        self.value |= @intCast(MF.END);
    }
}