// Copyright © SixtyFPS GmbH // SPDX-License-Identifier: MIT import { NavigationItem } from "../items/navigation_item.slint"; export component BaseNavigationItemTemplate { in property icon; in property selected_icon; in property text; in property index; in property selected; in property show_badge; in property badge; callback clicked; callback pointer_event(event: PointerEvent, position: Point); accessible-role: tab; accessible-label: root.text; accessible-item-index: root.index; accessible-item-selectable: true; accessible-item-selected: root.selected; accessible-action-default => { self.clicked(); } @children } export component BaseNavigation { in property <[NavigationItem]> items; in_out property current_index; callback index_changed(index: int); accessible-role: tab-list; // accessible-delegate-focus: root.current-focused >= 0 ? root.current-focused : root.current-index; // accessible-label: root.title; accessible-item-count: root.items.length; @children protected function select(index: int) { if index < 0 || index >= root.items.length { return; } root.current_index = index; root.index_changed(index); } }