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();
129 [[nodiscard]]
box_constraints constraints(
bool left_to_right)
const noexcept
131 return _grid.constraints(left_to_right);
134 void set_layout(
box_shape const &shape,
float guideline)
noexcept
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