From: Ricardo Markiewicz Date: Tue, 30 Mar 2004 18:08:56 +0000 (+0000) Subject: * Termino de limpiear codigo, comentar y retocar el ejemplo X-Git-Tag: svn_import_r684~671 X-Git-Url: https://git.llucax.com/z.facultad/75.06/emufs.git/commitdiff_plain/cd54ffa8f72331531d2fb4624c1259bbb023ce38?ds=inline;hp=5552879516ba6ae3139d3317ae17ca53540ba74b * Termino de limpiear codigo, comentar y retocar el ejemplo --- diff --git a/gui/gui.c b/gui/gui.c index f1a8a21..06aee1c 100644 --- a/gui/gui.c +++ b/gui/gui.c @@ -9,28 +9,30 @@ static void finish(int sig); -/** Simula un TextField - * - * \param win Ventana - * \param x Posicion en X - * \param y Posicion en Y - * \param w Cantidad maxima de caracteres. - * \param s Destino donde guardar - */ - int main(int argc, char *argv[]) { /* initialize your non-curses data structures here */ WINDOW *mainwin; t_Form *form; + /* Inicio Curses */ signal(SIGINT, finish); /* arrange interrupts to terminate */ mainwin = initscr(); /* initialize the curses library */ + + /* Verifico un tamaño minimo de consola */ + if ((LINES < 25) || (COLS < 80)) { + delwin(mainwin); + endwin(); + printf("El tamaño de la consola debe ser de por lo menos 80x25!\n"); + return 1; + } + keypad(stdscr, TRUE); /* enable keyboard mapping */ nonl(); /* tell curses not to do NL->CR/NL on output */ cbreak(); /* take input chars one at a time, no wait for \n */ noecho(); /* don't echo input */ + /* Si se soporta color, los inicializo */ if (has_colors()) { start_color(); /* Simple color assignment, often all we need. */ @@ -52,12 +54,11 @@ int main(int argc, char *argv[]) /* Creo el formulario */ form = form_crear(mainwin); form_agregar_widget(form, INPUT, "Nombre", 15, ""); - form_agregar_widget(form, RADIO, "Voto", 2, "Si,No"); + form_agregar_widget(form, RADIO, "Voto", 3, "Si,No,No Corresponde"); form_agregar_widget(form, INPUT, "Datos", 30, ""); form_ejecutar(form, 10, 10); - delwin(mainwin); endwin(); @@ -74,14 +75,11 @@ int main(int argc, char *argv[]) return 0; } - - static void finish(int sig) { endwin(); /* do your non-curses wrapup here */ - exit(0); }