home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 2 / DATAFILE_PDCD2.iso / utilities2 / desklib / Libraries / Window / c / Delete < prev    next >
Encoding:
Text File  |  1993-06-29  |  1.7 KB  |  61 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.Delete.c
  12.     Author:  Copyright © 1992 Jason Williams
  13.     Version: 1.00 (19 Mar 1992)
  14.     Purpose: High-level window management functions: Show/hide a window
  15. */
  16.  
  17.  
  18. #include "LinkList.h"
  19. #include "WimpSWIs.h"
  20. #include "Template.h"
  21. #include "Event.h"
  22. #include "Window.h"
  23. #include "Screen.h"
  24. #include "Error.h"
  25.  
  26. #include "WindowDefs.h"
  27.  
  28. #include <stdlib.h>
  29. #include "string.h"
  30.  
  31.  
  32. extern linklist_header window_listanchor;
  33.  
  34.  
  35.  
  36. extern void Window_Delete(window_handle window)
  37. {
  38.   windowrec       *ptr;
  39.  
  40.   Event_ReleaseWindow(window);       /* Release all handlers for this window */
  41.  
  42.   Wimp_CloseWindow(window);                                  /* say bye bye! */
  43.   Wimp_DeleteWindow(window);
  44.  
  45.   ptr = (windowrec *) window_listanchor.next;
  46.   while (ptr != NULL)
  47.   {
  48.     if (ptr->window == window)
  49.       break;
  50.     ptr = (windowrec *) ptr->header.next;
  51.   }
  52.  
  53.   if (ptr == NULL)
  54.     return;              /* Window not created with Window_Show(). Bad user! */
  55.  
  56.   LinkList_Unlink(&window_listanchor, &(ptr->header));
  57.  
  58.   Template_Free(&(ptr->memory));     /* Free up the window's indirected data */
  59.   free(ptr);                         /* ... and the window's list entry      */
  60. }
  61.