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<brush> icon-colorize: Palette.foreground;
in property<length> icon-size: 1rem; in property<length> icon-size: 1rem;
in property <string> icon-svg; in property <string> icon-svg;
in property <brush> background-color: Palette.control-background;
in property enabled <=> ta.enabled; in property enabled <=> ta.enabled;
callback clicked; callback clicked;
callback double-clicked;
private property<bool> active: false; 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; border-radius: 4px;
ta := TouchArea { ta := TouchArea {
mouse-cursor: pointer; mouse-cursor: pointer;
clicked => { clicked => {
active = !active;
root.clicked(); root.clicked();
} }
double-clicked => {
root.double-clicked();
}
} }
HorizontalLayout { HorizontalLayout {

View file

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

View file

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

View file

@ -22,6 +22,8 @@ export component ToggleButton inherits Rectangle {
} }
} }
HorizontalLayout {
alignment: space-between;
VerticalLayout { VerticalLayout {
padding: 8px; padding: 8px;
padding-top: 4px; padding-top: 4px;
@ -30,5 +32,6 @@ export component ToggleButton inherits Rectangle {
horizontal-alignment: center; horizontal-alignment: center;
} }
} }
@children
}
} }