mirror of
https://github.com/slint-ui/slint.git
synced 2025-11-02 21:03:00 +00:00
Some checks are pending
autofix.ci / format_fix (push) Waiting to run
autofix.ci / lint_typecheck (push) Waiting to run
CI / files-changed (push) Waiting to run
CI / build_and_test (--exclude bevy-example, ubuntu-22.04, 1.85) (push) Blocked by required conditions
CI / build_and_test (--exclude ffmpeg --exclude gstreamer-player, --exclude bevy-example, windows-2022, 1.85) (push) Blocked by required conditions
CI / build_and_test (--exclude ffmpeg --exclude gstreamer-player, macos-14, stable) (push) Blocked by required conditions
CI / build_and_test (--exclude ffmpeg --exclude gstreamer-player, windows-2022, beta) (push) Blocked by required conditions
CI / build_and_test (--exclude ffmpeg --exclude gstreamer-player, windows-2022, stable) (push) Blocked by required conditions
CI / cpp_cmake (macos-14, 1.85) (push) Blocked by required conditions
CI / cpp_cmake (ubuntu-22.04, stable) (push) Blocked by required conditions
CI / cpp_cmake (windows-2022, nightly) (push) Blocked by required conditions
CI / cpp_package_test (push) Blocked by required conditions
CI / vsce_build_test (push) Blocked by required conditions
CI / mcu (pico-st7789, thumbv6m-none-eabi) (push) Blocked by required conditions
CI / mcu (pico2-st7789, thumbv8m.main-none-eabihf) (push) Blocked by required conditions
CI / mcu (stm32h735g, thumbv7em-none-eabihf) (push) Blocked by required conditions
CI / mcu-embassy (push) Blocked by required conditions
CI / ffi_32bit_build (push) Blocked by required conditions
CI / docs (push) Blocked by required conditions
CI / build_and_test (ubuntu-22.04, nightly) (push) Blocked by required conditions
CI / node_test (macos-14) (push) Blocked by required conditions
CI / node_test (ubuntu-22.04) (push) Blocked by required conditions
CI / node_test (windows-2022) (push) Blocked by required conditions
CI / python_test (macos-14) (push) Blocked by required conditions
CI / python_test (ubuntu-22.04) (push) Blocked by required conditions
CI / python_test (windows-2022) (push) Blocked by required conditions
CI / cpp_test_driver (macos-13) (push) Blocked by required conditions
CI / cpp_test_driver (ubuntu-22.04) (push) Blocked by required conditions
CI / cpp_test_driver (windows-2022) (push) Blocked by required conditions
CI / wasm (push) Blocked by required conditions
CI / wasm_demo (push) Blocked by required conditions
CI / tree-sitter (push) Blocked by required conditions
CI / updater_test (0.3.0) (push) Blocked by required conditions
CI / fmt_test (push) Blocked by required conditions
CI / esp-idf-quick (push) Blocked by required conditions
CI / android (push) Blocked by required conditions
CI / miri (push) Blocked by required conditions
CI / test-figma-inspector (push) Blocked by required conditions
121 lines
3.7 KiB
Text
121 lines
3.7 KiB
Text
// Copyright © SixtyFPS GmbH <info@slint.dev>
|
|
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0
|
|
|
|
import { Button, HorizontalBox, Switch, Palette, ComboBox } from "std-widgets.slint";
|
|
import { BodyText } from "../components/body-text.slint";
|
|
import { HeaderText } from "../components/header-text.slint";
|
|
import { Api, ComponentItem } from "../api.slint";
|
|
import { EditorSpaceSettings, Icons } from "../components/styling.slint";
|
|
|
|
|
|
export component HeaderView {
|
|
in-out property <bool> show-left-sidebar <=> left-panel-button.checked;
|
|
in-out property <bool> show-right-sidebar <=> right-panel-button.checked;
|
|
in-out property <bool> edit-mode <=> interaction-switch.checked;
|
|
in-out property <string> current-style <=> style-combobox.current-value;
|
|
in property <[string]> known-styles <=> style-combobox.model;
|
|
|
|
callback style-selected();
|
|
callback edit-mode-toggled();
|
|
|
|
background-layer := Rectangle {
|
|
background: Palette.alternate-background;
|
|
|
|
content-layer := HorizontalBox {
|
|
horizontal-stretch: 1;
|
|
|
|
HorizontalLayout {
|
|
alignment: start;
|
|
horizontal-stretch: 0;
|
|
spacing: EditorSpaceSettings.default-spacing / 2;
|
|
|
|
Button {
|
|
icon: Icons.sync;
|
|
colorize-icon: true;
|
|
clicked => {
|
|
Api.reload-preview();
|
|
}
|
|
}
|
|
|
|
HeaderText {
|
|
text: @tr("Preview");
|
|
}
|
|
}
|
|
|
|
HorizontalLayout {
|
|
alignment: start;
|
|
spacing: EditorSpaceSettings.default-spacing;
|
|
|
|
HorizontalLayout {
|
|
visible: false;
|
|
spacing: EditorSpaceSettings.default-spacing / 2;
|
|
horizontal-stretch: 1;
|
|
|
|
BodyText {
|
|
text: @tr("Interact");
|
|
}
|
|
|
|
interaction-switch := Switch {
|
|
checked: true;
|
|
toggled => {
|
|
root.edit-mode-toggled();
|
|
}
|
|
}
|
|
|
|
BodyText {
|
|
text: @tr("Edit");
|
|
}
|
|
}
|
|
|
|
@children
|
|
|
|
left-panel-button := Button {
|
|
horizontal-stretch: 0;
|
|
|
|
checkable: true;
|
|
icon: self.checked ? Icons.sidebar-left : Icons.sidebar-left-off;
|
|
colorize-icon: true;
|
|
}
|
|
|
|
right-panel-button := Button {
|
|
horizontal-stretch: 0;
|
|
|
|
checkable: true;
|
|
icon: self.checked ? Icons.sidebar-right : Icons.sidebar-right-off;
|
|
colorize-icon: true;
|
|
// visible: root.edit-mode;
|
|
}
|
|
}
|
|
|
|
HorizontalLayout {
|
|
alignment: end;
|
|
spacing: 4px;
|
|
|
|
BodyText {
|
|
horizontal-stretch: 0;
|
|
|
|
visible: Api.uses-widgets;
|
|
horizontal-alignment: right;
|
|
text: @tr("Style");
|
|
}
|
|
|
|
style-combobox := ComboBox {
|
|
horizontal-stretch: 0;
|
|
|
|
visible: Api.uses-widgets;
|
|
|
|
selected => {
|
|
root.style-selected();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
Rectangle {
|
|
y: parent.height - self.height;
|
|
height: 1px;
|
|
|
|
background: Palette.border;
|
|
}
|
|
}
|
|
}
|