mirror of
https://codeberg.org/vyn/selenite.git
synced 2025-07-03 10:13:26 +00:00
Add helpers to setup Selenite in C++ projects
This commit is contained in:
parent
e27b4c150b
commit
f3025d08cd
20 changed files with 24870 additions and 11 deletions
|
@ -1,48 +0,0 @@
|
|||
import { Button, DatePickerPopup, Date, Palette } from "std-widgets.slint";
|
||||
import { VLabeledComponent } from "LabeledComponent.slint";
|
||||
import { VActionButton } from "ActionButton.slint";
|
||||
import { VButton } from "Button.slint";
|
||||
import { Svg } from "Svg.slint";
|
||||
|
||||
export component VDatePicker inherits VLabeledComponent {
|
||||
in-out property<Date> date;
|
||||
in-out property<string> dateDisplay;
|
||||
|
||||
pure function formatZeroPadding(number: int) -> string {
|
||||
if (number < 10) {
|
||||
return "0\{number}";
|
||||
}
|
||||
return number;
|
||||
}
|
||||
|
||||
pure function getDateDisplay() -> string {
|
||||
if (date.year == 0) {
|
||||
return "Unscheduled";
|
||||
}
|
||||
return formatZeroPadding(date.day) + "/" + formatZeroPadding(date.month) + "/" + date.year;
|
||||
}
|
||||
|
||||
function resetDate() {
|
||||
date.year = 0;
|
||||
date.month = 0;
|
||||
date.day = 0;
|
||||
}
|
||||
|
||||
HorizontalLayout {
|
||||
VButton {
|
||||
text: getDateDisplay();
|
||||
enabled: root.enabled;
|
||||
clicked => { taskDateInput.show() }
|
||||
}
|
||||
VActionButton {
|
||||
icon-svg: Svg.reset;
|
||||
icon-svg-stroke-width: 1px;
|
||||
enabled: root.enabled;
|
||||
clicked => { resetDate() }
|
||||
}
|
||||
}
|
||||
|
||||
taskDateInput := DatePickerPopup {
|
||||
accepted(date) => { root.date = date }
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue