Re-factorización del código
Signed-off-by: somebody_master <somebody_master@somebodyserver.mooo.com>
This commit is contained in:
21
src/ui.cpp
21
src/ui.cpp
@@ -50,26 +50,20 @@ void ui::showCenterMensaje(vector<string> *mensaje, const int8_t *menu_color) {
|
||||
g_mensaje = false;
|
||||
}
|
||||
|
||||
void ui::showCentralInputBox(std::vector<std::string> *textos,
|
||||
const int8_t *num_box,
|
||||
std::vector<std::string> *elems) {
|
||||
void ui::showCentralInputBox(std::vector<std::string> *textos, const int8_t *num_box, std::vector<std::string> *elems) {
|
||||
ui::showCentralInputBox(textos, num_box, elems, 0);
|
||||
}
|
||||
|
||||
vector<string> ui::showCentralInputBox(vector<string> *textos,
|
||||
const int8_t *num_box,
|
||||
vector<string> *elems, long title_size) {
|
||||
|
||||
vector<string> ui::showCentralInputBox(vector<string> *textos, const int8_t *num_box, vector<string> *elems, long title_size) {
|
||||
vector<string> entrada;
|
||||
|
||||
int start_ver_window = 1;
|
||||
|
||||
if (title_size != 0) {
|
||||
start_ver_window = title_size + 4;
|
||||
}
|
||||
|
||||
int height = ui::g_maxLines - (title_size + 4) - 1;
|
||||
WINDOW *centralBOX = newwin(height, ui::g_maxCols - ui::g_menuWith - 4,
|
||||
start_ver_window, ui::g_menuWith + 2);
|
||||
WINDOW *centralBOX = newwin(height, ui::g_maxCols - ui::g_menuWith - 4, start_ver_window, ui::g_menuWith + 2);
|
||||
box(centralBOX, 0, 0);
|
||||
|
||||
for (int i = 0; i < textos->size(); i++) {
|
||||
@@ -91,10 +85,6 @@ vector<string> ui::showCentralInputBox(vector<string> *textos,
|
||||
noecho();
|
||||
cbreak();
|
||||
|
||||
// std::chrono::milliseconds timespan(10000); // or whatever
|
||||
|
||||
// std::this_thread::sleep_for(timespan);
|
||||
|
||||
return entrada;
|
||||
}
|
||||
|
||||
@@ -104,8 +94,7 @@ void ui::showTopTitle(const vector<string> *titulo) {
|
||||
attron(A_BOLD);
|
||||
box(topTitleWin, 0, 0);
|
||||
for (int i = 0; i < height; i++) {
|
||||
mvwprintw(topTitleWin, i + 1, (g_maxCols - 4 - titulo->at(i).length()) / 2,
|
||||
titulo->at(i).c_str());
|
||||
mvwprintw(topTitleWin, i + 1, (g_maxCols - 4 - titulo->at(i).length()) / 2, titulo->at(i).c_str());
|
||||
}
|
||||
attroff(A_BOLD);
|
||||
wrefresh(topTitleWin);
|
||||
|
||||
Reference in New Issue
Block a user