home *** CD-ROM | disk | FTP | other *** search
/ ARM Club 1 / ARM_CLUB_CD.iso / contents / apps / clib / progs / timslib / OtherBits / c / FileIcon next >
Encoding:
Text File  |  1993-01-22  |  2.1 KB  |  72 lines

  1. /* FileIcon.c */
  2. /*                           
  3.  
  4.   #####                 #         #
  5.     #    #              #      #  #
  6.     #                   #         #
  7.     #   ##  ####   #### #     ##  ####
  8.     #    #  # # # #     #      #  #   #
  9.     #    #  # # #  ###  #      #  #   #
  10.     #    #  # # #     # #      #  #   #
  11.     #   ### # # # ####  ##### ### ####
  12.  
  13. -----------------------------------------------------------------------------
  14.  
  15. This is source for use with the 'DeskLib' Wimp C programming library for
  16. Risc OS. I currently use v1.04 of DeskLib.  This source is FreeWare, which
  17. means you can use it to write commercial applications, but you may not charge
  18. *in any way* for the distribution of this source.  I (Tim Browse) retain
  19. all copyright on this source.
  20.  
  21. This source is provided 'as is' and I offer no guarantees that is useful,
  22. bug-free, commented, that it will compile, or even that it exists.
  23.  
  24. If it breaks in half, you own both pieces.
  25.  
  26. All source © Tim Browse 1993
  27.  
  28. -----------------------------------------------------------------------------
  29.  
  30. */
  31.  
  32. /* ANSI includes */
  33. #include <stdio.h>
  34.  
  35. /* DeskLib includes */
  36. #include "DeskLib.Wimp.h"
  37. #include "DeskLib.WimpSWIs.h"
  38.  
  39. /* Glazier includes */
  40. #include "Sprites.h"
  41.  
  42. #include "FileIcon.h"
  43.  
  44. void FileIcon(window_handle window, icon_handle icon, int filetype)
  45. {
  46.   /* Icon should be an indirected text-only icon with enough room in text
  47.      buffer to hold the sprite name.  
  48.      This converts to an indirected sprite-only icon, and fills in the sprite
  49.      name and area.
  50.   */
  51.   icon_block iconblock;
  52.   icon_flags mask, flags;
  53.  
  54.   Wimp_GetIconState(window, icon, &iconblock);
  55.  
  56.   /* Put sprite name in name field */
  57.   sprintf((char *) iconblock.data.indirectsprite.name, "file_%3.3x", filetype);
  58.  
  59.   /* Fill in sprite area */
  60.   iconblock.data.indirectsprite.spritearea = (unsigned int *) app_spritearea;
  61.  
  62.   /* Fill in sprite name length */
  63.   iconblock.data.indirectsprite.nameisname = 8; /* file_xxx */
  64.  
  65.   /* Change to sprite-only */
  66.   mask.value  = icon_TEXT | icon_SPRITE;
  67.   flags.value = icon_SPRITE;
  68.  
  69.   /* Update icon */
  70.   Wimp_SetIconState(window, icon, flags.value, mask.value);
  71. }
  72.