Introduces a new `WindowControls` component in the desktop top bar with minimize, maximize/restore, and close actions for the focused window. `WindowService` now exposes focused-window presence/maximized state plus focused-window convenience actions to support this UI. Also extends Nebula UI with a reusable `NebulaToolTip`, keyboard/pressed-state support in `NebulaIconButton`, new window-control glyphs in `NebulaIcon`, and theme tokens for pressed/danger hover states, with CMake and README updates to register/document the new components.
77 lines
2.0 KiB
QML
77 lines
2.0 KiB
QML
import QtQuick
|
|
import Nebula.UI
|
|
import Nebula.Windows
|
|
|
|
Item {
|
|
id: root
|
|
|
|
readonly property bool maximized: WindowService.focusedWindowMaximized
|
|
|
|
visible: WindowService.hasFocusedWindow
|
|
implicitWidth: well.implicitWidth
|
|
implicitHeight: Theme.controlHeight
|
|
width: visible ? implicitWidth : 0
|
|
Accessible.role: Accessible.Grouping
|
|
Accessible.name: qsTr("Window controls")
|
|
|
|
Rectangle {
|
|
id: well
|
|
anchors.fill: parent
|
|
implicitWidth: row.implicitWidth + 2
|
|
implicitHeight: Theme.controlHeight
|
|
radius: Theme.radiusSmall
|
|
color: Theme.iconWell
|
|
border.width: 1
|
|
border.color: Theme.border
|
|
|
|
Row {
|
|
id: row
|
|
anchors.centerIn: parent
|
|
spacing: 0
|
|
|
|
NebulaIconButton {
|
|
id: minimizeButton
|
|
width: 26
|
|
height: 26
|
|
label: qsTr("Minimise")
|
|
onClicked: WindowService.minimizeFocusedWindow()
|
|
|
|
NebulaIcon {
|
|
name: "minimize"
|
|
size: 14
|
|
color: minimizeButton.iconColor
|
|
}
|
|
}
|
|
|
|
NebulaIconButton {
|
|
id: maximizeButton
|
|
width: 26
|
|
height: 26
|
|
label: root.maximized ? qsTr("Restore") : qsTr("Maximise")
|
|
onClicked: WindowService.toggleMaximizeFocusedWindow()
|
|
|
|
NebulaIcon {
|
|
name: root.maximized ? "restore" : "maximize"
|
|
size: 14
|
|
color: maximizeButton.iconColor
|
|
}
|
|
}
|
|
|
|
NebulaIconButton {
|
|
id: closeButton
|
|
width: 26
|
|
height: 26
|
|
label: qsTr("Close")
|
|
danger: true
|
|
onClicked: WindowService.closeFocusedWindow()
|
|
|
|
NebulaIcon {
|
|
name: "close"
|
|
size: 14
|
|
color: closeButton.iconColor
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|