~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Linux Cross Reference
Tina4/src/TCLwidgets/tw_button.c

Version: ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /*
  2   tw_button.c
  3 
  4         create callback mechanisms only
  5 */
  6 
  7 #include <stdio.h>
  8 #include <tina/sys.h>
  9 #include <tcl.h>
 10 #include "tclWt.h"
 11 #include "tclWtPro.h"
 12 
 13 
 14 static void button_call(Tw_callback * twc)
 15 {
 16         (*twc->func) (twc->data1);
 17 }
 18 
 19 
 20 static int ttcl_button_call(ClientData clientdata, Tcl_Interp *interp, 
 21                          int argc, char **argv)
 22 {
 23         Tw_callback  *twc = (Tw_callback *)clientdata;
 24 
 25         if (argc != 1)
 26         {
 27                 Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
 28                                                                                  " Nothing ", (char *) NULL);
 29                 return TCL_ERROR;
 30         }
 31 
 32         button_call(twc);
 33 
 34   return TCL_OK;
 35 }
 36 
 37 
 38 static void button_cmnd(Tw_callback * twc)
 39 {
 40         (*twc->func) (twc->data1);
 41 }
 42 
 43 
 44 static void button_prnt(FILE * fp, Tw_callback * twc)
 45 {
 46         (void) fprintf(fp, "%s\n", twc->name);
 47 }
 48 
 49 
 50 void tw_button(char *name, void (*func) ( /* ??? */ ), void *data)
 51 {
 52         Tcl_Interp      *interp;
 53         Tw_callback *twc;
 54         char        *fullname = tw_extend_fullname(tw_get_toolname(), name);
 55         char        *tclname;
 56 
 57         if ((interp = ttcl_get_interp()) == NULL)
 58                 return;
 59         
 60         twc = tw_callback_make(fullname, (void *) NULL, button_call, button_cmnd,
 61                                                                                                  button_prnt, func, data, (void *)NULL);
 62 
 63         tclname = ttcl_mkshellname(fullname, TTCLBUTTON);
 64   Tcl_CreateCommand(interp, tclname, ttcl_button_call, (ClientData)twc, 
 65                         (Tcl_CmdDeleteProc *) NULL);
 66 
 67         rfree(tclname);
 68 }
 69 
 70 
 71 Panel_item tw_icon_button(char *name, int w, int h, short *image_bits,
 72                                                                                                         void (*func) ( /* ??? */ ), int data)
 73 {
 74         return (0);
 75 }
 76 
 77 
 78 void tw_button_reset_image(Panel_item button, int w, int h,
 79                                                                                                          short *image_bits)
 80 {
 81 }
 82 
 83 #ifdef INTERRUPT_BUTTON
 84 
 85 void tw_interrupt_button(void)
 86 {
 87 }
 88 
 89 void interrupt_button_data_get(Display ** display, Window * window)
 90 {
 91 }
 92 #endif                                                                                                  /*INTERRUPT_BUTTON */
 93 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.