HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Friends
hi::v1::grid_layout< T > Class Template Reference

#include <hikogui/layout/grid_layout.hpp>

Public Types

using value_type = T
 
using cell_type = detail::grid_layout_cell<value_type>
 
using cell_vector = std::vector<cell_type>
 
using iterator = cell_vector::iterator
 
using const_iterator = cell_vector::const_iterator
 
using reference = cell_vector::reference
 
using const_reference = cell_vector::const_reference
 

Public Member Functions

constexpr grid_layout (grid_layout const &) noexcept=default
 
constexpr grid_layout (grid_layout &&) noexcept=default
 
constexpr grid_layoutoperator= (grid_layout const &) noexcept=default
 
constexpr grid_layoutoperator= (grid_layout &&) noexcept=default
 
constexpr bool empty () const noexcept
 
constexpr size_t size () const noexcept
 
constexpr size_t num_columns () const noexcept
 
constexpr size_t num_rows () const noexcept
 
constexpr iterator begin () noexcept
 
constexpr iterator end () noexcept
 
constexpr const_iterator begin () const noexcept
 
constexpr const_iterator end () const noexcept
 
constexpr const_iterator cbegin () const noexcept
 
constexpr const_iterator cend () const noexcept
 
constexpr const_reference operator[] (size_t i) const noexcept
 
constexpr reference operator[] (size_t i) noexcept
 
constexpr bool cell_in_use (size_t first_column, size_t first_row, size_t last_column, size_t last_row) noexcept
 Check if the cell on the grid is already in use.
 
template<forward_of< value_type > Value>
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.
 
template<forward_of< value_type > Value>
constexpr reference add_cell (size_t column, size_t row, Value &&value, bool beyond_maximum=false) noexcept
 Check if the cell on the grid is already in use.
 
constexpr void clear () noexcept
 
constexpr box_constraints constraints (bool left_to_right) const noexcept
 
constexpr void set_layout (box_shape const &shape, float baseline_adjustment) noexcept
 Layout the cells based on the width and height.
 

Friends

constexpr friend bool operator== (grid_layout const &, grid_layout const &) noexcept=default
 

Detailed Description

template<typename T>
class hi::v1::grid_layout< T >

Grid layout algorithm.

Member Function Documentation

◆ add_cell() [1/2]

template<typename T >
template<forward_of< value_type > Value>
constexpr reference hi::v1::grid_layout< T >::add_cell ( size_t column,
size_t row,
Value && value,
bool beyond_maximum = false )
inlineconstexprnoexcept

Check if the cell on the grid is already in use.

Parameters
columnThe column of the cell.
rowThe row of the cell.
valueThe value to be copied or moved into the cell.
beyond_maximumAllow this cell to resize beyond the maximum constraint.
Returns
A reference to the created cell.

◆ add_cell() [2/2]

template<typename T >
template<forward_of< value_type > Value>
constexpr reference hi::v1::grid_layout< T >::add_cell ( size_t first_column,
size_t first_row,
size_t last_column,
size_t last_row,
Value && value,
bool beyond_maximum = false )
inlineconstexprnoexcept

Check if the cell on the grid is already in use.

Parameters
first_columnThe first column of the cell-span.
last_columnOne beyond the last column of the cell-span.
first_rowThe first row of the cell-span.
last_rowOne beyond the last row of the cell-span.
valueThe value to be copied or moved into the cell.
beyond_maximumAllow this cell to resize beyond the maximum constraint.
Returns
A reference to the created cell.

◆ cell_in_use()

template<typename T >
constexpr bool hi::v1::grid_layout< T >::cell_in_use ( size_t first_column,
size_t first_row,
size_t last_column,
size_t last_row )
inlineconstexprnoexcept

Check if the cell on the grid is already in use.

Parameters
first_columnThe first column of the cell-span.
first_rowThe first row of the cell-span.
last_columnOne beyond the last column of the cell-span.
last_rowOne beyond the last row of the cell-span.
Return values
trueIf the given cell-span overlaps with an already existing cell.

◆ set_layout()

template<typename T >
constexpr void hi::v1::grid_layout< T >::set_layout ( box_shape const & shape,
float baseline_adjustment )
inlineconstexprnoexcept

Layout the cells based on the width and height.

Parameters
shapeThe shape of the box to place the grid in.
baseline_adjustmentHow much the baseline needs to be adjusted when aligned to the top.

The documentation for this class was generated from the following file: