aboutsummaryrefslogtreecommitdiffstats
path: root/appearance/Tab.qml
diff options
context:
space:
mode:
Diffstat (limited to 'appearance/Tab.qml')
-rw-r--r--appearance/Tab.qml45
1 files changed, 45 insertions, 0 deletions
diff --git a/appearance/Tab.qml b/appearance/Tab.qml
new file mode 100644
index 0000000..bb2d210
--- /dev/null
+++ b/appearance/Tab.qml
@@ -0,0 +1,45 @@
+// Copyright (C) 2026 Danilo M. <danix@danix.xyz>
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License version 2 as
+// published by the Free Software Foundation.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+import QtQuick
+
+Rectangle {
+ id: tab
+ property alias text: label.text
+ property bool selected: false
+ property bool enabled: true
+ signal clicked
+
+ implicitWidth: label.implicitWidth + 24
+ implicitHeight: label.implicitHeight + 14
+ radius: 7
+ opacity: enabled ? 1 : 0.4
+ color: selected ? Qt.alpha(Theme.accent, 0.25)
+ : area.containsMouse ? Qt.alpha(Theme.surface, 0.8)
+ : Qt.alpha(Theme.surface, 0.35)
+ border.width: 1
+ border.color: selected ? Qt.alpha(Theme.accent, 0.5) : "transparent"
+
+ Text {
+ id: label
+ anchors.centerIn: parent
+ font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 2 }
+ color: tab.selected ? Theme.text : Theme.subtext
+ }
+
+ MouseArea {
+ id: area
+ anchors.fill: parent
+ hoverEnabled: true
+ cursorShape: tab.enabled ? Qt.PointingHandCursor : Qt.ArrowCursor
+ onClicked: if (tab.enabled) tab.clicked()
+ }
+}