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.

ControlClass

https://learn.microsoft.com/en-us/windows/win32/api/winuser/ns-winuser-dlgitemtemplate#remarks

res.ControlClass
pub const ControlClass = enum(u16)

File

Code

pub const ControlClass = enum(u16) {
    button = 0x80,
    edit = 0x81,
    static = 0x82,
    listbox = 0x83,
    scrollbar = 0x84,
    combobox = 0x85,

    pub fn fromControl(control: rc.Control) ?ControlClass {
        return switch (control) {
            // zig fmt: off
            .auto3state, .autocheckbox, .autoradiobutton,
            .checkbox, .defpushbutton, .groupbox, .pushbox,
            .pushbutton, .radiobutton, .state3, .userbutton => .button,
            // zig fmt: on
            .combobox => .combobox,
            .control => null,
            .ctext, .icon, .ltext, .rtext => .static,
            .edittext, .hedit, .iedit => .edit,
            .listbox => .listbox,
            .scrollbar => .scrollbar,
        };
    }

    pub fn getImpliedStyle(control: rc.Control) u32 {
        var style = WS.CHILD | WS.VISIBLE;
        switch (control) {
            .auto3state => style |= BS.AUTO3STATE | WS.TABSTOP,
            .autocheckbox => style |= BS.AUTOCHECKBOX | WS.TABSTOP,
            .autoradiobutton => style |= BS.AUTORADIOBUTTON,
            .checkbox => style |= BS.CHECKBOX | WS.TABSTOP,
            .combobox => {},
            .control => {},
            .ctext => style |= SS.CENTER | WS.GROUP,
            .defpushbutton => style |= BS.DEFPUSHBUTTON | WS.TABSTOP,
            .edittext, .hedit, .iedit => style |= WS.TABSTOP | WS.BORDER,
            .groupbox => style |= BS.GROUPBOX,
            .icon => style |= SS.ICON,
            .listbox => style |= LBS.NOTIFY | WS.BORDER,
            .ltext => style |= WS.GROUP,
            .pushbox => style |= BS.PUSHBOX | WS.TABSTOP,
            .pushbutton => style |= WS.TABSTOP,
            .radiobutton => style |= BS.RADIOBUTTON,
            .rtext => style |= SS.RIGHT | WS.GROUP,
            .scrollbar => {},
            .state3 => style |= BS.@"3STATE" | WS.TABSTOP,
            .userbutton => style |= BS.USERBUTTON | WS.TABSTOP,
        }
        return style;
    }
}