home *** CD-ROM | disk | FTP | other *** search
- /* FileIcon.c */
- /*
-
- ##### # #
- # # # # #
- # # #
- # ## #### #### # ## ####
- # # # # # # # # # #
- # # # # # ### # # # #
- # # # # # # # # # #
- # ### # # # #### ##### ### ####
-
- -----------------------------------------------------------------------------
-
- This is source for use with the 'DeskLib' Wimp C programming library for
- Risc OS. I currently use v1.04 of DeskLib. This source is FreeWare, which
- means you can use it to write commercial applications, but you may not charge
- *in any way* for the distribution of this source. I (Tim Browse) retain
- all copyright on this source.
-
- This source is provided 'as is' and I offer no guarantees that is useful,
- bug-free, commented, that it will compile, or even that it exists.
-
- If it breaks in half, you own both pieces.
-
- All source © Tim Browse 1993
-
- -----------------------------------------------------------------------------
-
- */
-
- /* ANSI includes */
- #include <stdio.h>
-
- /* DeskLib includes */
- #include "DeskLib.Wimp.h"
- #include "DeskLib.WimpSWIs.h"
-
- /* Glazier includes */
- #include "Sprites.h"
-
- #include "FileIcon.h"
-
- void FileIcon(window_handle window, icon_handle icon, int filetype)
- {
- /* Icon should be an indirected text-only icon with enough room in text
- buffer to hold the sprite name.
- This converts to an indirected sprite-only icon, and fills in the sprite
- name and area.
- */
- icon_block iconblock;
- icon_flags mask, flags;
-
- Wimp_GetIconState(window, icon, &iconblock);
-
- /* Put sprite name in name field */
- sprintf((char *) iconblock.data.indirectsprite.name, "file_%3.3x", filetype);
-
- /* Fill in sprite area */
- iconblock.data.indirectsprite.spritearea = (unsigned int *) app_spritearea;
-
- /* Fill in sprite name length */
- iconblock.data.indirectsprite.nameisname = 8; /* file_xxx */
-
- /* Change to sprite-only */
- mask.value = icon_TEXT | icon_SPRITE;
- flags.value = icon_SPRITE;
-
- /* Update icon */
- Wimp_SetIconState(window, icon, flags.value, mask.value);
- }
-