1// Copyright © SixtyFPS GmbH <info@slint.dev>
2// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0
3
4import { StyleMetrics, Button } from "std-widgets-impl.slint";
5
6export component StandardButton {
7 in property <StandardButtonKind> kind;
8 in property <bool> enabled <=> base.enabled;
9 in property <bool> primary <=> base.primary;
10 out property <bool> has-focus <=> base.has-focus;
11 out property <bool> pressed <=> base.pressed;
12
13 forward-focus: base;
14
15 callback clicked <=> base.clicked;
16
17 HorizontalLayout {
18 base := Button {
19 text:
20 root.kind == StandardButtonKind.ok ? "OK" :
21 root.kind == StandardButtonKind.cancel ? "Cancel" :
22 root.kind == StandardButtonKind.apply ? "Apply" :
23 root.kind == StandardButtonKind.close ? "Close" :
24 root.kind == StandardButtonKind.reset ? "Reset" :
25 root.kind == StandardButtonKind.help ? "Help" :
26 root.kind == StandardButtonKind.yes ? "Yes" :
27 root.kind == StandardButtonKind.no ? "No" :
28 root.kind == StandardButtonKind.abort ? "Abort" :
29 root.kind == StandardButtonKind.retry ? "Retry" :
30 root.kind == StandardButtonKind.ignore ? "Ignore" : "";
31 }
32 }
33}
34