home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 5 / DATAFILE_PDCD5.iso / utilities / a / armbob / !ArmBob / progs / h / wimp / templates < prev   
Text File  |  1994-03-03  |  1KB  |  44 lines

  1. /***********************************************************
  2.  * templates                   GCW 02/03/94
  3.  * window_handle = templates(template_file, window_name);
  4.  * template_file is template file
  5.  * window_name is a vector of window names
  6.  * window_handle is the corresponding vector of handles
  7.  ***********************************************************/
  8.  
  9. templates(template_file, window_name)
  10. {
  11.  local r, handle, n, i, padded;
  12.  handle = newvector(n = sizeof(window_name));
  13.  (r = newvector(8))[1] = template_file+0;
  14.  swi("Wimp_OpenTemplate",r);
  15.  for(i=0;i<n;i++)
  16.  {
  17.   r[1] = 0;
  18.   r[2] = 0;
  19.   r[3] = 0;
  20.   r[4] = -1;
  21.   r[5] = padded = pad(window_name[i],12,0);
  22.   swi("Wimp_LoadTemplate",r);
  23.   r[1] = newstring(r[1]);
  24.   r[2] = newstring(r[2]);
  25.   r[3] = @(r[2])+sizeof(r[2]);
  26.   r[5] = padded;
  27.   r[6] = 0;
  28.   swi("Wimp_LoadTemplate",r);
  29.   swi("Wimp_CreateWindow",r);
  30.   handle[i] = r[0];
  31.  }
  32.  swi("Wimp_CloseTemplate",r);
  33.  return(handle);
  34. }
  35.  
  36. /* pad out s to length n with trailing character c's  */
  37. pad(s,n,c)
  38. {
  39.  local len;
  40.  while (sizeof(s)<n)
  41.     s += c;
  42.  return (s);
  43. }
  44.