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
4export { NativeStyleMetrics as StyleMetrics }
5
6// This internal ScrollView has some additional properties, used by the
7// StandardTableView, which are not currently exposed by the public ScrollView
8// (since then it would need to be done for all styles).
9export component InternalScrollView {
10 in-out property <length> viewport-width <=> fli.viewport-width;
11 in-out property <length> viewport-height <=> fli.viewport-height;
12 in-out property <length> viewport-x <=> fli.viewport-x;
13 in-out property <length> viewport-y <=> fli.viewport-y;
14 out property <length> visible-width <=> fli.width;
15 out property <length> visible-height <=> fli.height;
16 in-out property <bool> has-focus <=> native.has-focus;
17 in property <bool> enabled <=> native.enabled;
18 in property <ScrollBarPolicy> vertical-scrollbar-policy <=> native.vertical-scrollbar-policy;
19 in property <ScrollBarPolicy> horizontal-scrollbar-policy <=> native.horizontal-scrollbar-policy;
20
21 // Used by the StandardTableView
22 out property <length> native-padding-left: native.native-padding-left;
23 out property <length> native-padding-right: native.native-padding-right;
24 out property <length> native-padding-top: native.native-padding-top;
25 out property <length> native-padding-bottom: native.native-padding-bottom;
26 in property <length> header-height: 0;
27
28 callback scrolled <=> fli.flicked;
29
30 preferred-height: 100%;
31 preferred-width: 100%;
32 min-height: native.min-height;
33 min-width: native.min-width;
34
35 native := NativeScrollView {
36 vertical-max: fli.viewport-height > fli.height ? fli.viewport-height - fli.height : 0phx;
37 vertical-page-size: fli.height;
38
39 horizontal-max: fli.viewport-width > fli.width ? fli.viewport-width - fli.width : 0phx;
40 horizontal-page-size: fli.width;
41 }
42
43 fli := Flickable {
44 x: native.native-padding-left;
45 width: root.width - native.native-padding-left - native.native-padding-right;
46 y: native.native-padding-top + header-height;
47 height: root.height - self.y - native.native-padding-bottom;
48
49 @children
50 interactive: false;
51 viewport-y <=> native.vertical-value;
52 viewport-x <=> native.horizontal-value;
53 }
54}
55
56// This is an internal ListView, used by the StandardTableView. It needs to be
57// called "ListView", for the compiler to recognize it.
58export component ListView inherits InternalScrollView {
59 @children
60}
61