2
* Copyright 2015 Canonical Ltd.
4
* This file is part of webbrowser-app.
6
* webbrowser-app is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; version 3.
10
* webbrowser-app is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this program. If not, see <http://www.gnu.org/licenses/>.
20
import Ubuntu.Components 1.3
26
property bool incognito: false
27
property bool active: false
28
property bool hoverable: true
29
property int rightMargin: tabImage.anchors.rightMargin
31
property alias title: label.text
32
property alias icon: favicon.source
40
anchors.rightMargin: tabItem.rightMargin
41
source: "assets/tab-%1%2.sci".arg((active) ? "active" :
42
(hoverArea.containsMouse ? "hover" : "non-active"))
43
.arg(formFactor == "desktop" ? "-desktop" : "")
47
anchors.verticalCenter: parent.verticalCenter
48
anchors.left: parent.left
49
anchors.leftMargin: units.gu(2)
50
shouldCache: !incognito
54
anchors.left: favicon.right
55
anchors.leftMargin: units.gu(1)
56
anchors.top: parent.top
57
anchors.bottom: parent.bottom
58
anchors.right: closeButton.left
59
anchors.rightMargin: units.gu(1)
64
verticalAlignment: Text.AlignVCenter
70
anchors.centerIn: parent
71
width: label.paintedHeight
72
height: label.width + units.gu(0.25)
77
color: active ? "#f8f8f8" :
78
(hoverArea.containsMouse ? "#cecece" : "#dedede")
80
GradientStop { position: 0.33; color: "transparent" }
86
anchors.left: parent.left
87
anchors.top: parent.top
88
anchors.bottom: parent.bottom
89
anchors.right: closeButton.left
90
onClicked: tabItem.selected()
95
objectName: "closeButton"
97
anchors.top: parent.top
98
anchors.bottom: parent.bottom
99
anchors.right: parent.right
103
height: units.gu(1.5)
105
anchors.right: parent.right
106
anchors.rightMargin: units.gu(1)
107
anchors.verticalCenter: parent.verticalCenter
111
onTriggered: closed()
117
hoverEnabled: !tabItem.active && tabItem.hoverable
118
propagateComposedEvents: true
119
acceptedButtons: Qt.MiddleButton
120
onClicked: tabItem.closed()