morph 0.1.0
Asynchronous bridge between GUI thread and business models
Loading...
Searching...
No Matches
alignment.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: Apache-2.0
2#pragma once
3
4#include <cstdint>
5
6/// @file
7/// @brief `morph::ui::Align` and `morph::ui::Justify`: where a container places its children across its axis and
8/// along it. The view tree, the authoring API and the backends share them. Specified in
9/// `docs/spec/ui/backend_contract.md`, "The cross axis".
10
11namespace morph::ui {
12
13/// @brief Where a child is placed across its container's axis: a column's horizontally, a row's vertically, a
14/// grid cell's content vertically in its row.
15enum class Align : std::uint8_t {
16 Stretch, ///< A content child fills the cross extent; one its maximum stops sits at the start.
17 Start, ///< At the start: left in a column, top in a row or grid.
18 Center, ///< Centred.
19 End, ///< At the end: right in a column, bottom in a row or grid.
20};
21
22/// @brief Where a stack places its spare length along its axis, while no shown child stretches.
23enum class Justify : std::uint8_t {
24 Start, ///< Packed at the start.
25 Center, ///< Packed in the middle.
26 End, ///< Packed at the end.
27 Between, ///< In equal gaps between the children, never less than the stack's gap.
28};
29
30} // namespace morph::ui
Justify
Where a stack places its spare length along its axis, while no shown child stretches.
Definition alignment.hpp:23
@ Between
In equal gaps between the children, never less than the stack's gap.
Definition alignment.hpp:27
Align
Where a child is placed across its container's axis: a column's horizontally, a row's vertically,...
Definition alignment.hpp:15
@ Center
Centred.
Definition alignment.hpp:18
@ End
At the end: right in a column, bottom in a row or grid.
Definition alignment.hpp:19
@ Start
At the start: left in a column, top in a row or grid.
Definition alignment.hpp:17
@ Stretch
A content child fills the cross extent; one its maximum stops sits at the start.
Definition alignment.hpp:16