/**************************************************************** Uebungen zur Vorlesung "Graphische Datenverarbeitung" Sommersemester 1996 Programm: hallo.c Autor: Christian Boehm ****************************************************************/ # include # include # include # include # include # include void halloCB (Widget dum1, XtPointer dum2, XtPointer dum3) { static int count = 0 ; printf ("%3d. Hallo\n", ++count) ; } void exitCB (Widget dum1, XtPointer dum2, XtPointer dum3) { exit (0) ; } void InitWidgetBaum (Widget applShell) { Widget box, box2, exitBt, halloBt ; box = XtCreateManagedWidget ("box", xmRowColumnWidgetClass, applShell, (Arg*)NULL, 0); XtCreateManagedWidget ("titel", xmLabelWidgetClass, box, (Arg*)NULL, 0); box2 = XtCreateManagedWidget ("box2", xmRowColumnWidgetClass, box, (Arg*)NULL, 0) ; halloBt = XtCreateManagedWidget ("hallo", xmPushButtonWidgetClass, box2, (Arg*)NULL, 0); exitBt = XtCreateManagedWidget ("exit", xmPushButtonWidgetClass, box2, (Arg*)NULL, 0); XtAddCallback (halloBt, XmNactivateCallback, halloCB, (XtPointer)NULL); XtAddCallback (exitBt, XmNactivateCallback, exitCB, (XtPointer)NULL); } static char * fallbackRessourcen [] = { "*titel.labelString: Titelzeile", "*hallo.labelString: Hallo !", "*box2.orientation: horizontal", NULL } ; main (int argc, char ** argv) { XtAppContext kontext; /* Applikations-Umgebung */ Widget applShell; /* Applikations-Shell */ applShell = XtAppInitialize (&kontext, "Hallo", (XrmOptionDescRec*)NULL, 0, &argc, argv, fallbackRessourcen, (Arg*)NULL, 0); InitWidgetBaum (applShell); XtRealizeWidget (applShell); XtAppMainLoop (kontext); }