displayLayout and Rendering TUI library |
git clone git://git.dimitrijedobrota.com/display.git |
Log | Files | Refs | README | HACKING | CONTRIBUTING | CODE_OF_CONDUCT | BUILDING | |
element.cpp (863B)
1 #include <iostream> 2 3 #include "display/element.hpp" 4 5 namespace display 6 { 7 8 std::ostream& Element::set_cursor(xpos_t xpos, ypos_t ypos) 9 { 10 return std::cout << alec::cursor_position(ypos.value() + 1, xpos.value() + 1); 11 } 12 13 std::ostream& Element::set_cursor(pos_t pos) 14 { 15 return set_cursor(pos.x, pos.y); 16 } 17 18 void Element::render_border() const 19 { 20 set_cursor(axpos(), aypos()); 21 22 std::cout << "┌"; 23 for (auto i = wth_t(2); i < awth(); i++) { 24 std::cout << "─"; 25 } 26 std::cout << "┐"; 27 28 for (ypos_t j = aypos() + 1; j < aypos() + ahgt(); j++) { 29 set_cursor(axpos(), j) << "│"; 30 set_cursor(axpos() + awth() - 1, j) << "│"; 31 } 32 33 set_cursor(axpos(), aypos() + ahgt() - 1); 34 std::cout << "└"; 35 for (auto i = wth_t(2); i < awth(); i++) { 36 std::cout << "─"; 37 } 38 std::cout << "┘"; 39 40 std::cout << std::flush; 41 } 42 43 } // namespace display