Add focused window controls to top bar
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.
This commit is contained in:
@@ -7,6 +7,7 @@ Item {
|
||||
property bool active: false
|
||||
property bool danger: false
|
||||
readonly property bool hovered: hover.containsMouse
|
||||
readonly property bool pressed: hover.pressed
|
||||
readonly property color iconColor: {
|
||||
if (danger && hovered)
|
||||
return Theme.danger
|
||||
@@ -23,16 +24,32 @@ Item {
|
||||
|
||||
implicitWidth: Theme.controlHeight
|
||||
implicitHeight: Theme.controlHeight
|
||||
activeFocusOnTab: true
|
||||
Accessible.role: Accessible.Button
|
||||
Accessible.name: root.label
|
||||
Accessible.onPressAction: root.clicked()
|
||||
|
||||
Keys.onReturnPressed: {
|
||||
event.accepted = true
|
||||
root.clicked()
|
||||
}
|
||||
Keys.onSpacePressed: {
|
||||
event.accepted = true
|
||||
root.clicked()
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
radius: Theme.radiusSmall
|
||||
color: {
|
||||
if (root.danger && hover.pressed)
|
||||
return Theme.dangerSoftStrong
|
||||
if (root.danger && hover.containsMouse)
|
||||
return Theme.dangerSoft
|
||||
if (root.active)
|
||||
return Theme.accentSoft
|
||||
if (hover.pressed)
|
||||
return Theme.pressedFill
|
||||
if (hover.containsMouse)
|
||||
return Theme.hoverFill
|
||||
return "transparent"
|
||||
@@ -63,4 +80,9 @@ Item {
|
||||
FocusFrame {
|
||||
radius: Theme.radiusSmall
|
||||
}
|
||||
|
||||
NebulaToolTip {
|
||||
text: root.label
|
||||
active: hover.containsMouse && !hover.pressed && root.label.length > 0
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user