╭─────────────╮ │scroll to top│ ╰─────────────╯ ╭ Header.zig ───────────────────────────────────────────────────╮ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╰───────────────────────────────────────────────────────────────╯
╭────╮ ╭ clone ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╮ │http│ ssh │ │ ╰────╯ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╯
408 self.scroll.scrollToRect(rect); 409 } 410 } 411 412 pub fn clearGrid(self: *View) void { 413 self.scroll.clearGrid(); 414 } 415 416 pub fn getGrid(self: View) ?Grid { 417 return self.scroll.getGrid(); 418 } 419 420 pub fn getFocus(self: *View) *Focus { 421 return self.scroll.getFocus(); 422 } 423 424 pub fn getSelectedIndex(self: View) ?usize { 425 return self.currentTabIndex(); 426 } 427 428 fn currentTabIndex(self: View) ?usize { 429 if (self.scroll.child.box.focus.child_id != self.tabs_id) return null; 430 const child_id = self.tabsChild().widget.box.focus.child_id orelse return null; 431 return self.tab_ids.getIndex(child_id); 432 } 433 434 fn tabsChild(self: *const View) *wgt.Box(ui.Widget).Child { 435 return self.scroll.child.box.children.getPtr(self.tabs_id) orelse unreachable; 436 } 437 }; 438