1 /* $Id: keytrap.c,v 1.3 2005-01-24 22:19:10 schaffner Exp $ */
17 UI_GADGET_KEYTRAP * ui_add_gadget_keytrap( UI_WINDOW * wnd, int key_to_trap, int (*function_to_call)(void) )
19 UI_GADGET_KEYTRAP * keytrap;
21 keytrap = (UI_GADGET_KEYTRAP *)ui_gadget_add( wnd, 8, 0, 0, 0, 0 );
22 keytrap->parent = (UI_GADGET *)keytrap;
24 keytrap->trap_key = key_to_trap;
25 keytrap->user_function = function_to_call;
31 void ui_keytrap_do( UI_GADGET_KEYTRAP * keytrap, int keypress )
35 if ( keypress == keytrap->trap_key )
37 result = keytrap->user_function();