╭─────────────╮ │scroll to top│ ╰─────────────╯ ╭ Quit.zig ─────────────────────────────────────────────────────╮ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╰───────────────────────────────────────────────────────────────╯
╭────╮ ╭ clone ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╮ │http│ ssh │ │ ╰────╯ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╯
63 64 pub fn deinit(self: *View, allocator: std.mem.Allocator) void { 65 self.center.deinit(allocator); 66 } 67 68 pub fn build(self: *View, allocator: std.mem.Allocator, constraint: layout.Constraint, root_focus: *Focus) !void { 69 try self.center.build(allocator, constraint, root_focus); 70 } 71 72 pub fn input(self: *View, allocator: std.mem.Allocator, key: inp.Key, root_focus: *Focus) !void { 73 _ = allocator; 74 switch (key) { 75 .enter => { 76 self.session.quit_requested = true; 77 return; 78 }, 79 .mouse => |mouse| { 80 if (mouse.action == .press and mouse.action.press == .left) { 81 if (root_focus.children.get(self.button_id)) |entry| { 82 const r = entry.rect; 83 if (mouse.x >= r.x and mouse.y >= r.y and 84 mouse.x < r.x + r.size.width and mouse.y < r.y + r.size.height) 85 { 86 self.session.quit_requested = true; 87 return; 88 } 89 } 90 } 91 }, 92 else => {}, 93 } 94 } 95 96 pub fn clearGrid(self: *View) void { 97 self.center.clearGrid(); 98 } 99 100 pub fn getGrid(self: View) ?Grid { 101 return self.center.getGrid(); 102 } 103 104 pub fn getFocus(self: *View) *Focus { 105 return self.center.getFocus(); 106 } 107 108 pub fn getSelectedIndex(self: View) ?usize { 109 _ = self; 110 return 0; 111 } 112 }; 113