Phosphor
Qt6 / Wayland library suite for window-management tools
 
Loading...
Searching...
No Matches
DirectionalNeighbor.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2026 fuddlesworth
2// SPDX-License-Identifier: LGPL-2.1-or-later
3
4#pragma once
5
6#include "phosphorgeometry_export.h"
7
8#include <QList>
9#include <QRectF>
10#include <QStringView>
11
12#include <optional>
13
15
17enum class Direction {
18 Left,
19 Right,
20 Up,
21 Down
22};
23
27PHOSPHORGEOMETRY_EXPORT std::optional<Direction> directionFromString(QStringView token);
28
64PHOSPHORGEOMETRY_EXPORT int directionalNeighbor(const QRectF& focus, const QList<QRectF>& candidates,
65 Direction direction, bool requireOverlap = false);
66
85PHOSPHORGEOMETRY_EXPORT int neighborDesktopInDirection(int currentDesktop, int desktopCount, int rows,
86 Direction direction);
87
88} // namespace PhosphorGeometry
Definition DirectionalNeighbor.h:14
PHOSPHORGEOMETRY_EXPORT int directionalNeighbor(const QRectF &focus, const QList< QRectF > &candidates, Direction direction, bool requireOverlap=false)
Pick the spatial neighbour of focus among candidates in direction.
Direction
Cardinal navigation direction in screen space (y grows downward).
Definition DirectionalNeighbor.h:17
PHOSPHORGEOMETRY_EXPORT std::optional< Direction > directionFromString(QStringView token)
Parse a lower-case direction token ("left"/"right"/"up"/"down") into a Direction.
PHOSPHORGEOMETRY_EXPORT int neighborDesktopInDirection(int currentDesktop, int desktopCount, int rows, Direction direction)
The virtual desktop reached by stepping direction from currentDesktop on a rows-high desktop grid.