Unity 8
 All Classes Functions
ScopesOverviewTab.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.3
18 import Ubuntu.Components 0.1
19 
20 Item {
21  id: root
22 
23  property int currentTab: 0
24 
25  AbstractButton {
26  id: tab1
27  height: parent.height
28  width: parent.width / 2
29  Rectangle {
30  anchors.fill: parent
31  color: root.currentTab == 0 && root.enabled ? "white" : "transparent"
32  radius: units.dp(10)
33  }
34  Label {
35  anchors.centerIn: parent
36  text: i18n.tr("Favorites")
37  color: root.currentTab == 0 && root.enabled ? "black" : "white"
38  }
39  onClicked: root.currentTab = 0
40  }
41  AbstractButton {
42  id: tab2
43  objectName: "scopesOverviewAllTabButton"
44  x: width
45  height: parent.height
46  width: parent.width / 2
47  Rectangle {
48  anchors.fill: parent
49  color: root.currentTab == 1 && root.enabled ? "white" : "transparent"
50  radius: units.dp(10)
51  }
52  Label {
53  anchors.centerIn: parent
54  text: i18n.tr("All")
55  color: root.currentTab == 1 && root.enabled ? "black" : "white"
56  }
57  onClicked: root.currentTab = 1
58  }
59  Rectangle {
60  id: centerPiece
61  width: root.enabled ? units.dp(10) : units.dp(1)
62  height: parent.height
63  color: "white"
64  x: root.currentTab == 1 ? tab2.x : tab2.x - width
65  }
66  Rectangle {
67  id: border
68  anchors.fill: parent
69  radius: units.dp(10)
70  color: "transparent"
71  border.color: centerPiece.color
72  border.width: units.dp(1)
73  }
74 }