displayLayout and Rendering TUI library |
git clone git://git.dimitrijedobrota.com/display.git |
Log | Files | Refs | README | HACKING | CONTRIBUTING | CODE_OF_CONDUCT | BUILDING | |
window_padd.cpp (1537B)
1 #include <iostream> 2 3 #include "display/window_padd.hpp" 4 5 namespace display 6 { 7 8 template<> 9 void WindowPadd<WindowType::Bare>::render() const 10 { 11 } 12 13 template<> 14 void WindowPadd<WindowType::Border>::render() const 15 { 16 set_cursor(aypos(), axpos()) << std::string(awth(), ' '); 17 18 for (sz_t i = ypos(); i < ypos() + hgt(); i++) { 19 set_cursor(i, axpos()) << ' '; 20 set_cursor(i, axpos() + awth() - 1) << ' '; 21 } 22 23 set_cursor(aypos() + ahgt() - 1, axpos()) << std::string(awth(), ' '); 24 } 25 26 template<> 27 void WindowPadd<WindowType::Box>::render() const 28 { 29 set_cursor(aypos(), axpos()); 30 std::cout << "┌"; 31 for (sz_t i = 0; i < wth(); i++) { 32 std::cout << "─"; 33 } 34 std::cout << "┐"; 35 36 for (sz_t i = ypos(); i < ypos() + hgt(); i++) { 37 set_cursor(i, axpos()) << "│"; 38 set_cursor(i, axpos() + awth() - 1) << "│"; 39 } 40 41 set_cursor(aypos() + ahgt() - 1, axpos()); 42 std::cout << "└"; 43 for (sz_t i = 0; i < wth(); i++) { 44 std::cout << "─"; 45 } 46 std::cout << "┘"; 47 } 48 49 template<> 50 void WindowPadd<WindowType::BorderBox>::render() const 51 { 52 set_cursor(aypos(), axpos()); 53 std::cout << "┌─"; 54 for (sz_t i = 0; i < wth(); i++) { 55 std::cout << "─"; 56 } 57 std::cout << "─┐"; 58 59 for (sz_t i = ypos(); i < ypos() + hgt(); i++) { 60 set_cursor(i, axpos()) << "│ "; 61 set_cursor(i, axpos() + awth() - 2) << " │"; 62 } 63 64 set_cursor(aypos() + ahgt() - 1, axpos()); 65 std::cout << "└─"; 66 for (sz_t i = 0; i < wth(); i++) { 67 std::cout << "─"; 68 } 69 std::cout << "─┘"; 70 } 71 72 } // namespace display