2 * Copyright (C) 2016 Canonical Ltd.
3 * Copyright (C) 2020 UBports Foundation
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; version 3.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19import Lomiri.Components 1.3
25 property int delegateWidth: units.gu(11)
26 property int delegateHeight: units.gu(11)
27 property alias delegate: gridView.delegate
28 property alias model: gridView.model
29 property alias interactive: gridView.interactive
30 property alias currentIndex: gridView.currentIndex
31 property alias draggingVertically: gridView.draggingVertically
33 property alias header: gridView.header
34 property alias topMargin: gridView.topMargin
35 property alias bottomMargin: gridView.bottomMargin
37 readonly property int columns: Math.floor(width / delegateWidth)
38 readonly property int rows: Math.ceil(gridView.model.count / root.columns)
40 property alias refreshing: pullToRefresh.refreshing
46 anchors.topMargin: units.gu(2)
49 readonly property int overflow: width - (root.columns * root.delegateWidth)
50 readonly property real spacing: Math.floor(overflow / root.columns)
52 cellWidth: root.delegateWidth + spacing
53 cellHeight: root.delegateHeight
60 readonly property real contentY: gridView.contentY - gridView.originY
61 y: -contentY - units.gu(5)
63 readonly property color pullLabelColor: "white"
64 style: PullToRefreshScopeStyle {
65 activationThreshold: Math.min(units.gu(14), gridView.height / 5)
68 onRefresh: root.refresh();
82 function getFirstAppId() {
83 return model.appId(0);