home *** CD-ROM | disk | FTP | other *** search
/ RISC DISC 1 / RISC_DISC_1.iso / pd_share / code / desklib / Libraries / Template / c / Find < prev    next >
Encoding:
Text File  |  1994-05-29  |  1.8 KB  |  69 lines

  1. /*
  2.     ####             #    #     # #
  3.     #   #            #    #       #          The FreeWare C library for 
  4.     #   #  ##   ###  #  # #     # ###             RISC OS machines
  5.     #   # #  # #     # #  #     # #  #   ___________________________________
  6.     #   # ####  ###  ##   #     # #  #                                      
  7.     #   # #        # # #  #     # #  #    Please refer to the accompanying
  8.     ####   ### ####  #  # ##### # ###    documentation for conditions of use
  9.     ________________________________________________________________________
  10.  
  11.     File:    Template.Find.c
  12.     Author:  Copyright © 1992, 1993, 1994 Jason Williams
  13.              Thanks to John Winters for supplying the code that I hacked
  14.              changed, hacked, rewrote, and then wrote again from scratch!
  15.              Sprite area handling added by Tim Browse
  16.     Version: 1.11 (30 Mar 1994)
  17.     Purpose: Loading, cacheing, and retrieval of window templates
  18. */
  19.  
  20. #include "DeskLib:GFX.h"
  21.  
  22. #define __dl_tempfind_c
  23.  
  24. #include "TempDefs.h"
  25.  
  26. /* Define the sprite area variable */
  27. sprite_area __template_spritearea = NULL;
  28.  
  29. extern template_record *Template__FindTemplate(char *name)
  30. /* not intended for user-consumption! Use Template_Find instead */
  31. {
  32.   template_record *t;
  33.  
  34.   t = (template_record *) template_list.next;
  35.  
  36.   while (t != NULL)
  37.   {
  38.     if (!strncmp(name, t->identifier, wimp_MAXNAME))
  39.     {
  40.       if (__template_spritearea != NULL)
  41.       {
  42.         /*
  43.          * Make this window's sprite area point to the required sprite area.
  44.          */
  45.         t->windowdef->spritearea = (void *) __template_spritearea;
  46.       }
  47.       return(t);
  48.     }
  49.  
  50.     t = (template_record *) t->header.next;
  51.   }
  52.  
  53.   return(NULL);
  54. }
  55.  
  56.  
  57.  
  58. extern window_block *Template_Find(char *name)
  59. {
  60.   template_record *t;
  61.  
  62.   t = Template__FindTemplate(name);
  63.   
  64.   if (t == NULL)
  65.     return(NULL);
  66.  
  67.   return(t->windowdef);
  68. }
  69.