mirror of
https://github.com/slint-ui/slint.git
synced 2025-08-27 22:04:08 +00:00
46 lines
1.4 KiB
Text
46 lines
1.4 KiB
Text
// Copyright © SixtyFPS GmbH <info@slint.dev>
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
import { ComboBox, Palette, HorizontalBox, Switch, StyleMetrics } from "std-widgets.slint";
|
|
import { Icons } from "../assets.slint";
|
|
import { UsecasesPalette } from "../widgets.slint";
|
|
|
|
export component HeaderView {
|
|
min-height: max(32px, layout.min-height);
|
|
callback select-language(index: int);
|
|
|
|
Rectangle {
|
|
background: UsecasesPalette.use-material ? Palette.alternate-background : transparent;
|
|
|
|
layout := HorizontalLayout {
|
|
padding: UsecasesPalette.use-material ? 8px : StyleMetrics.layout-padding;
|
|
spacing: 8px;
|
|
|
|
Image {
|
|
max-height: 32px;
|
|
source: Icons.slint-logo;
|
|
horizontal-alignment: left;
|
|
}
|
|
|
|
// spacer
|
|
Rectangle { }
|
|
|
|
ComboBox {
|
|
model: [@tr("English"), @tr("German")];
|
|
current-value: @tr("English");
|
|
selected() => {
|
|
root.select-language(self.current-index);
|
|
}
|
|
}
|
|
|
|
Switch {
|
|
text: @tr("Dark Mode");
|
|
checked: Palette.color-scheme == ColorScheme.dark;
|
|
|
|
toggled => {
|
|
Palette.color-scheme = self.checked ? ColorScheme.dark : ColorScheme.light;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|