7#include "grid_layout.hpp"
8#include "box_constraints.hpp"
9#include "box_shape.hpp"
10#include "../geometry/geometry.hpp"
11#include "../macros.hpp"
15hi_export_module(hikogui.layout.row_column_layout);
17hi_export
namespace hi {
inline namespace v1 {
19template<axis Axis,
typename T>
22 static_assert(
Axis == axis::x
or Axis == axis::y);
26 using cell_type = grid_type::cell_type;
27 using iterator = grid_type::iterator;
28 using const_iterator = grid_type::const_iterator;
38 [[
nodiscard]]
constexpr bool empty()
const noexcept
43 [[
nodiscard]]
constexpr size_t size()
const noexcept
48 [[
nodiscard]]
constexpr iterator begin()
noexcept
53 [[
nodiscard]]
constexpr const_iterator begin()
const noexcept
58 [[
nodiscard]]
constexpr const_iterator cbegin()
const noexcept
60 return _grid.cbegin();
63 [[
nodiscard]]
constexpr iterator end()
noexcept
68 [[
nodiscard]]
constexpr const_iterator end()
const noexcept
73 [[
nodiscard]]
constexpr const_iterator cend()
const noexcept
78 [[
nodiscard]]
constexpr cell_type& operator[](
size_t index)
noexcept
84 [[
nodiscard]]
constexpr cell_type
const& operator[](
size_t index)
const noexcept
90 template<std::convertible_to<T> Value>
91 cell_type& insert(const_iterator
pos,
Value&& value)
noexcept
95 for (
auto it = begin() + index;
it != end(); ++
it) {
96 if constexpr (
Axis == axis::x) {
105 if constexpr (
Axis == axis::x) {
106 return _grid.
add_cell(index, 0, std::forward<Value>(value));
108 return _grid.
add_cell(0, index, std::forward<Value>(value));
112 template<std::convertible_to<T> Value>
113 cell_type& push_front(
Value&& value)
noexcept
115 return insert(cbegin(), std::forward<Value>(value));
118 template<std::convertible_to<T> Value>
119 cell_type& push_back(
Value&& value)
noexcept
121 return insert(cend(), std::forward<Value>(value));
124 void clear()
noexcept
126 return _grid.clear();
131 return _grid.constraints(left_to_right);
134 void set_layout(
box_shape const &shape,
float guideline)
noexcept
DOXYGEN BUG.
Definition algorithm_misc.hpp:20
The HikoGUI namespace.
Definition recursive_iterator.hpp:15
constexpr Out narrow_cast(In const &rhs) noexcept
Cast numeric values without loss of precision.
Definition cast.hpp:378
2D constraints.
Definition box_constraints.hpp:25
Definition box_shape.hpp:18
Grid layout algorithm.
Definition grid_layout.hpp:887
constexpr reference add_cell(size_t first_column, size_t first_row, size_t last_column, size_t last_row, Value &&value, bool beyond_maximum=false) noexcept
Check if the cell on the grid is already in use.
Definition grid_layout.hpp:1009
constexpr void set_layout(box_shape const &shape, float baseline_adjustment) noexcept
Layout the cells based on the width and height.
Definition grid_layout.hpp:1081
Definition row_column_layout.hpp:20