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

Linux Cross Reference
Tina4/src/Xv/tw_toggle.c

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

  1 /**@(#)
  2 **/
  3 #include <stdio.h>
  4 #include <math.h>
  5 #include <tina/sys.h>
  6 #include <tina/math.h>
  7 #include <tina/tw.h>
  8 #include <tina/tv.h>
  9 #include <tina/tvfuncs.h>
 10 #include <tina/tv_screen.h>
 11 #include <xview/xview.h>
 12 #include <xview/frame.h>
 13 #include <xview/panel.h>
 14 #include <xview/textsw.h>
 15 #include <xview/font.h>
 16 #include <xview/canvas.h>
 17 #include <xview/cms.h>
 18 #include <xview/xv_xrect.h>
 19 #include <xview/openmenu.h>
 20 #include <tina/Xvfuncs.h>
 21 #include <tina/X11funcs.h>
 22 
 23 
 24 
 25 static void toggle_call(Tw_callback * twc)
 26 {
 27     (*twc->func) (twc->data1);
 28 }
 29 
 30 static void toggle_cmnd(Tw_callback * twc, char *args)
 31 {
 32     int     value;
 33 
 34     (void) sscanf(args, "%*s %d", &value);
 35     twc->data1 = (void *) value;
 36     (*twc->func) (value);
 37     xv_set(twc->window, PANEL_VALUE, value, NULL);
 38 }
 39 
 40 static void toggle_prnt(FILE * fp, Tw_callback * twc)
 41 {
 42     (void) fprintf(fp, "%s %d\n", twc->name, twc->data1);
 43 }
 44 
 45 void    tw_toggle(char *name, void (*func) ( /* ??? */ ), int value)
 46 {
 47     int     row;
 48     Tw_callback *twc;
 49     Panel_item toggle;
 50     Panel   panel = tw_get_panel();
 51     Bool    newrow = tw_get_newrow();
 52     char   *fullname = tw_extend_fullname(tw_get_toolname(), name);
 53 
 54     toggle = (Panel_item) xv_create(panel, PANEL_CHECK_BOX,
 55                                     PANEL_CHOICE_STRINGS, name, NULL,
 56                                     NULL);
 57     twc = tw_callback_make(fullname, toggle,
 58     toggle_call, toggle_cmnd, toggle_prnt, func, (void *) value, NULL);
 59     xv_set(toggle,
 60            PANEL_NOTIFY_PROC, tw_panel_callback,
 61            PANEL_CLIENT_DATA, twc,
 62            NULL);
 63 
 64     if (newrow)
 65     {
 66         row = tw_get_row();
 67         xv_set(toggle,
 68                XV_X, xv_col(panel, 0),
 69                XV_Y, xv_row(panel, row),
 70                NULL);
 71         tw_set_newrow(false);
 72     }
 73     (*func) (value);
 74 }
 75 

~ [ 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.