╭─────────────╮ │scroll to top│ ╰─────────────╯ ╭ Header.zig ───────────────────────────────────────────────────╮ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╰───────────────────────────────────────────────────────────────╯
╭────╮ ╭ clone ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╮ │http│ ssh │ │ ╰────╯ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╯
271 for (self.box.children.keys(), self.box.children.values()) |id, *child| { 272 const tb: ?*wgt.TextBox(ui.Widget) = switch (child.widget) { 273 .text_box => |*x| x, 274 .auth_tab => |*at| blk: { 275 // the label tracks login state per frame, so the width must too 276 child.min_size = .{ .width = at.minWidth(), .height = null }; 277 break :blk &at.text_box; 278 }, 279 else => null, 280 }; 281 if (tb) |t| { 282 t.options.border_style = if (self.getFocus().child_id == id) .single else .hidden; 283 } 284 } 285 try self.box.build(allocator, constraint, root_focus); 286 } 287 288 pub fn input(self: *View, allocator: std.mem.Allocator, key: Key, root_focus: *Focus) !void { 289 _ = allocator; 290 const current_tab = self.currentTabIndex() orelse return; 291 if (inp.moveTab(key, current_tab, self.tab_ids.count())) |new_tab| { 292 root_focus.setFocus(self.tab_ids.keys()[new_tab]); 293 } 294 } 295 296 pub fn clearGrid(self: *View) void { 297 self.box.clearGrid(); 298 } 299 300 pub fn getGrid(self: View) ?Grid { 301 return self.box.getGrid(); 302 } 303 304 pub fn getFocus(self: *View) *Focus { 305 return self.box.getFocus(); 306 } 307 308 pub fn getSelectedIndex(self: View) ?usize { 309 return self.currentTabIndex(); 310 } 311 312 fn currentTabIndex(self: View) ?usize { 313 const child_id = self.box.focus.child_id orelse return null; 314 return self.tab_ids.getIndex(child_id); 315 } 316 }; 317