import { Button } from "button.slint";
export component ViewSwitch {
in-out property <int> mode;
in property <bool> table: true;
width: root.table ? 96px : 64px; height: 28px;
for n[i] in root.table ? [0, 1, 2] : [1, 2]: Rectangle {
x: i * 32px; width: 28px; height: 28px;
Button { x: 0px; y: 0px; width: 28px; min-width: 0px; height: 28px;
state: root.mode == n ? "hovered" : "auto";
clicked => { root.mode = n; }
}
Image { x: 6px; y: 6px; width: 16px; height: 16px; source: n == 0 ? @image-url("../../../assets/ui/table.svg") : n == 1 ? @image-url("../../../assets/ui/rows.svg") : @image-url("../../../assets/ui/grid.svg"); }
}
}