╭─────────────╮ │scroll to top│ ╰─────────────╯ ╭ Unauthorized.zig ─────────────────────────────────────────────╮ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╰───────────────────────────────────────────────────────────────╯
╭ find file ─ ─ ─ ─ ─ ─ ─ ─ ─ ─╮ ╭────╮ ╭ clone ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─╮ │ │ │http│ ssh │ │ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─╯ ╰────╯ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─╯
10 11 const Self = @This(); 12 13 pub fn init() Self { 14 return .{}; 15 } 16 17 // shown in place of a view that requires being logged in 18 pub const View = struct { 19 center: ui.widget.Center, 20 21 const message = 22 \\you can't view this. 23 \\ 24 \\here's an emoticon from the early 2000s instead: 25 \\ 26 \\<('o'<) ^( '-' )^ (>'o')> 27 \\ 28 \\hope it helps. 29 ; 30 31 pub fn init(allocator: std.mem.Allocator) !View { 32 var text_box = try wgt.TextBox.init(allocator, message, .{ .border = null, .round_corners = false, .wrap_kind = .word }); 33 errdefer text_box.deinit(allocator); 34 return .{ .center = try ui.widget.Center.init(allocator, .{ .text_box = text_box }) }; 35 } 36 37 pub fn deinit(self: *View, allocator: std.mem.Allocator) void { 38 self.center.deinit(allocator); 39 } 40 41 pub fn build(self: *View, allocator: std.mem.Allocator, constraint: layout.Constraint, root_focus: *Focus) !void { 42 try self.center.build(allocator, constraint, root_focus); 43 } 44 45 pub fn input(self: *View, allocator: std.mem.Allocator, key: Key, root_focus: *Focus) !void { 46 _ = self; 47 _ = allocator; 48 _ = key; 49 _ = root_focus; 50 } 51 52 pub fn clearGrid(self: *View) void { 53 self.center.clearGrid(); 54 } 55 56 pub fn getGrid(self: View) ?Grid { 57 return self.center.getGrid(); 58 } 59 60 pub fn getFocus(self: *View) *Focus { 61 return self.center.getFocus(); 62 } 63 }; 64