╭─────────────╮ │scroll to top│ ╰─────────────╯ ╭ Home.zig ─────────────────────────────────────────────────────╮ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╰───────────────────────────────────────────────────────────────╯
╭ find file ─ ─ ─ ─ ─ ─ ─ ─ ─ ─╮ ╭────╮ ╭ clone ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─╮ │ │ │http│ ssh │ │ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─╯ ╰────╯ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─╯
123 if (header.getSelectedIndex()) |index| 124 stack.getFocus().child_id = stack.children.keys()[index]; 125 try self.box.build(allocator, constraint, root_focus); 126 } 127 128 pub fn input(self: *View, allocator: std.mem.Allocator, key: Key, root_focus: *Focus) !void { 129 const stack = &self.box.children.values()[stack_index].widget.stack; 130 if (self.getFocus().child_id) |child_id| { 131 if (self.box.children.getIndex(child_id)) |current_index| { 132 const child = &self.box.children.values()[current_index].widget; 133 var index = current_index; 134 135 const direction = inp.vertDirection(key); 136 137 switch (direction) { 138 .up => { 139 switch (child.*) { 140 .home_header => { 141 try child.input(allocator, key, root_focus); 142 }, 143 .stack => { 144 if (child.stack.getSelected()) |selected_widget| { 145 if (selected_widget.atTop(root_focus)) { 146 index = header_index; 147 } else { 148 try child.input(allocator, key, root_focus); 149 } 150 } 151 }, 152 else => {}, 153 } 154 }, 155 .down => { 156 switch (child.*) { 157 .home_header => { 158 if (stack.getSelected()) |selected_widget| switch (selected_widget.*) { 159 .home_users => |*v| return v.focusHeader(root_focus), 160 .user_notifications => |*v| if (v.focusHeader(root_focus)) return, 161 else => {}, 162 }; 163 index = stack_index; 164 }, 165 .stack => { 166 try child.input(allocator, key, root_focus); 167 }, 168 else => {}, 169 } 170 }, 171 .none => { 172 try child.input(allocator, key, root_focus); 173 }, 174 } 175 176 if (index != current_index) { 177 root_focus.setFocus(self.box.children.keys()[index]); 178 } 179 } 180 } 181 } 182 183 pub fn clearGrid(self: *View) void { 184 self.box.clearGrid(); 185 } 186 187 pub fn getGrid(self: View) ?Grid { 188 return self.box.getGrid(); 189 } 190 191 pub fn getFocus(self: *View) *Focus { 192 return self.box.getFocus(); 193 } 194 }; 195