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

Linux Cross Reference
Tina4/src/Xm/tw_sglobal.c

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

  1 /**@(#)
  2 **/
  3 #include <stdio.h>
  4 #include <tina/sys.h>
  5 #include <tina/math.h>
  6 #include <tina/tv.h>
  7 #include  <tina/mtw.h>
  8 #include  <tina/tv_screen.h>
  9 #include <tina/Xmfuncs.h>
 10 
 11 static void sglobal_call(Tw_callback * twc)
 12 {
 13     char   *ptr;
 14     char   *string;
 15 
 16     if (twc == NULL)
 17                         return;
 18 
 19                 ptr = (char *) twc->data1;
 20     string = XmTextGetString(twc->widget);
 21 
 22     (void) strcpy(ptr, string);
 23     XtFree(string);
 24 }
 25 
 26 static void sglobal_cmnd(Tw_callback * twc, char *args)
 27 {
 28     char   *ptr;
 29 
 30     if (twc == NULL)
 31                         return;
 32 
 33     ptr = (char *) twc->data1;
 34 
 35     (void) sscanf(args, "%*s %s", ptr);
 36     tw_text_set(twc->widget, ptr);
 37 }
 38 
 39 static void sglobal_prnt(FILE * fp, Tw_callback * twc)
 40 {
 41     char   *ptr;
 42 
 43     if (fp == NULL || twc == NULL)
 44                         return;
 45 
 46                 ptr = (char *) twc->data1;
 47 
 48     (void) fprintf(fp, "%s %s\n", twc->name, ptr);
 49 }
 50 
 51 void *tw_sglobal(char *name, char *ptr, int nchars)
 52 {
 53     XmString xmstring;
 54     int     nargs;
 55     Arg     wargs[1];
 56     int     w, h;
 57     Tw_callback *twc;
 58     Widget  panel = tw_get_panel(), label, text;
 59     char   *fullname = tw_extend_fullname(tw_get_toolname(), name);
 60 
 61     xmstring = XmStringCreate(name, XmSTRING_DEFAULT_CHARSET);
 62     nargs = 0;
 63     XtSetArg(wargs[nargs], XmNlabelString, xmstring);
 64     nargs++;
 65     label = XtCreateManagedWidget("twlabel", xmLabelWidgetClass,
 66                                   panel, wargs, nargs);
 67     XmStringFree(xmstring);
 68 
 69     w = tw_charwidth(2.0 + strlen(name));
 70     h = tw_charheight(1.0);
 71     tw_set_entry(label, w, h);
 72 
 73     nargs = 0;
 74     XtSetArg(wargs[nargs], XmNcolumns, nchars);
 75     nargs++;
 76     text = XtCreateManagedWidget("twtext", xmTextWidgetClass,
 77                                  panel, wargs, nargs);
 78     XmTextSetString(text, ptr);
 79 
 80     twc = tw_callback_make(fullname, tw_get_tool(), text,
 81                            sglobal_call, sglobal_cmnd, sglobal_prnt,
 82                            (void (*) ()) NULL, (void *) ptr, NULL);
 83     XtAddCallback(text, XmNvalueChangedCallback, (void *) tw_callback, (XtPointer) twc);
 84 
 85     w = tw_charwidth(4.0 + nchars);
 86     h = tw_charheight(2.5);
 87     tw_set_entry(text, w, h);
 88 
 89     return (twc);
 90 }
 91 
 92 
 93 void    tw_sglobal_reset(void *ptwc)
 94 {
 95     Tw_callback *twc = ptwc;
 96     char     *string;
 97 
 98     if (twc == NULL)
 99                         return;
100 
101     string = (char *) twc->data1;
102     XmTextSetString(twc->widget, string);
103 }
104 

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