87 lines
1.7 KiB
C
87 lines
1.7 KiB
C
/* *************************************************************** *
|
|
* ncurses code example *
|
|
* (c) 01.05.2017 Paolo Iocco *
|
|
* *
|
|
* https://www.mkssoftware.com/docs/man3/curs_window.3.asp *
|
|
***************************************************************** */
|
|
|
|
#include <ncurses/ncurses.h>
|
|
|
|
int old_main()
|
|
{
|
|
int c,i,ciclo=TRUE;
|
|
WINDOW *dialogo;
|
|
|
|
initscr();
|
|
curs_set(0);
|
|
noecho();
|
|
|
|
timeout(500);
|
|
|
|
while(ciclo) {
|
|
for (i=1; i<10 ; i++)
|
|
{
|
|
mvprintw(i,i,"Salve! Questo è un programma inutile! ");
|
|
refresh();
|
|
c=getch();
|
|
if (c!=ERR)
|
|
{
|
|
break;
|
|
}
|
|
deleteln();
|
|
}
|
|
|
|
if (c!=ERR)
|
|
{
|
|
dialogo= newwin (7,32,7,17);
|
|
box(dialogo,'*','*');
|
|
timeout(0);
|
|
mvwprintw(dialogo,2,3,"Vuoi davvero interrompere?");
|
|
mvwprintw(dialogo,4,12,"(s)icuro?");
|
|
c=wgetch(dialogo);
|
|
if (c=='s')
|
|
{
|
|
ciclo=FALSE;
|
|
}
|
|
delwin(dialogo);
|
|
timeout(500);
|
|
};
|
|
|
|
erase();
|
|
refresh();
|
|
};
|
|
|
|
endwin();
|
|
return 0;
|
|
}
|
|
|
|
int main()
|
|
{
|
|
WINDOW *vin;
|
|
initscr();
|
|
start_color();
|
|
init_pair(1,COLOR_WHITE,COLOR_BLACK);
|
|
init_pair(2,COLOR_RED,COLOR_BLACK);
|
|
init_pair(3,COLOR_GREEN,COLOR_BLACK);
|
|
init_pair(4,COLOR_YELLOW,COLOR_BLACK);
|
|
|
|
/* attron(COLOR_PAIR(2));
|
|
printw("Rosso su nero");*/
|
|
refresh();
|
|
|
|
vin=newwin(10,20,10,10);
|
|
wbkgd(vin,COLOR_PAIR(3));
|
|
//box(vin,'|','-');
|
|
wborder(vin,0,0,0,0,0,0,0,0);
|
|
//wborder(vin,'|','|','-','-','+','+','+','+');
|
|
mvwprintw(vin,0,2,"| Titolo |");
|
|
wrefresh(vin);
|
|
|
|
getch();
|
|
delwin(vin);
|
|
endwin();
|
|
return 0;
|
|
}
|
|
|
|
|