mirai/src/windows/EditEventWindow/EditEventWindow.slint

68 lines
1.9 KiB
Text

import { AppWindowModels } from "../AppWindow/Models.slint";
import { Button, VerticalBox, CheckBox } from "std-widgets.slint";
import { VText, VTextInput, Palette } from "@selenite";
import { VButton } from "../../../external/selenite/components/index.slint";
import { Date, Time, Button, VerticalBox, CheckBox, ScrollView, ComboBox } from "std-widgets.slint";
import { VDatePicker } from "../../../external/selenite/components/DatePicker.slint";
import { VTimePicker } from "../../../external/selenite/components/TimePicker.slint";
export struct CreateEventParams {
title: string,
date: Date,
startsAt: Time,
endsAt: Time
}
export component EditEventWindow inherits Window {
title: "Mirai - Event";
min-height: 100px;
max-height: 500px; // needed, otherwise the window wants to fit the content (on Swaywm)
max-width: 500px; // needed, otherwise the window wants to fit the content (on Swaywm)
background: Palette.background;
in-out property <int> sourceId;
callback create-event(CreateEventParams);
callback delete-event(int);
VerticalLayout {
padding: 16px;
spacing: 8px;
titleInput := VTextInput {
label: "title";
}
VText { text: "on"; vertical-alignment: bottom;}
dateInput := VDatePicker {
enabled: true;
}
HorizontalLayout {
spacing: 4px;
VText { text: "between"; vertical-alignment: bottom; }
startTimeInput := VTimePicker { }
VText { text: "and"; vertical-alignment: bottom; }
endTimeInput := VTimePicker { }
}
VButton {
text: "Create";
clicked => {
debug("clicked");
root.create-event({
title: titleInput.text,
date: dateInput.date,
startsAt: startTimeInput.time,
endsAt: endTimeInput.time
})
}
}
VButton {
text: "Delete";
background-color: Palette.red;
double-clicked => {
//root.delete-event(root.id)
}
}
}
}
export { AppWindowModels, Palette } // Export to make it visible to the C++ backend