Lots of uncommitted changes
This commit is contained in:
parent
daace49bfc
commit
497ca48ada
27 changed files with 909 additions and 134 deletions
110
modules/user/modules/quickshell/shell/bar/systray/MenuItem.qml
Normal file
110
modules/user/modules/quickshell/shell/bar/systray/MenuItem.qml
Normal file
|
|
@ -0,0 +1,110 @@
|
|||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import Quickshell
|
||||
import Quickshell.DBusMenu
|
||||
import "../.."
|
||||
|
||||
MouseArea {
|
||||
id: root
|
||||
required property var entry;
|
||||
property alias expanded: childrenRevealer.expanded;
|
||||
property bool animating: childrenRevealer.animating || childrenList.animating;
|
||||
// appears it won't actually create the handler when only used from MenuItemList.
|
||||
onExpandedChanged: {}
|
||||
onAnimatingChanged: {}
|
||||
|
||||
signal close();
|
||||
|
||||
implicitWidth: row.implicitWidth + 4
|
||||
implicitHeight: row.implicitHeight + 4
|
||||
|
||||
hoverEnabled: true
|
||||
onClicked: {
|
||||
if (entry.hasChildren) childrenRevealer.expanded = !childrenRevealer.expanded
|
||||
else {
|
||||
entry.click();
|
||||
if (entry.toggleType == ToggleButtonType.None) close();
|
||||
}
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
id: row
|
||||
anchors.fill: parent
|
||||
anchors.margins: 2
|
||||
spacing: 0
|
||||
|
||||
RowLayout {
|
||||
Item {
|
||||
implicitWidth: 22
|
||||
implicitHeight: 22
|
||||
|
||||
MenuCheckBox {
|
||||
anchors.centerIn: parent
|
||||
visible: entry.toggleType == ToggleButtonType.CheckBox
|
||||
checkState: entry.checkState
|
||||
}
|
||||
|
||||
MenuRadioButton {
|
||||
anchors.centerIn: parent
|
||||
visible: entry.toggleType == ToggleButtonType.RadioButton
|
||||
checkState: entry.checkState
|
||||
}
|
||||
|
||||
MenuChildrenRevealer {
|
||||
id: childrenRevealer
|
||||
anchors.centerIn: parent
|
||||
visible: entry.hasChildren
|
||||
onOpenChanged: entry.showChildren = open
|
||||
}
|
||||
}
|
||||
|
||||
Text {
|
||||
text: entry.cleanLabel
|
||||
color: entry.enabled ? "white" : "#bbbbbb"
|
||||
}
|
||||
|
||||
Item {
|
||||
Layout.fillWidth: true
|
||||
implicitWidth: 22
|
||||
implicitHeight: 22
|
||||
|
||||
Image {
|
||||
anchors.right: parent.right
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
visible: entry.icon != ""
|
||||
source: entry.icon
|
||||
sourceSize.height: parent.height
|
||||
sourceSize.width: parent.height
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
Layout.fillWidth: true
|
||||
implicitHeight: childrenList.implicitHeight * childrenRevealer.progress
|
||||
clip: true
|
||||
|
||||
MenuItemList {
|
||||
id: childrenList
|
||||
items: entry.children
|
||||
onClose: root.close()
|
||||
|
||||
anchors {
|
||||
top: parent.top
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
visible: root.containsMouse || childrenRevealer.expanded
|
||||
|
||||
color: ShellGlobals.colors.widget
|
||||
border.width: 1
|
||||
border.color: ShellGlobals.colors.widgetOutline
|
||||
radius: 5
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue