commentato

This commit is contained in:
admin committed 2026-05-29 22:14:52 +02:00
1 parent 42f3b43a68
commit 0471375aab
1 file changed
+8
+8
View File
@@ -8,6 +8,7 @@
#include "../include/globals.h" #include "../include/globals.h"
#define MAX_LEN 64 #define MAX_LEN 64
// Scrivi in una finestra di warning
void warningf(const char *fmt, ...) { void warningf(const char *fmt, ...) {
char buf[256]; char buf[256];
va_list args; va_list args;
@@ -17,6 +18,7 @@ void warningf(const char *fmt, ...) {
warning(buf); warning(buf);
} }
// Dichiara una finestra di warning, avviato da warningf
void warning(char *string){ void warning(char *string){
WINDOW *warningWin; WINDOW *warningWin;
int startx, starty, width, height; int startx, starty, width, height;
@@ -37,6 +39,7 @@ void warning(char *string){
destroy_win(warningWin); destroy_win(warningWin);
} }
// Scrivi nella barra di status
void statusf(const char *fmt, ...) { void statusf(const char *fmt, ...) {
char buf[256]; char buf[256];
va_list args; va_list args;
@@ -46,6 +49,7 @@ void statusf(const char *fmt, ...) {
status(buf); status(buf);
} }
// Posiziona il testo indicato in statusf nella barra di status
void status(char *msg) { void status(char *msg) {
attron(COLOR_PAIR(3)); attron(COLOR_PAIR(3));
mvprintw(LINES -2, 0, "%-*s", COLS, msg); mvprintw(LINES -2, 0, "%-*s", COLS, msg);
@@ -70,6 +74,7 @@ void destroy_win(WINDOW *local_win)
delwin(local_win); delwin(local_win);
} }
// Scrive in una finestra facendo il wrapping a parola del testo in modo che non esca dalla finestra
void wwrap_print(WINDOW *win, int start_y, int start_x, const char *str) { void wwrap_print(WINDOW *win, int start_y, int start_x, const char *str) {
int max_width = getmaxx(win) - (start_y + 1); int max_width = getmaxx(win) - (start_y + 1);
int y = start_y; int y = start_y;
@@ -129,6 +134,7 @@ void wwrap_print(WINDOW *win, int start_y, int start_x, const char *str) {
mvwprintw(win, y, x, "%s", word_start); mvwprintw(win, y, x, "%s", word_start);
} }
// Elemento di UI; Menu a scelta multipla
int uiSelectMenu(WINDOW *win, int start_y, int start_x, char **options, int n_options) { int uiSelectMenu(WINDOW *win, int start_y, int start_x, char **options, int n_options) {
int highlight = 1, choice = 0, c; int highlight = 1, choice = 0, c;
keypad(win, TRUE); keypad(win, TRUE);
@@ -150,6 +156,7 @@ int uiSelectMenu(WINDOW *win, int start_y, int start_x, char **options, int n_op
return choice; return choice;
} }
// Elemento di UI; Campo di inserimento del testo
void uiTextInput(WINDOW *win, int y, int x, char *input, int max_len) { void uiTextInput(WINDOW *win, int y, int x, char *input, int max_len) {
int ch, pos = strlen(input); int ch, pos = strlen(input);
wattron(win, COLOR_PAIR(2)); wattron(win, COLOR_PAIR(2));
@@ -177,6 +184,7 @@ void uiTextInput(WINDOW *win, int y, int x, char *input, int max_len) {
wattroff(win, COLOR_PAIR(2)); wattroff(win, COLOR_PAIR(2));
} }
// Elemento di UI; Tasto a 2 stati (ON/OFF)
int uiToggleSwitch(WINDOW *win, int y, int x, int state) { int uiToggleSwitch(WINDOW *win, int y, int x, int state) {
int c; int c;
keypad(win, TRUE); keypad(win, TRUE);