2 * Copyright (C) 2014 Canonical, Ltd.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 import Ubuntu.Components 0.1
19 import "../Components"
24 readonly property double collapseLimit: units.gu(35)
26 expandedHeight: Math.max(cardVerticalJournal.implicitHeight, minHeight)
27 collapsedHeight: Math.max(Math.min(collapseLimit, cardVerticalJournal.implicitHeight), minHeight)
28 // TODO: implement collapsedItemCount
30 // This minHeight is used as bootstrapper for the height. Vertical Journal
31 // is special by the fact that it doesn't know how to calculate its implicit height unless we give it
32 // enough height that it can start creating its children so we make sure it has enough height for that
33 // in case the model is non empty
34 readonly property double minHeight: root.model.count >= 1 ? cardVerticalJournal.rowSpacing + 1 : 0
36 ResponsiveVerticalJournal {
37 id: cardVerticalJournal
42 rowSpacing: minimumColumnSpacing
43 columnWidth: cardTool.cardWidth
45 displayMarginBeginning: root.displayMarginBeginning
46 displayMarginEnd: root.displayMarginEnd
50 sourceComponent: cardTool.cardComponent
51 width: cardTool.cardWidth
53 item.objectName = "delegate" + index;
54 item.fixedArtShapeSize = Qt.binding(function() { return cardTool.artShapeSize; });
55 item.fixedHeaderHeight = Qt.binding(function() { return cardTool.headerHeight; });
56 item.cardData = Qt.binding(function() { return model; });
57 item.template = Qt.binding(function() { return cardTool.template; });
58 item.components = Qt.binding(function() { return cardTool.components; });
59 item.headerAlignment = Qt.binding(function() { return cardTool.headerAlignment; });
60 item.scopeStyle = root.scopeStyle;
64 onClicked: root.clicked(index, result, loader.item, model)
65 onPressAndHold: root.pressAndHold(index, result, model)