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 | 611e9210048044f9f9369fbafeb4d284fdae5fff | 
| parent | de1902c7b94dae6042963b6eee1bb79dd9a3f891 | 
| author | Dimitrije Dobrota < mail@dimitrijedobrota.com > | 
| date | Wed, 19 Feb 2025 10:32:48 +0100 | 
Don't enforce place implementation in LayoutMulti
| M | CMakeLists.txt | | | + - | 
| M | example/navig/navig.cpp | | | + - | 
| M | include/display/layout.hpp | | | ++++++++++++ ------ | 
| M | include/display/layout_rigid.hpp | | | ++++++++++++++++++ - | 
| M | source/window.cpp | | | + - | 
5 files changed, 33 insertions(+), 10 deletions(-)
diff --git a/ CMakeLists.txt b/ CMakeLists.txt
          @@ -4,7 +4,7 @@ 
          include(cmake/prelude.cmake)
        
        
          project(
              display
              VERSION 0.1.32
              VERSION 0.1.33
              DESCRIPTION "TUI library"
              HOMEPAGE_URL "git://git.dimitrijedobrota.com/display.git"
              LANGUAGES CXX
        
        diff --git a/ example/navig/navig.cpp b/ example/navig/navig.cpp
          @@ -47,7 +47,7 @@ 
          public:
        
        
              }
              WindowPivot::render();
              Window::render_border();
              WindowPivot::render_border();
              std::cout << alec::background_v<alec::Color::DEFAULT>;
              std::cout << std::flush;
        
        diff --git a/ include/display/layout.hpp b/ include/display/layout.hpp
          @@ -99,7 +99,7 @@ 
          public:
        
        
              Element::resize(aplc);
              for (std::size_t i = 0; i < size(); i++) {
                m_children[i]->resize(place(i));
                m_children[i]->resize(aplc);
              }
            }
          
          @@ -128,9 +128,7 @@ 
          public:
        
        
              requires(std::is_base_of_v<T, M>)
            M& append(Args&&... args)
            {
              m_children.emplace_back(std::make_unique<M>(place(m_children.size()),
                                                          std::forward<Args>(args)...));
              return get<M>(m_children.size() - 1);
              return append<M>(aplc(), std::forward<Args>(args)...);
            }
            template<typename M = T>
        
        
          @@ -149,9 +147,17 @@ 
          public:
        
        
            std::size_t size() { return m_children.size(); }
          private:
            virtual place_t place(std::size_t /* unused */) const { return aplc(); }
          protected:
            template<typename M = T, class... Args>
              requires(std::is_base_of_v<T, M>)
            M& append(place_t aplc, Args&&... args)
            {
              m_children.emplace_back(
                  std::make_unique<M>(aplc, std::forward<Args>(args)...));
              return get<M>(m_children.size() - 1);
            }
          private:
            std::vector<ptr_t> m_children;
          };
          diff --git a/ include/display/layout_rigid.hpp b/ include/display/layout_rigid.hpp
          @@ -18,10 +18,27 @@ 
          public:
        
        
            LayoutRigid(place_t aplc, layout_t layout);
            template<typename M = T, class... Args>
              requires(std::is_base_of_v<T, M>)
            M& append(Args&&... args)
            {
              return LayoutMulti<T>::template append<M>(place(this->size()),
                                                        std::forward<Args>(args)...);
            }
            void resize(place_t aplc) override
            {
              LayoutMulti<T>::resize(aplc);
              for (std::size_t i = 0; i < this->size(); i++) {
                this->get(i).resize(place(i));
              }
            }
          private:
            std::size_t count_and_pad(layout_t& layout) const;
            place_t place(std::size_t idx) const override
            place_t place(std::size_t idx) const
            {
              const auto [m, n] = m_grid;
              const auto [w, h] = this->adim();
        
        diff --git a/ source/window.cpp b/ source/window.cpp
          @@ -15,7 +15,7 @@ 
          void Window::render() const
        
        
              set_cursor(i, axpos()) << space;
            }
            for (sz_t i = aypos() + ahgt() - m_padd.bottom; i < aypos() + ahgt(); i++) {
            for (sz_t i = m_ypos; i < aypos() + ahgt(); i++) {
              set_cursor(i, axpos()) << space;
            }
          }