Tunal/crates/tunal/ui/shell/toolbar.slint
astar76 62a6754499 S038: expressive restyle with shaped containers, ripples and rounded surfaces
Shape library (cookies, clover, scallop) with morphing Shape component,
press ripple in StateLayer, content card shell, shaped file glyphs,
card grid tiles, dialog header shapes, menu pills, wavy toast progress.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-18 19:24:41 -06:00

168 lines
4.9 KiB
Text

import { Theme } from "../theme.slint";
import { Icons } from "../components/icon.slint";
import { IconButton } from "../components/icon-button.slint";
import { ViewMode } from "../views/details-view.slint";
import { ViewSwitch } from "../views/view-switch.slint";
import { Breadcrumb, Crumb, Completion } from "breadcrumb.slint";
// Navigation for the active pane: sidebar toggle, back, forward, up, the breadcrumb, the
// view mode and the split view toggle.
export component Toolbar inherits Rectangle {
in property <bool> can-back;
in property <bool> can-forward;
in property <bool> can-up;
in property <bool> split;
in property <bool> sidebar;
in property <[Crumb]> crumbs;
in property <string> path;
in property <[Completion]> completions;
in property <ViewMode> view-mode;
in-out property <int> highlight <=> crumb.highlight;
out property <bool> editing: crumb.editing;
// Where the completion list goes, in window coordinates.
out property <length> crumb-x: crumb.absolute-position.x;
out property <length> crumb-bottom: crumb.absolute-position.y + crumb.height;
out property <length> crumb-width: crumb.width;
callback back();
callback forward();
callback up();
callback toggle-split();
callback view-mode-selected(ViewMode);
callback toggle-sidebar();
callback go(int);
callback path-edited(string);
callback path-accepted(string);
callback path-reverted();
// The actions menu button was pressed; window coordinates of its bottom right.
callback actions(length, length);
public function edit-path() {
crumb.edit();
}
public function pick(to: string) {
crumb.pick(to);
}
height: 56px;
HorizontalLayout {
padding-left: Theme.space-2;
padding-right: Theme.space-2;
spacing: Theme.space-2;
alignment: stretch;
VerticalLayout {
alignment: center;
IconButton {
icon: Icons.side-navigation;
toggle: true;
checked: root.sidebar;
tooltip: "Sidebar (F9)";
clicked => {
root.toggle-sidebar();
}
}
}
VerticalLayout {
alignment: center;
IconButton {
icon: Icons.arrow-back;
tonal: true;
enabled: root.can-back;
tooltip: "Back (Alt+Left)";
clicked => {
root.back();
}
}
}
VerticalLayout {
alignment: center;
IconButton {
icon: Icons.arrow-forward;
tonal: true;
enabled: root.can-forward;
tooltip: "Forward (Alt+Right)";
clicked => {
root.forward();
}
}
}
VerticalLayout {
alignment: center;
IconButton {
icon: Icons.arrow-upward;
tonal: true;
enabled: root.can-up;
tooltip: "Parent folder (Alt+Up)";
clicked => {
root.up();
}
}
}
VerticalLayout {
alignment: center;
horizontal-stretch: 1;
padding-left: Theme.space-2;
padding-right: Theme.space-2;
crumb := Breadcrumb {
crumbs: root.crumbs;
path: root.path;
completions: root.completions;
go(i) => {
root.go(i);
}
edited(text) => {
root.path-edited(text);
}
accepted(text) => {
root.path-accepted(text);
}
reverted => {
root.path-reverted();
}
}
}
VerticalLayout {
alignment: center;
ViewSwitch {
mode: root.view-mode;
selected(mode) => {
root.view-mode-selected(mode);
}
}
}
VerticalLayout {
alignment: center;
IconButton {
icon: Icons.more-vert;
tonal: true;
tooltip: "File actions";
clicked => {
root.actions(self.absolute-position.x + self.width, self.absolute-position.y + self.height);
}
}
}
VerticalLayout {
alignment: center;
IconButton {
icon: Icons.vertical-split;
toggle: true;
checked: root.split;
tooltip: "Split view (F3)";
clicked => {
root.toggle-split();
}
}
}
}
}