home *** CD-ROM | disk | FTP | other *** search
/ ARM Club 1 / ARM_CLUB_CD.iso / contents / apps / clib / progs / timslib / TimsLib / c / IconLib next >
Encoding:
Text File  |  1993-01-21  |  1.9 KB  |  69 lines

  1. /* 
  2.   IconLib.c - routines over and above RISC_OSLib and DeskLib.
  3. */
  4. /*                           
  5.  
  6.   #####                 #         #
  7.     #    #              #      #  #
  8.     #                   #         #
  9.     #   ##  ####   #### #     ##  ####
  10.     #    #  # # # #     #      #  #   #
  11.     #    #  # # #  ###  #      #  #   #
  12.     #    #  # # #     # #      #  #   #
  13.     #   ### # # # ####  ##### ### ####
  14.  
  15. -----------------------------------------------------------------------------
  16.  
  17. This is source for use with the 'DeskLib' Wimp C programming library for
  18. Risc OS. I currently use v1.04 of DeskLib.  This source is FreeWare, which
  19. means you can use it to write commercial applications, but you may not charge
  20. *in any way* for the distribution of this source.  I (Tim Browse) retain
  21. all copyright on this source.
  22.  
  23. This source is provided 'as is' and I offer no guarantees that is useful,
  24. bug-free, commented, that it will compile, or even that it exists.
  25.  
  26. If it breaks in half, you own both pieces.
  27.  
  28. All source © Tim Browse 1993
  29.  
  30. -----------------------------------------------------------------------------
  31.  
  32. */
  33.  
  34. /* ANSI includes */
  35. #include "stdlib.h"
  36.  
  37. /* DeskLib includes */
  38. #include "DeskLib.Wimp.h"
  39.  
  40. #include "IconLib.h"
  41.  
  42. void IconLib_DisposeIndData(icon_data *data, icon_flags flags)
  43. {
  44.   /* make sure this icon is indirected - exit quietly if not */
  45.   if ((data == NULL) || (!flags.data.indirected))
  46.     return;
  47.  
  48.   /* it's indirected - free the data */
  49.   switch (ICON_TYPE(flags.value))
  50.   {
  51.     case TXT_ONLY:
  52.     case TXT_AND_SPR:
  53.  
  54.       /* Free text buffer */
  55.       free(data->indirecttext.buffer);
  56.  
  57.       /* Free validation string, if there is one */
  58.       if ((data->indirecttext.validstring != NULL) &&
  59.           (data->indirecttext.validstring != (char *) 0xffffffff))
  60.         free(data->indirecttext.validstring);
  61.       break;
  62.  
  63.     case SPR_ONLY:
  64.       if (data->indirectsprite.nameisname)
  65.         free((void *) data->indirectsprite.name);
  66.       break;
  67.   }       
  68. }
  69.