home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / x / volume2 / widgetwrap / patch1 < prev    next >
Encoding:
Internet Message Format  |  1993-04-28  |  5.8 KB

  1. From: mikew@wyse.wyse.com (Mike Wexler)
  2. Newsgroups: comp.sources.x
  3. Subject: v02i008:  a differnet interface to widget creation, Patch1
  4. Message-ID: <1801@wyse.wyse.com>
  5. Date: 26 Oct 88 22:42:25 GMT
  6. Approved: mikew@wyse.com
  7.  
  8. Submitted-by: Dan Heller <island!ceylon!argv@Sun.COM>
  9. Posting-number: Volume 2, Issue 8
  10. Archive-name: widgetwrap/patch1
  11.  
  12.  
  13.  
  14. These update diffs don't fix any bugs (since none were reported), but
  15. instead provide some enhancements: You can now create shell widgets
  16. and popup widgets using this library.
  17.  
  18. *** OLD/Patchlevel.h    Sat Oct 15 19:47:04 1988
  19. --- Patchlevel.h    Fri Oct 21 12:41:19 1988
  20. ***************
  21. *** 1 ****
  22. ! #define PATCHLEVEL 0
  23. --- 1 ----
  24. ! #define PATCHLEVEL 1
  25. *** OLD/WidgetWrap.c    Sat Oct 15 19:45:58 1988
  26. --- WidgetWrap.c    Fri Oct 21 12:40:30 1988
  27. ***************
  28. *** 30,35 ****
  29. --- 30,37 ----
  30.    *
  31.    *    XtNmanaged        pass "False" to create a non-managed widget.
  32.    *    XtNargList        takes _two_ parameters.
  33. +  *    XtNpopupShell        pass "True" to create a PopupShellWidget.
  34. +  *    XtNapplicShell        pass "True" to create an applicationShellWidget
  35.    *
  36.    * The XtNargList makes it possible to pass attributes to the create/get/set
  37.    * calls that are probably common to many widgets to be created or reset.
  38. ***************
  39. *** 92,103 ****
  40.       va_list    var;
  41.       Arg        args[MAXARGS];
  42.       int        err = 0, nargs, i = 0;
  43. -     int        managed = True;
  44.       String    argstr;
  45.       XtArgVal    argval;
  46.       char    *name, buf[32];
  47.       WidgetClass class;
  48. !     Widget    parent;
  49.   
  50.       va_start(var);
  51.   
  52. --- 94,104 ----
  53.       va_list    var;
  54.       Arg        args[MAXARGS];
  55.       int        err = 0, nargs, i = 0;
  56.       String    argstr;
  57.       XtArgVal    argval;
  58.       char    *name, buf[32];
  59.       WidgetClass class;
  60. !     Widget    parent, (*create_func)() = XtCreateManagedWidget;
  61.   
  62.       va_start(var);
  63.   
  64. ***************
  65. *** 122,130 ****
  66.           err++;
  67.           break;
  68.           }
  69. !     } else if (!strcmp(argstr, XtNmanaged))
  70. !         /* managed is _really_ boolean, but varargs only works with ints */
  71. !         managed = va_arg(var, int);
  72.       else {
  73.           argval = va_arg(var, XtArgVal);
  74.           XtSetArg(args[i], argstr, argval);
  75. --- 123,134 ----
  76.           err++;
  77.           break;
  78.           }
  79. !     } else if (!strcmp(argstr, XtNmanaged) && !va_arg(var, int))
  80. !         create_func = XtCreateWidget;
  81. !     else if (!strcmp(argstr, XtNpopupShell) && va_arg(var, int))
  82. !         create_func = XtCreatePopupShell;
  83. !     else if (!strcmp(argstr, XtNapplicShell) && va_arg(var, int))
  84. !         create_func = XtCreateApplicationShell;
  85.       else {
  86.           argval = va_arg(var, XtArgVal);
  87.           XtSetArg(args[i], argstr, argval);
  88. ***************
  89. *** 136,145 ****
  90.       if (err)
  91.       return NULL;
  92.   
  93. !     if (managed)
  94. !     return XtCreateManagedWidget(name, class, parent, args, i);
  95. !     else
  96. !     return XtCreateWidget(name, class, parent, args, i);
  97.   }
  98.   
  99.   /*
  100. --- 140,146 ----
  101.       if (err)
  102.       return NULL;
  103.   
  104. !     return (create_func)(name, class, parent, args, i);
  105.   }
  106.   
  107.   /*
  108. *** OLD/WidgetWrap.h    Sat Oct 15 19:45:59 1988
  109. --- WidgetWrap.h    Fri Oct 21 12:40:30 1988
  110. ***************
  111. *** 8,13 ****
  112. --- 8,15 ----
  113.   #define MAXARGS        50
  114.   #define XtNargList    "Arglist"
  115.   #define XtNmanaged    "Managed"
  116. + #define XtNpopupShell    "popupShell"
  117. + #define XtNapplicShell    "applicationShell"
  118.   
  119.   extern void WidgetSet(), WidgetGet();
  120.   extern Widget WidgetCreate();
  121. *** OLD/WidgetWrap.man    Sat Oct 15 19:48:28 1988
  122. --- WidgetWrap.man    Fri Oct 21 12:59:46 1988
  123. ***************
  124. *** 58,71 ****
  125.   .fi
  126.   .in -4
  127.   As you can see, the list must be NULL terminated.  You may pass up to
  128. ! to MAXARGS argument pairs (which is defined in WidgetWrap.h).  There are
  129. ! special args available to the Create/Get/Set functions that are available:
  130.   .sp
  131. ! .in +2
  132. ! XtNmanaged\ \ \ \ pass "False" to create a non-managed widget.
  133. ! XtNargList\ \ \ \ takes \fItwo\fP parameters.
  134. ! .in -2
  135.   .sp
  136.   The XtNargList makes it possible to pass attributes to the Create/Get/Set
  137.   calls that are probably common to many widgets to be created or reset.
  138.   .sp
  139. --- 58,84 ----
  140.   .fi
  141.   .in -4
  142.   As you can see, the list must be NULL terminated.  You may pass up to
  143. ! to MAXARGS argument pairs (which is defined in WidgetWrap.h).  This limit
  144. ! is for WidgetCreate() only; WidgetSet() may take any number of arguments.
  145.   .sp
  146. ! There are special arguments available to the functions that are available:
  147.   .sp
  148. + .in +4
  149. + .ta 1.5i
  150. + .ti -2
  151. + XtNmanaged    pass "False" for a non-managed widget.
  152. + .ti -2
  153. + XtNapplicShell    uses XtCreateApplicationShell
  154. + .ti -2
  155. + XtNpopupShell    uses XtCreatePopupShell
  156. + .ti -2
  157. + XtNargList    takes \fItwo\fP parameters: args and num_args.
  158. + .in -4
  159. + .sp
  160. + WidgetCreate uses XtCreateManagedWidget by default, so if XtNmanaged is
  161. + specified with an argument of False, then XtCreateWidget is used instead.
  162. + The similar situation is done for XtNpopupShell and XtNapplicShell.
  163. + .sp
  164.   The XtNargList makes it possible to pass attributes to the Create/Get/Set
  165.   calls that are probably common to many widgets to be created or reset.
  166.   .sp
  167. ***************
  168. *** 95,103 ****
  169.   automatically by calling GenericWidgetName() since most of the time,
  170.   user's don't care what the name of a widget is, this capability is available.
  171.   .SH DIAGNOSTICS
  172. ! WidgetCreate() will return NULL if a widget cannot be created.  It uses
  173. ! the routines (and is a front end for) XtCreateWidget() and
  174. ! XtCreateManagedWidget().
  175.   .SH "SEE ALSO"
  176.   XtCreateWidget(3X),
  177.   XtCreateManagedWidget(3X),
  178. --- 108,117 ----
  179.   automatically by calling GenericWidgetName() since most of the time,
  180.   user's don't care what the name of a widget is, this capability is available.
  181.   .SH DIAGNOSTICS
  182. ! WidgetCreate() will return NULL if a widget cannot be created.  It is an
  183. ! error to try to use more than one of XtNapplicShell, XtNPopupShell, and
  184. ! XtNmanaged, but no error is reported.  The last attribute set to True will
  185. ! be used.
  186.   .SH "SEE ALSO"
  187.   XtCreateWidget(3X),
  188.   XtCreateManagedWidget(3X),
  189. -- 
  190. Mike Wexler(wyse!mikew)    Phone: (408)433-1000 x1330
  191. Moderator of comp.sources.x
  192.