diff --git a/.gitignore b/.gitignore index f2515b8..9f9a698 100644 --- a/.gitignore +++ b/.gitignore @@ -30,9 +30,5 @@ code/plugiciel.so code/appelant code/flydraw.png code/flydraw.gif +code/xform/yesyno - -A - -D -code/flydraw.gif diff --git a/chap/X11.tex b/chap/X11.tex index 3e31225..af9b696 100644 --- a/chap/X11.tex +++ b/chap/X11.tex @@ -153,7 +153,17 @@ protocol, improved threading support, and extensibility. en C, mais le premier exemple du tutorial d'initiation ne fonctionne pas vraiment comme il devrait. Mais quand même une affaire à suivre. -\lstinputlisting[language=c]{code/xf_yesno.c} +\lstinputlisting[language=c]{code/xform/yesno.c} + +Compilation: \texttt{gcc yesno.c -lforms -o yesno} + +En fait, je ne me souviens plus du petit souci qui m'a fait négliger +trop lontemps ce discret toolkit graphique, mais ça avait +quelque chose à voir avec +la constante \texttt{FL\_BORDER\_BOX} qui +\textbf{ne} fait \textbf{pas} le borderbox. + +http://xforms-toolkit.org/examples.html %------------------------------------------------------------------- diff --git a/code/xform/yesno.c b/code/xform/yesno.c new file mode 100644 index 0000000..6313f10 --- /dev/null +++ b/code/xform/yesno.c @@ -0,0 +1,35 @@ +#include +/* + * gcc yesno.c -lforms -O YESYNO + */ +int main(int argc, char *argv[]) { + FL_FORM *form; + FL_OBJECT *yes, + *no, + *but; + + fl_initialize(&argc, argv, "Yes or No ?", 0, 0); + + form = fl_bgn_form(FL_UP_BOX, 320, 120); + fl_add_box(FL_BORDER_BOX, 160, 40, 0, 0, \ + "Do you want something?"); + yes = fl_add_button(FL_NORMAL_BUTTON, \ + 40, 70, 80, 30, "Yes"); + no = fl_add_button(FL_NORMAL_BUTTON, \ + 200, 70, 80, 30, "No"); + fl_end_form(); + + fl_show_form(form, FL_PLACE_MOUSE, FL_TRANSIENT, \ + "Vroum !"); + + while (1) { + if (fl_do_forms() == yes) { + printf("Yes is pushed\n"); + break; + } + else printf(" No is pushed\n"); + } + + fl_finish(); + return 0; +}