home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / alib / d4xx / d430 / smartfields.lha / SmartFields / Functions / field_refresh.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-01-11  |  1.9 KB  |  54 lines

  1. /***************************************
  2. *  FIELD REFRESH v1.45
  3. *  © Copyright 1988 Timm Martin
  4. *  All Rights Reserved
  5. ****************************************/
  6.  
  7. #include <exec/io.h>
  8. #include <exec/types.h>
  9. #include <graphics/text.h>
  10. #include <intuition/intuition.h>
  11. #include <console/fields.h>
  12. #include <console/functions.h>
  13. #include <toolkit/toolkit.h>
  14.  
  15. int field_refresh( header, first, count, place )
  16.   struct FieldHeader *header;
  17.   struct Field *first;
  18.   UINT   count;
  19.   struct Field *place;
  20. {
  21.   void   DrawBorder();        /* intuition.lib */
  22.   void   DrawImage();         /* intuition.lib */
  23.   struct Field *field;        /* for stepping thru field list */
  24.   int    i = 0;               /* number of fields refreshed */
  25.   void   PrintIText();        /* intuition.lib */
  26.  
  27.   field = first;
  28.   cursor_invisible( header->WriteReq );
  29.   while (field && i < count) {
  30.     field->Bottom = field->Top - 1 + header->Window->BorderBottom +
  31.                     header->Window->IFont->tf_YSize;
  32.     field->Right  = field->Left - 1 + header->Window->BorderRight +
  33.                     field->MaxChars * header->Window->IFont->tf_XSize;
  34.     if (field->FieldImage)
  35.       DrawImage( header->Window->RPort, field->FieldImage, (long)(field->Left), (long)(field->Top) );
  36.     if (field->FieldBorder)
  37.       DrawBorder( header->Window->RPort, field->FieldBorder, (long)(field->Left), (long)(field->Top) );
  38.     if (field->FieldTitle)
  39.       PrintIText( header->Window->RPort, field->FieldTitle, (long)(field->Left), (long)(field->Top) );
  40.     if (header->Window->Height > field->Bottom) {
  41.       cursor_place( header->WriteReq, field->Left, field->Top );
  42.       con_graphic_rend( header->WriteReq, field->Style, field->FrontPen, field->BackPen );
  43.       con_line_length( header->WriteReq, field->MaxChars );
  44.       con_put_string( header->WriteReq, field->Buffer );
  45.     }
  46.     field = field->NextField;
  47.     i++;
  48.   }
  49.   if (place)
  50.     field_goto( header, place );
  51.  
  52.   return (i);
  53. }
  54.