home *** CD-ROM | disk | FTP | other *** search
/ ARM Club 1 / ARM_CLUB_CD.iso / contents / education / a / biology1 / !Biology1 / c / Res156 < prev    next >
Text File  |  1991-12-02  |  2KB  |  53 lines

  1. /* Res156.c */
  2.  
  3. #include <string.h>
  4.  
  5. #include "wimp.h"
  6. #include "wimpt.h"
  7.  
  8. #include "prompts.h"
  9. #include "keys.h"
  10.  
  11. /* NB in general a load of icons get put up & then forgotton about, 
  12.    some mechanism needs implementing to keep some lists
  13.    of those which will want deleting at various times,
  14.    and then deleting them.
  15. */
  16.  
  17. static void make_icon (wimp_w wnd, int length, int line, string str, wimp_i *ic)
  18.   { 
  19.     wimp_icreate info;
  20.     wimp_redrawstr r;
  21.     int len = str.maxlen;
  22.  
  23.     info.w        = wnd;
  24.     info.i.box.x0 = 4 + (standard_line - length) * 8;
  25.     info.i.box.x1 = info.i.box.x0 + (length * 8 + 4) * 2;
  26.     info.i.box.y1 = - line * 32;
  27.     info.i.box.y0 = info.i.box.y1 - 40 - 16;
  28.     info.i.flags  = wimp_ITEXT | wimp_IBORDER |
  29.                     wimp_IHCENTRE | wimp_IVCENTRE | wimp_IFILLED |
  30.                     wimp_IBTYPE * wimp_BCLICKDEBOUNCE |
  31.                     wimp_INDIRECT | 7 * wimp_IFORECOL;
  32.     info.i.data.indirecttext.buffer      = str.str;
  33.     info.i.data.indirecttext.validstring = "";
  34.     info.i.data.indirecttext.bufflen     = len + 1;
  35.  
  36.     wimpt_noerr (wimp_create_icon (&info, ic));
  37.  
  38.     r.w = wnd;
  39.     memcpy (&r.box, &info.i.box, sizeof (wimp_box));
  40.  
  41.     wimpt_noerr (wimp_force_redraw (&r));
  42.  
  43.     input_icon (wnd, *ic, NULL, key_ret);
  44.   }
  45.  
  46.  
  47. void *prompt_string (wimp_w wnd, int line, int length, string str, int res_type)
  48.   { wimp_i icon;
  49.  
  50.     make_icon (wnd, length + 1, line, str, &icon);
  51.     return (concat_string_wakeup (wnd, icon, str, res_type));
  52.   }
  53.