Various minor improvements

This commit is contained in:
Vyn 2024-11-01 13:41:11 +01:00
parent a2aeeea421
commit 00857b287f
4 changed files with 25 additions and 12 deletions

View file

@ -10,20 +10,24 @@ export component VButton inherits Rectangle {
in property<brush> icon-colorize: Palette.foreground;
in property<length> icon-size: 1rem;
in property <string> icon-svg;
in property <brush> background-color: Palette.control-background;
in property enabled <=> ta.enabled;
callback clicked;
callback double-clicked;
private property<bool> active: false;
background: enabled ? Palette.control-background : Palette.control-background.darker(0.2);
background: enabled ? root.background-color : Palette.control-background.darker(0.2);
border-radius: 4px;
ta := TouchArea {
mouse-cursor: pointer;
clicked => {
active = !active;
root.clicked();
}
double-clicked => {
root.double-clicked();
}
}
HorizontalLayout {

View file

@ -20,7 +20,7 @@ export component VCheckBox {
border-radius: 32px;
}
if !checked : Rectangle {
border-color: Palette.accent;
border-color: Palette.foreground;
border-width: 2px;
height: 1rem;
width: self.height;

View file

@ -8,6 +8,8 @@ export component VDatePicker inherits VLabeledComponent {
in-out property<Date> date;
in-out property<string> dateDisplay;
callback edited(Date);
pure function formatZeroPadding(number: int) -> string {
if (number < 10) {
return "0\{number}";
@ -26,13 +28,14 @@ export component VDatePicker inherits VLabeledComponent {
date.year = 0;
date.month = 0;
date.day = 0;
root.edited(date);
}
HorizontalLayout {
VButton {
text: getDateDisplay();
enabled: root.enabled;
clicked => { taskDateInput.show() }
clicked => {taskDateInput.show() }
}
VActionButton {
icon-svg: Svg.reset;
@ -43,6 +46,9 @@ export component VDatePicker inherits VLabeledComponent {
}
taskDateInput := DatePickerPopup {
accepted(date) => { root.date = date }
accepted(date) => {
root.date = date;
root.edited(date);
}
}
}

View file

@ -22,13 +22,16 @@ export component ToggleButton inherits Rectangle {
}
}
VerticalLayout {
padding: 8px;
padding-top: 4px;
padding-bottom: 4px;
text-component := VText {
horizontal-alignment: center;
HorizontalLayout {
alignment: space-between;
VerticalLayout {
padding: 8px;
padding-top: 4px;
padding-bottom: 4px;
text-component := VText {
horizontal-alignment: center;
}
}
@children
}
}