71 lines
No EOL
2.2 KiB
C++
71 lines
No EOL
2.2 KiB
C++
/*
|
|
* This file is part of VoidArchiveTool.
|
|
*
|
|
* Copyright (C) 2025 Yanczi
|
|
*
|
|
* Void Archive Toolis free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU Lesser General Public License as published by
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU Lesser General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#include "Tui.h"
|
|
|
|
Tui::Tui() {
|
|
// TODO Auto-generated constructor stub
|
|
|
|
}
|
|
|
|
Tui::~Tui() {
|
|
// TODO Auto-generated destructor stub
|
|
}
|
|
|
|
void Tui::TextBorder(const std::string& title, const std::string& text)
|
|
{
|
|
auto element = ftxui::window(ftxui::text(title), ftxui::paragraphAlignLeft(text));
|
|
auto screen = ftxui::Screen::Create(ftxui::Dimension::Fit(element));
|
|
ftxui::Render(screen, element);
|
|
screen.Print();
|
|
}
|
|
|
|
void Tui::table(const std::vector<std::vector<std::string>>& data)
|
|
{
|
|
ftxui::Table table(data);
|
|
|
|
// Styl ogólny tabeli (ramki)
|
|
table.SelectAll().Border(ftxui::LIGHT);
|
|
|
|
// Oddzielenie nag³ówka od danych podwójn¹ lini¹
|
|
table.SelectRow(0).Border(ftxui::LIGHT);
|
|
table.SelectRow(0).Decorate(ftxui::bold); // Pogrubienie nag³ówka
|
|
table.SelectRow(0).SeparatorVertical(ftxui::LIGHT);
|
|
table.SelectRow(0).Border(ftxui::LIGHT);
|
|
|
|
table.SelectColumn(0).DecorateCells(ftxui::center);
|
|
table.SelectColumn(1).DecorateCells(ftxui::center);
|
|
|
|
table.SelectColumn(2).DecorateCells([](ftxui::Element e) {
|
|
return e | ftxui::flex;
|
|
});
|
|
|
|
table.SelectColumn(3).DecorateCells(ftxui::center);
|
|
|
|
table.SelectColumn(0).BorderRight(ftxui::LIGHT);
|
|
table.SelectColumn(1).BorderRight(ftxui::LIGHT);
|
|
table.SelectColumn(2).BorderRight(ftxui::LIGHT);
|
|
|
|
auto document = table.Render();
|
|
|
|
auto screen = ftxui::Screen::Create(ftxui::Dimension::Full(), ftxui::Dimension::Fit(document));
|
|
|
|
ftxui::Render(screen, document);
|
|
screen.Print();
|
|
} |