summaryrefslogtreecommitdiff
path: root/components/controls/IconButton.qml
diff options
context:
space:
mode:
author2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-09-15 21:55:10 +1000
committer2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-09-15 21:55:10 +1000
commit7a9fce9dd417db42d75dc80a86df45ed0402d6d4 (patch)
tree1a3671200433275f017073e70e895971bfd94951 /components/controls/IconButton.qml
parentutilities/record: select mode (diff)
downloadcaelestia-shell-7a9fce9dd417db42d75dc80a86df45ed0402d6d4.tar.gz
caelestia-shell-7a9fce9dd417db42d75dc80a86df45ed0402d6d4.tar.bz2
caelestia-shell-7a9fce9dd417db42d75dc80a86df45ed0402d6d4.zip
utilities/record: allow pause/resume recording
Diffstat (limited to 'components/controls/IconButton.qml')
-rw-r--r--components/controls/IconButton.qml27
1 files changed, 17 insertions, 10 deletions
diff --git a/components/controls/IconButton.qml b/components/controls/IconButton.qml
index 0b39d97..6e55064 100644
--- a/components/controls/IconButton.qml
+++ b/components/controls/IconButton.qml
@@ -15,7 +15,7 @@ StyledRect {
property alias icon: label.text
property bool checked
property bool toggle
- property real padding: type == IconButton.Text ? Appearance.padding.small / 2 : Appearance.padding.smaller
+ property real padding: type === IconButton.Text ? Appearance.padding.small / 2 : Appearance.padding.smaller
property alias font: label.font
property int type: IconButton.Filled
@@ -23,18 +23,25 @@ StyledRect {
property alias label: label
property bool internalChecked
- property color activeColour: type == IconButton.Filled ? Colours.palette.m3primary : Colours.palette.m3secondary
- property color inactiveColour: type == IconButton.Filled ? Colours.palette.m3surfaceContainer : Colours.palette.m3secondaryContainer
- property color activeOnColour: type == IconButton.Filled ? Colours.palette.m3onPrimary : Colours.palette.m3onSecondary
- property color inactiveOnColour: type == IconButton.Filled ? Colours.palette.m3onSurface : Colours.palette.m3onSecondaryContainer
-
- function onClicked(): void {
+ property color activeColour: type === IconButton.Filled ? Colours.palette.m3primary : Colours.palette.m3secondary
+ property color inactiveColour: {
+ if (!toggle && type === IconButton.Filled)
+ return Colours.palette.m3primary;
+ return type === IconButton.Filled ? Colours.palette.m3surfaceContainer : Colours.palette.m3secondaryContainer;
+ }
+ property color activeOnColour: type === IconButton.Filled ? Colours.palette.m3onPrimary : Colours.palette.m3onSecondary
+ property color inactiveOnColour: {
+ if (!toggle && type === IconButton.Filled)
+ return Colours.palette.m3onPrimary;
+ return type === IconButton.Filled ? Colours.palette.m3onSurfaceVariant : Colours.palette.m3onSecondaryContainer;
}
+ signal clicked
+
onCheckedChanged: internalChecked = checked
radius: internalChecked ? Appearance.rounding.small : implicitHeight / 2
- color: type == IconButton.Text ? "transparent" : internalChecked ? activeColour : inactiveColour
+ color: type === IconButton.Text ? "transparent" : internalChecked ? activeColour : inactiveColour
implicitWidth: implicitHeight
implicitHeight: label.implicitHeight + padding * 2
@@ -47,7 +54,7 @@ StyledRect {
function onClicked(): void {
if (root.toggle)
root.internalChecked = !root.internalChecked;
- root.onClicked();
+ root.clicked();
}
}
@@ -56,7 +63,7 @@ StyledRect {
anchors.centerIn: parent
color: root.internalChecked ? root.activeOnColour : root.inactiveOnColour
- fill: root.internalChecked ? 1 : 0
+ fill: !root.toggle || root.internalChecked ? 1 : 0
Behavior on fill {
Anim {}