/* examples/misc/destroy.c */ #include He_node *princ, *panel, *butt1, *butt2, *butt3; void butt_destroy_proc (He_node *hn) { printf ("butt_destroy_proc %s\n", HeGetButtonLabel(hn)); } void panel_destroy_proc (He_node *hn) { printf ("panel_destroy_proc\n"); } void princ_destroy_proc (He_node *hn) { printf ("princ_destroy_proc\n"); } void butt1_proc (He_node *hn) { HeDestroy (hn); } void butt2_proc (He_node *hn) { HeDestroy (panel); } void butt3_proc (He_node *hn) { HeQuit(0); } int main (int argc, char *argv[]) { HeInit (&argc, &argv); princ = HeCreateFrame (); HeSetFrameLabel (princ, "DestroyProc"); HeSetDestroyProc (princ, princ_destroy_proc); panel = HeCreatePanel (princ); HeSetDestroyProc (panel, panel_destroy_proc); butt1 = HeCreateButtonP (panel, "Suicide", butt1_proc, NULL); HeSetDestroyProc (butt1, butt_destroy_proc); butt2 = HeCreateButtonP (panel, "Détruit Panel", butt2_proc, NULL); HeSetDestroyProc (butt2, butt_destroy_proc); butt3 = HeCreateButtonP (panel, "Quit", butt3_proc, NULL); HeSetDestroyProc (butt3, butt_destroy_proc); return HeMainLoop (princ); }