slint/internal/compiler/widgets/qt/datepicker.slint
FloVanGH 14c7910d49
PopupWindow: added close-policy property (#6614)
* Update api/cpp/include/slint_window.h

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update docs/reference/src/language/builtins/elements.md

Co-authored-by: Simon Hausmann <simon.hausmann@slint.dev>

* Update internal/core/window.rs

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update internal/interpreter/eval.rs

Co-authored-by: Simon Hausmann <simon.hausmann@slint.dev>

* Update internal/backends/qt/qt_window.rs

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update internal/interpreter/dynamic_item_tree.rs

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update internal/compiler/passes/materialize_fake_properties.rs

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Simon Hausmann <simon.hausmann@slint.dev>
2024-10-24 09:27:39 +00:00

106 lines
3.7 KiB
Text

// Copyright © SixtyFPS GmbH <info@slint.dev>
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0
import { VerticalBox } from "./layouts.slint";
import { Button } from "./button.slint";
import { Palette } from "./std-widgets-impl.slint";
import { StandardButton } from "../common/standardbutton.slint";
import { Date, DatePickerBase } from "../common/datepicker_base.slint";
export { Date }
export component DatePickerPopup inherits PopupWindow {
in property <string> title: "Select date";
in property <Date> date <=> base.date;
property <brush> state: Palette.color-scheme == ColorScheme.dark ? #ffffff : #000000;
property <brush> state-secondary: Palette.color-scheme == ColorScheme.dark ? #000000 : #ffffff;
callback canceled();
callback accepted(/* current-date */ Date);
width: 360px;
height: 524px;
close-policy: PopupClosePolicy.no-auto-close;
background-layer := Rectangle {
border-radius: 8px;
background: Palette.control-background;
width: dialog.width;
height: dialog.height;
}
dialog := Dialog {
padding: 8px;
base := DatePickerBase {
title: root.title;
style: {
border-brush: Palette.border,
vertical-spacing: 8px,
horizontal-spacing: 4px,
calendar-style: {
spacing: 8px,
delegate-style: {
font-size: 14px,
font-weight: 500,
foreground: Palette.foreground,
state-brush: root.state,
background-selected: Palette.accent-background,
foreground-selected: Palette.accent-foreground,
state-brush-selected: root.state-secondary,
border-color-today: Palette.accent-background,
foreground-today: Palette.accent-background,
state-brush-today: root.state,
}
},
icon-button-style: {
foreground: Palette.foreground,
state-brush: root.state,
icon-size: 12px,
},
current-day-style: {
foreground: Palette.foreground,
font-weight: 300,
font-size: 28px,
},
title-style: {
font-size: 14px,
font-weight: 500,
foreground: Palette.foreground,
},
previous-icon: @image-url("./_arrow_back.svg"),
next-icon: @image-url("./_arrow_forward.svg"),
drop-down-icon: @image-url("./_dropdown.svg"),
input-icon: @image-url("./_edit.svg"),
calendar-icon: @image-url("./_calendar.svg"),
selection-button-style: {
foreground: Palette.foreground,
state-brush: root.state,
icon-size: 8px,
font-size: 14px,
font-weight: 500
}
};
}
StandardButton {
kind: cancel;
clicked => {
root.close();
root.canceled();
}
}
StandardButton {
enabled: base.ok-enabled();
kind: ok;
clicked => {
root.close();
root.accepted(base.get-current-date());
}
}
}
}