2 * Copyright (C) 2014,2015 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 1.3
19 import Ubuntu.Components.ListItems 1.3 as ListItem
20 import "../Components"
24 property var navigation: null
25 property var currentNavigation: null
26 property var scopeStyle: null
27 property color foregroundColor: theme.palette.normal.baseText
28 signal enterNavigation(var newNavigationId, bool hasChildren)
29 signal goBackToParentClicked()
30 signal allNavigationClicked()
32 readonly property int itemHeight: units.gu(5)
33 implicitHeight: flickable.contentHeight
36 style: root.scopeStyle ? root.scopeStyle.navigationBackground : "color:///#f5f5f5"
43 UbuntuNumberAnimation {
45 duration: UbuntuAnimation.SnapDuration
54 flickableDirection: Flickable.VerticalFlick
55 contentHeight: column.height
64 objectName: "backButton"
65 visible: navigation && !navigation.isRoot || false
68 onClicked: root.goBackToParentClicked();
73 verticalCenter: parent.verticalCenter
75 leftMargin: units.gu(2)
80 color: root.foregroundColor
85 verticalCenter: parent.verticalCenter
88 leftMargin: units.gu(0.5)
89 rightMargin: units.gu(2)
91 text: navigation ? navigation.parentLabel : ""
92 color: root.foregroundColor
95 elide: Text.ElideMiddle
101 objectName: "allButton"
102 visible: navigation && (!navigation.isRoot || (!navigation.hidden && root.currentNavigation && !root.currentNavigation.isRoot && root.currentNavigation.parentNavigationId == navigation.navigationId)) || false
107 verticalCenter: parent.verticalCenter
110 leftMargin: units.gu(2)
111 rightMargin: units.gu(2)
113 text: navigation ? (navigation.allLabel != "" ? navigation.allLabel : navigation.label) : ""
115 color: root.foregroundColor
118 elide: Text.ElideMiddle
121 onClicked: root.allNavigationClicked();
125 model: navigation && navigation.loaded ? navigation : null
127 delegate: ListItem.Standard {
128 objectName: root.objectName + "child" + index
129 height: root.itemHeight
130 showDivider: index != navigation.count - 1
133 onClicked: root.enterNavigation(navigationId, hasChildren)
137 verticalCenter: parent.verticalCenter
139 leftMargin: units.gu(2)
140 right: rightIcon.visible ? rightIcon.left : parent.right
141 rightMargin: rightIcon.visible ? units.gu(0.5) : units.gu(2)
144 color: root.foregroundColor
147 elide: Text.ElideMiddle
153 verticalCenter: parent.verticalCenter
155 rightMargin: units.gu(2)
159 name: hasChildren ? "go-next" : "tick"
160 color: root.foregroundColor
161 visible: hasChildren || isActive