3#include "di/container/tree/tree_set.h"
4#include "di/reflect/prelude.h"
5#include "di/vocab/pointer/box.h"
19 dius::tty::WindowSize
size;
25 constexpr friend auto tag_invoke(di::Tag<di::reflect>, di::InPlaceType<LayoutEntry>) {
38 dius::tty::WindowSize
size;
50 constexpr friend auto tag_invoke(di::Tag<di::reflect>, di::InPlaceType<LayoutNode>) {
51 return di::make_fields<
"LayoutNode">(
76constexpr auto tag_invoke(di::Tag<di::reflect>, di::InPlaceType<ResizeDirection>) {
78 return di::make_enumerators<
"ResizeDirection">(di::enumerator<
"Left",
Left>, di::enumerator<
"Right",
Right>,
79 di::enumerator<
"Top",
Top>, di::enumerator<
"Bottom",
Bottom>);
88 constexpr auto empty() const ->
bool {
return m_children.empty(); }
89 constexpr auto single() const ->
bool {
return m_children.size() == 1; }
96 -> di::Tuple<di::Box<LayoutNode>, di::Optional<LayoutEntry&>, di::Optional<di::Box<Pane>&>>;
107 auto layout(dius::tty::WindowSize
const& size, u32 row_offset, u32 col_offset) -> di::Box<LayoutNode>;
112 void redistribute_space(di::Variant<di::Box<LayoutGroup>, di::Box<LayoutPane>>* new_child,
113 i64 original_size_available, i64 new_size_available);
114 void validate_layout();
116 di::Vector<di::Variant<di::Box<LayoutGroup>, di::Box<LayoutPane>>> m_children;
constexpr auto empty() const -> bool
Definition layout.h:88
auto resize(LayoutNode &root, Pane *pane, ResizeDirection direction, i32 amount_in_cells) -> bool
Definition layout.cpp:372
constexpr auto relative_size() -> i64 &
Definition layout.h:90
constexpr auto direction() const -> Direction
Definition layout.h:87
friend struct FindPaneInLayoutGroup
Definition layout.h:110
auto split(dius::tty::WindowSize const &size, u32 row_offset, u32 col_offset, Pane *reference, Direction direction) -> di::Tuple< di::Box< LayoutNode >, di::Optional< LayoutEntry & >, di::Optional< di::Box< Pane > & > >
Definition layout.cpp:205
auto remove_pane(Pane *pane) -> di::Box< Pane >
Definition layout.cpp:275
constexpr auto single() const -> bool
Definition layout.h:89
Definition test_layout.cpp:6
Definition cursor_style.h:5
Direction
Definition direction.h:7
@ None
Definition direction.h:8
@ Right
Definition key.h:70
@ Left
Definition key.h:69
constexpr auto tag_invoke(di::Tag< di::reflect >, di::InPlaceType< CursorStyle >)
Definition cursor_style.h:16
constexpr auto max_layout_precision
Definition layout.h:60
ResizeDirection
Definition layout.h:69
@ Bottom
Definition layout.h:73
@ Top
Definition layout.h:72
LayoutNode * parent
Definition layout.h:20
u32 row
Definition layout.h:17
auto operator==(LayoutEntry const &) const -> bool=default
Pane * pane
Definition layout.h:21
u32 col
Definition layout.h:18
constexpr friend auto tag_invoke(di::Tag< di::reflect >, di::InPlaceType< LayoutEntry >)
Definition layout.h:25
dius::tty::WindowSize size
Definition layout.h:19
Direction direction
Definition layout.h:42
auto hit_test_horizontal_line(u32 row, u32 col_start, u32 col_end) -> di::TreeSet< LayoutEntry * >
Definition layout.cpp:118
LayoutGroup * group
Definition layout.h:41
u32 row
Definition layout.h:36
dius::tty::WindowSize size
Definition layout.h:38
di::Vector< di::Variant< di::Box< LayoutNode >, LayoutEntry > > children
Definition layout.h:39
auto hit_test_vertical_line(u32 col, u32 row_start, u32 row_end) -> di::TreeSet< LayoutEntry * >
Definition layout.cpp:97
auto hit_test(u32 row, u32 col) -> di::Optional< LayoutEntry & >
Definition layout.cpp:73
LayoutNode * parent
Definition layout.h:40
constexpr friend auto tag_invoke(di::Tag< di::reflect >, di::InPlaceType< LayoutNode >)
Definition layout.h:50
u32 col
Definition layout.h:37
auto find_pane(Pane *pane) -> di::Optional< LayoutEntry & >
Definition layout.cpp:53
i64 relative_size
Definition layout.h:66
di::Box< Pane > pane
Definition layout.h:65