Unity 8
DashNavigationHeader.qml
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.4
18 import Ubuntu.Components 1.3
19 import Ubuntu.Components.ListItems 1.3 as ListItem
20 
21 Row {
22  id: root
23 
24  property alias backVisible: backImageItem.visible
25  property alias textEnabled: textItem.enabled
26  property alias text: textLabel.text
27 
28  readonly property alias backButtonWidth: backImageItem.width
29 
30  signal backClicked()
31  signal textClicked()
32 
33  ListItem.Standard {
34  id: backImageItem
35  objectName: "backButton"
36  height: parent.height
37  width: height
38  showDivider: false
39 
40  Icon {
41  id: backImage
42  anchors.centerIn: parent
43  name: "back"
44  height: units.gu(2)
45  width: height
46  }
47 
48  onClicked: root.backClicked();
49  }
50 
51  ListItem.Standard {
52  id: textItem
53  height: parent.height
54  showDivider: false
55 
56  Label {
57  id: textLabel
58  anchors {
59  verticalCenter: parent.verticalCenter
60  left: parent.left
61  right: parent.right
62  leftMargin: backImageItem.visible ? 0 : units.gu(2)
63  rightMargin: units.gu(2)
64  }
65  color: "#5D5D5D"
66  wrapMode: Text.Wrap
67  maximumLineCount: 2
68  elide: Text.ElideMiddle
69  }
70 
71  onClicked: root.textClicked();
72  }
73 }