displayLayout and Rendering TUI library | 
          
| git clone git://git.dimitrijedobrota.com/display.git | 
| Log | Files | Refs | README | LICENSE | HACKING | CONTRIBUTING | CODE_OF_CONDUCT | BUILDING | 
| commit | 7118c82d1addda5c08838c787928aa8be693894b | 
| parent | c75fd91937f8136b2880b26ca26bb995e73bdb59 | 
| author | Dimitrije Dobrota < mail@dimitrijedobrota.com > | 
| date | Tue, 4 Mar 2025 12:21:54 +0100 | 
Append is now emplace and is different from set
| M | example/example.cpp | | | +++++++++++++++++ ----------------- | 
| M | example/navig/navig.cpp | | | + - | 
| M | include/display/layout.hpp | | | ++++++++++ ---- | 
| M | include/display/layout_rigid.hpp | | | +++ --- | 
4 files changed, 31 insertions(+), 25 deletions(-)
diff --git a/ example/example.cpp b/ example/example.cpp
          @@ -42,15 +42,15 @@ 
          public:
        
        
            explicit LayoutCustom(plc_t aplc)
                : LayoutRigid(aplc, {{0, 1, 2}, {7, 8, 3}, {6, 5, 4}})
            {
              append().set_child(piv_t(PvtX::Left, PvtY::Top), dim_t(12, 4));
              append().set_child(piv_t(PvtX::Center, PvtY::Top), dim_t(12, 4));
              append().set_child(piv_t(PvtX::Right, PvtY::Top), dim_t(12, 4));
              append().set_child(piv_t(PvtX::Right, PvtY::Center), dim_t(12, 4));
              append().set_child(piv_t(PvtX::Right, PvtY::Bottom), dim_t(12, 4));
              append().set_child(piv_t(PvtX::Center, PvtY::Bottom), dim_t(12, 4));
              append().set_child(piv_t(PvtX::Left, PvtY::Bottom), dim_t(12, 4));
              append().set_child(piv_t(PvtX::Left, PvtY::Center), dim_t(12, 4));
              append().set_child(piv_t(PvtX::Center, PvtY::Center), dim_t(12, 4));
              emplace().emplace_child(piv_t(PvtX::Left, PvtY::Top), dim_t(12, 4));
              emplace().emplace_child(piv_t(PvtX::Center, PvtY::Top), dim_t(12, 4));
              emplace().emplace_child(piv_t(PvtX::Right, PvtY::Top), dim_t(12, 4));
              emplace().emplace_child(piv_t(PvtX::Right, PvtY::Center), dim_t(12, 4));
              emplace().emplace_child(piv_t(PvtX::Right, PvtY::Bottom), dim_t(12, 4));
              emplace().emplace_child(piv_t(PvtX::Center, PvtY::Bottom), dim_t(12, 4));
              emplace().emplace_child(piv_t(PvtX::Left, PvtY::Bottom), dim_t(12, 4));
              emplace().emplace_child(piv_t(PvtX::Left, PvtY::Center), dim_t(12, 4));
              emplace().emplace_child(piv_t(PvtX::Center, PvtY::Center), dim_t(12, 4));
            }
          };
          
          @@ -87,9 +87,9 @@ 
          public:
        
        
            }
            template<class... Args>
            LayoutCustom& append(Args&&... args)
            LayoutCustom& emplace(Args&&... args)
            {
              return LayoutMulti<LayoutCustom>::template append<LayoutCustom>(
              return LayoutMulti<LayoutCustom>::template emplace<LayoutCustom>(
                  place(size()), std::forward<Args>(args)...);
            }
          
          @@ -202,12 +202,12 @@ 
          int main()
        
        
              };
              // clang-format on
              auto& layout = display.layout().set_child<LayoutRigidBorder>(split);
              layout.append();
              layout.append();
              layout.append();
              layout.append();
              layout.append();
              auto& layout = display.layout().emplace_child<LayoutRigidBorder>(split);
              layout.emplace();
              layout.emplace();
              layout.emplace();
              layout.emplace();
              layout.emplace();
              display.render();
              while (true) {
        
        diff --git a/ example/navig/navig.cpp b/ example/navig/navig.cpp
          @@ -167,7 +167,7 @@ 
          int menu_t::visit(const menu_t& menu)
        
        
              stk.push(&menu);
            }
            layout.set_child<WindowCustom>(piv_t(PvtX::Right, PvtY::Bottom), *stk.top());
            layout.emplace_child<WindowCustom>(piv_t(PvtX::Right, PvtY::Bottom), *stk.top());
            layout.render();
            return 0;
        
        diff --git a/ include/display/layout.hpp b/ include/display/layout.hpp
          @@ -62,13 +62,19 @@ 
          public:
        
        
            template<typename M = T, class... Args>
              requires(std::is_base_of_v<T, M>)
            M& set_child(Args&&... args)
            M& emplace_child(Args&&... args)
            {
              clear();
              m_child = std::make_unique<M>(aplc(), std::forward<Args>(args)...);
              return get_child<M>();
            }
            void set_child(ptr_t&& child)
            {
              clear();
              m_child = std::move(child);
            }
            template<typename M = T>
              requires(std::is_base_of_v<T, M>)
            const M& get_child() const
        
        
          @@ -138,9 +144,9 @@ 
          public:
        
        
            template<typename M = T, class... Args>
              requires(std::is_base_of_v<T, M>)
            M& append(Args&&... args)
            M& emplace(Args&&... args)
            {
              return append<M>(aplc(), std::forward<Args>(args)...);
              return emplace<M>(aplc(), std::forward<Args>(args)...);
            }
            template<typename M = T>
        
        
          @@ -162,7 +168,7 @@ 
          public:
        
        
          protected:
            template<typename M = T, class... Args>
              requires(std::is_base_of_v<T, M>)
            M& append(plc_t aplc, Args&&... args)
            M& emplace(plc_t aplc, Args&&... args)
            {
              m_children.emplace_back(
                  std::make_unique<M>(aplc, std::forward<Args>(args)...));
        
        diff --git a/ include/display/layout_rigid.hpp b/ include/display/layout_rigid.hpp
          @@ -20,10 +20,10 @@ 
          public:
        
        
            template<typename M = T, class... Args>
              requires(std::is_base_of_v<T, M>)
            M& append(Args&&... args)
            M& emplace(Args&&... args)
            {
              return LayoutMulti<T>::template append<M>(place(this->size()),
                                                        std::forward<Args>(args)...);
              return LayoutMulti<T>::template emplace<M>(place(this->size()),
                                                         std::forward<Args>(args)...);
            }
            void resize(plc_t aplc) override