mirror of
https://github.com/slint-ui/slint.git
synced 2025-11-02 04:48:27 +00:00
51 lines
1.6 KiB
Text
51 lines
1.6 KiB
Text
// Copyright © SixtyFPS GmbH <info@slint.dev>
|
|
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-1.1 OR LicenseRef-Slint-commercial
|
|
|
|
// cSpell: ignore Heade
|
|
|
|
import { ScrollView, ComboBox, Button, HorizontalBox } from "std-widgets.slint";
|
|
import { HeaderBar } from "header-bar.slint";
|
|
import { Spinner } from "spinner.slint";
|
|
|
|
export component PreviewUi inherits Window {
|
|
in property<[string]> known-styles <=> i-style-select.model;
|
|
in property<string> current-style <=> i-style-select.current-value;
|
|
in property<component-factory> preview-area <=> i-preview-area-container.component-factory;
|
|
callback design-mode-changed(/* enabled */ bool);
|
|
callback style-changed(/* style */ string);
|
|
|
|
in property <bool> is-busy;
|
|
|
|
VerticalLayout {
|
|
HeaderBar {
|
|
vertical-stretch: 0.0;
|
|
|
|
height: self.preferred-height;
|
|
|
|
i-pick-button := Button {
|
|
text: "Design Mode";
|
|
checkable: true;
|
|
|
|
clicked => {
|
|
root.design-mode-changed(self.checked);
|
|
}
|
|
}
|
|
|
|
i-style-select := ComboBox {
|
|
selected(value) => {
|
|
root.style-changed(value);
|
|
}
|
|
}
|
|
|
|
if (root.is-busy) : Spinner {}
|
|
}
|
|
|
|
drawing-rect := Rectangle {
|
|
/* background: checkerboard pattern; */
|
|
i-preview-area-container := ComponentContainer {
|
|
width: max(self.min-width, min(self.max-width, drawing-rect.width));
|
|
height: max(self.min-height, min(self.max-height, drawing-rect.height));
|
|
}
|
|
}
|
|
}
|
|
}
|