master
 1const std = @import("std");
 2const uefi = std.os.uefi;
 3const Guid = uefi.Guid;
 4const Status = uefi.Status;
 5const hii = uefi.hii;
 6const cc = uefi.cc;
 7const Error = Status.Error;
 8
 9/// Display a popup window
10pub const HiiPopup = extern struct {
11    revision: u64,
12    _create_popup: *const fn (*const HiiPopup, PopupStyle, PopupType, hii.Handle, u16, ?*PopupSelection) callconv(cc) Status,
13
14    pub const CreatePopupError = uefi.UnexpectedError || error{
15        InvalidParameter,
16        OutOfResources,
17    };
18
19    /// Displays a popup window.
20    pub fn createPopup(
21        self: *const HiiPopup,
22        style: PopupStyle,
23        popup_type: PopupType,
24        handle: hii.Handle,
25        msg: u16,
26    ) CreatePopupError!PopupSelection {
27        var res: PopupSelection = undefined;
28        switch (self._create_popup(self, style, popup_type, handle, msg, &res)) {
29            .success => return res,
30            .invalid_parameter => return Error.InvalidParameter,
31            .out_of_resources => return Error.OutOfResources,
32            else => |status| return uefi.unexpectedStatus(status),
33        }
34    }
35
36    pub const guid align(8) = Guid{
37        .time_low = 0x4311edc0,
38        .time_mid = 0x6054,
39        .time_high_and_version = 0x46d4,
40        .clock_seq_high_and_reserved = 0x9e,
41        .clock_seq_low = 0x40,
42        .node = [_]u8{ 0x89, 0x3e, 0xa9, 0x52, 0xfc, 0xcc },
43    };
44
45    pub const PopupStyle = enum(u32) {
46        info,
47        warning,
48        @"error",
49    };
50
51    pub const PopupType = enum(u32) {
52        ok,
53        cancel,
54        yes_no,
55        yes_no_cancel,
56    };
57
58    pub const PopupSelection = enum(u32) {
59        ok,
60        cancel,
61        yes,
62        no,
63    };
64};