slint/internal/compiler/widgets/fluent/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

102 lines
3.8 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 { FluentPalette, FluentFontSettings, Icons } from "styling.slint";
import { MenuBorder } from "./components.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;
callback canceled();
callback accepted(/* current-date */ Date);
width: 368px;
height: 524px;
close-policy: PopupClosePolicy.no-auto-close;
background-layer := MenuBorder {
width: dialog.width;
height: dialog.height;
}
dialog := Dialog {
padding: 8px;
base := DatePickerBase {
title: root.title;
style: {
border-brush: FluentPalette.border,
vertical-spacing: 8px,
horizontal-spacing: 4px,
calendar-style: {
spacing: 8px,
delegate-style: {
font-size: FluentFontSettings.body-strong.font-size,
font-weight: FluentFontSettings.body-strong.font-weight,
foreground: FluentPalette.foreground,
state-brush: FluentPalette.state,
background-selected: FluentPalette.accent-background,
foreground-selected: FluentPalette.accent-foreground,
state-brush-selected: FluentPalette.state-secondary,
border-color-today: FluentPalette.accent-background,
foreground-today: FluentPalette.accent-background,
state-brush-today: FluentPalette.state,
}
},
icon-button-style: {
foreground: FluentPalette.foreground,
state-brush: FluentPalette.state,
icon-size: 12px,
},
current-day-style: {
font-size: FluentFontSettings.title.font-size,
font-weight: FluentFontSettings.title.font-weight,
foreground: FluentPalette.foreground,
},
title-style: {
font-size: FluentFontSettings.body.font-size,
font-weight: FluentFontSettings.body.font-weight,
foreground: FluentPalette.foreground,
},
previous-icon: Icons.arrow-back,
next-icon: Icons.arrow-forward,
drop-down-icon: Icons.dropdown,
input-icon: Icons.edit,
calendar-icon: Icons.calendar,
selection-button-style: {
foreground: FluentPalette.foreground,
state-brush: FluentPalette.state,
icon-size: 8px,
font-size: FluentFontSettings.body.font-size,
font-weight: FluentFontSettings.body.font-weight
}
};
}
StandardButton {
kind: cancel;
clicked => {
root.close();
root.canceled();
}
}
StandardButton {
enabled: base.ok-enabled();
kind: ok;
clicked => {
root.close();
root.accepted(base.get-current-date());
}
}
}
}