@@ -0,0 +1,54 @@
1+/*
2+ * Copyright (C) 2014 Canonical, Ltd.
3+ *
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.
7+ *
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.
12+ *
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/>.
15+ */
16+
17+import QtQuick 2.0
18+
19+ListView {
20+ id: root
21+
22+ signal clicked(int index, var result)
23+
24+ property var cardTool: null
25+ property real scopeHeight: 0
26+ property real scopeWidth: 0
27+
28+ orientation: ListView.Horizontal
29+ // TODO root.parent.scale
30+ // TODO current item
31+
32+ spacing: units.gu(2) / root.parent.scale
33+
34+ delegate: Loader {
35+ id: loader
36+
37+
38+ sourceComponent: cardTool.cardComponent
39+ onLoaded: {
40+ item.fixedHeaderHeight = Qt.binding(function() { return cardTool.headerHeight / root.parent.scale; });
41+ item.fontScale = Qt.binding(function() { return 1 / root.parent.scale; });
42+ item.height = Qt.binding(function() { return root.scopeHeight; });
43+ item.width = Qt.binding(function() { return root.scopeWidth; });
44+ item.cardData = Qt.binding(function() { return model; });
45+ item.template = Qt.binding(function() { return cardTool.template; });
46+ item.components = Qt.binding(function() { return cardTool.components; });
47+ }
48+
49+ Connections {
50+ target: loader.item
51+ onClicked: root.clicked(index, result)
52+ }
53+ }
54+}