mirai/src/windows/AddSourceWindow/AddSourceWindow.slint

46 lines
1 KiB
Text

import { VerticalBox, CheckBox } from "std-widgets.slint";
import { VButton, VText, VTextInput, Palette } from "@selenite";
export struct AddSourceParam {
name: string,
type: string,
path: string
}
export component AddSourceWindow inherits Window {
title: "Mirai - Add source";
min-height: 100px;
max-height: 4000px; // needed, otherwise the window wants to fit the content (on Swaywm)
min-width: 400px;
default-font-size: 16px;
background: Palette.background;
in-out property <string> default-source-path;
callback add-source(AddSourceParam);
VerticalLayout {
padding: 16px;
spacing: 8px;
nameInput := VTextInput {
label: "Name";
text: "todo";
}
pathInput := VTextInput {
label: "Path";
text: root.default-source-path + nameInput.text + ".md";
}
VButton {
text: "Create";
clicked => {
root.add-source({
name: nameInput.text,
type: "FileSystemMarkdown",
path: pathInput.text
})
}
}
}
}
export { Palette } // Export to make it visible to the C++ backend