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