home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 2 / DATAFILE_PDCD2.iso / utilities2 / desklib / Libraries / Window / c / ParentName < prev    next >
Encoding:
Text File  |  1993-06-29  |  1.4 KB  |  54 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:    Window.ParentName.c
  12.     Author:  Copyright © 1992 Jason Williams
  13.     Version: 1.00 (19 Mar 1992)
  14.     Purpose: High-level window management functions: Return template window
  15.              was created from (if known)
  16. */
  17.  
  18.  
  19. #include "LinkList.h"
  20. #include "Window.h"
  21.  
  22. #include "WindowDefs.h"
  23.  
  24. #include <stdlib.h>
  25. #include "string.h"
  26.  
  27. extern linklist_header window_listanchor;
  28.  
  29.  
  30.  
  31. extern void Window_ParentName(window_handle window, char *windowname)
  32. {
  33.   windowrec     *record;
  34.  
  35.   if (window < 0)
  36.   {
  37.     strcpy(windowname, "iconbar");
  38.     return;
  39.   }
  40.  
  41.   windowname[0] = '\0';     /* in case window not found, ensure valid output */
  42.  
  43.   record = (windowrec *) window_listanchor.next;
  44.   while (record != NULL)
  45.   {
  46.     if (window == record->window)
  47.       break;
  48.     record = (windowrec *) record->header.next;
  49.   }
  50.  
  51.   if (record != NULL)
  52.     strncpy(windowname, record->templatename, 8);
  53. }
  54.