Phosphor
Qt6 / Wayland library suite for window-management tools
 
Loading...
Searching...
No Matches
ScrollAxisEnum.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
6namespace PhosphorProtocol {
7
29enum class ScrollAxis : int {
30 Horizontal = 0,
31 Vertical = 1,
32};
33
36inline constexpr int scrollAxisMinValue = static_cast<int>(ScrollAxis::Horizontal);
37inline constexpr int scrollAxisMaxValue = static_cast<int>(ScrollAxis::Vertical);
38
40inline constexpr bool isValidScrollAxis(int value)
41{
42 return value >= scrollAxisMinValue && value <= scrollAxisMaxValue;
43}
44
48inline constexpr ScrollAxis scrollAxisFromInt(int value)
49{
50 return isValidScrollAxis(value) ? static_cast<ScrollAxis>(value) : ScrollAxis::Horizontal;
51}
52
67inline constexpr ScrollAxis autoScrollAxisFor(int workAreaWidth, int workAreaHeight)
68{
69 return workAreaHeight > workAreaWidth ? ScrollAxis::Vertical : ScrollAxis::Horizontal;
70}
71
72} // namespace PhosphorProtocol
D-Bus marshalling for the shared tiling-family value types (see AutotileTypes.h; the file names preda...
Definition AutotileMarshalling.h:19
constexpr int scrollAxisMaxValue
Definition ScrollAxisEnum.h:37
constexpr ScrollAxis autoScrollAxisFor(int workAreaWidth, int workAreaHeight)
The Auto rule, resolving a work area's dimensions to a strip axis: a work area taller than it is wide...
Definition ScrollAxisEnum.h:67
constexpr ScrollAxis scrollAxisFromInt(int value)
Cast an int that crossed a process boundary to a ScrollAxis; out-of-range values (version skew,...
Definition ScrollAxisEnum.h:48
constexpr int scrollAxisMinValue
Inclusive bounds of the valid ScrollAxis underlying values — used to range-check an int that crossed ...
Definition ScrollAxisEnum.h:36
ScrollAxis
Which way a scrolling strip runs on one screen.
Definition ScrollAxisEnum.h:29
constexpr bool isValidScrollAxis(int value)
True if value is a valid ScrollAxis underlying value.
Definition ScrollAxisEnum.h:40