displayLayout and Rendering TUI library | 
          
| git clone git://git.dimitrijedobrota.com/display.git | 
| Log | Files | Refs | README | LICENSE | HACKING | CONTRIBUTING | CODE_OF_CONDUCT | BUILDING | 
element.cpp (1167B)
    0 #include <iostream>
          
              2 #include "display/element.hpp"
          
              4 namespace display
              5 {
          
              7 std::ostream& Element::set_cursor(xpos_t xapos, ypos_t yapos)
              8 {
              9   return std::cout << alec::cursor_position(yapos.value() + 1,
             10                                             xapos.value() + 1);
             11 }
          
             13 std::ostream& Element::set_cursor(pos_t apos)
             14 {
             15   return set_cursor(apos.x, apos.y);
             16 }
          
             18 void Element::clear() const
             19 {
             20   std::cout << alec::background_v<alec::Color::DEFAULT>;
             21   std::cout << alec::foreground_v<alec::Color::DEFAULT>;
          
             23   for (auto j = ypos_t(0); j < aypos() + ahgt(); j++) {
             24     Element::set_cursor(axpos(), j) << std::string(awth().value(), ' ');
             25   }
             26 }
          
             28 void Element::render_border() const
             29 {
             30   set_cursor(axpos(), aypos());
          
             32   std::cout << "┌";
             33   for (auto i = wth_t(2); i < awth(); i++) {
             34     std::cout << "─";
             35   }
             36   std::cout << "┐";
          
             38   for (ypos_t j = aypos() + 1; j < aypos() + ahgt(); j++) {
             39     set_cursor(axpos(), j) << "│";
             40     set_cursor(axpos() + awth() - 1, j) << "│";
             41   }
          
             43   set_cursor(axpos(), aypos() + ahgt() - 1);
             44   std::cout << "└";
             45   for (auto i = wth_t(2); i < awth(); i++) {
             46     std::cout << "─";
             47   }
             48   std::cout << "┘";
             49 }
          
             51 }  // namespace display