display

Layout and Rendering TUI library
git clone git://git.dimitrijedobrota.com/display.git
Log | Files | Refs | README | LICENSE | HACKING | CONTRIBUTING | CODE_OF_CONDUCT | BUILDING

commitc75fd91937f8136b2880b26ca26bb995e73bdb59
parente5755709f2019a6848d826b8d015df83391fddb8
authorDimitrije Dobrota <mail@dimitrijedobrota.com>
dateMon, 3 Mar 2025 18:25:54 +0100

Allow for transfer of the child in Layout

Diffstat:
Minclude/display/layout.hpp|+++++++++++

1 files changed, 11 insertions(+), 0 deletions(-)


diff --git a/include/display/layout.hpp b/include/display/layout.hpp

@@ -21,6 +21,15 @@ public:

{
}
Layout(plc_t aplc, ptr_t&& child)
: Element(aplc)
, m_child(std::move(child))
{
if (has_child()) {
m_child->resize(aplc);
}
}
void resize(plc_t aplc) override
{
Element::resize(aplc);

@@ -74,6 +83,8 @@ public:

return *dynamic_cast<M*>(m_child.get());
}
ptr_t&& release_child() { return std::move(m_child); }
bool has_child() const { return m_child != nullptr; }
private: