1/*
2    SPDX-FileCopyrightText: 2016 Marco Martin <mart@kde.org>
3
4    SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7import QtQuick 2.6
8import QtQuick.Templates @QQC2_VERSION@ as T
9import org.kde.plasma.core 2.0 as PlasmaCore
10
11T.TabBar {
12    id: control
13
14    implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
15                            contentWidth + leftPadding + rightPadding)
16    implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
17                             contentHeight + topPadding + bottomPadding)
18
19    spacing: 0
20
21    contentItem: ListView {
22        implicitWidth: control.contentModel.count === 0 ? 0 : control.contentModel.get(0).implicitWidth * count + spacing * (count - 1)
23        implicitHeight: control.contentModel.count === 0 ? 0 : control.contentModel.get(0).implicitHeight
24
25        model: control.contentModel
26        currentIndex: control.currentIndex
27
28        spacing: control.spacing
29        orientation: ListView.Horizontal
30        boundsBehavior: Flickable.StopAtBounds
31        flickableDirection: Flickable.AutoFlickIfNeeded
32        snapMode: ListView.SnapToItem
33
34        highlightMoveDuration: PlasmaCore.Units.longDuration
35        highlightRangeMode: ListView.ApplyRange
36        preferredHighlightBegin: 40
37        preferredHighlightEnd: width - 40
38        highlightResizeDuration: 0
39        highlight: PlasmaCore.FrameSvgItem {
40            imagePath: "widgets/tabbar"
41            prefix: control.position == T.TabBar.Header ? "north-active-tab" : "south-active-tab"
42            colorGroup: PlasmaCore.ColorScope.colorGroup
43        }
44    }
45}
46